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
ExtractVoiceVariantName(char *vname, int variant_num, int add_dir) {//=========================================================================== // Remove any voice variant suffix (name or number) from a voice name // Returns the voice variant name char *p; static char variant_name[40]; char variant_prefix[5]; variant_name[0] = 0; sprintf(variant_prefix,"!v%c",PATHSEP); if(add_dir == 0) variant_prefix[0] = 0; if(vname != NULL) { if((p = strchr(vname,'+')) != NULL) { // The voice name has a +variant suffix variant_num = 0; *p++ = 0; // delete the suffix from the voice name if(isdigit(*p)) { variant_num = atoi(p); // variant number } else { // voice variant name, not number sprintf(variant_name, "%s%s", variant_prefix, p); } } } if(variant_num > 0) { if(variant_num < 10) sprintf(variant_name,"%sm%d",variant_prefix, variant_num); // male else sprintf(variant_name,"%sf%d",variant_prefix, variant_num-10); // female } return(variant_name); }
false
false
false
false
false
0
_php_stream_copy_to_stream_ex(php_stream *src, php_stream *dest, size_t maxlen, size_t *len STREAMS_DC TSRMLS_DC) { char buf[CHUNK_SIZE]; size_t readchunk; size_t haveread = 0; size_t didread; size_t dummy; php_stream_statbuf ssbuf; if (!len) { len = &dummy; } if (maxlen == 0) { *len = 0; return SUCCESS; } if (maxlen == PHP_STREAM_COPY_ALL) { maxlen = 0; } if (php_stream_stat(src, &ssbuf) == 0) { if (ssbuf.sb.st_size == 0 #ifdef S_ISREG && S_ISREG(ssbuf.sb.st_mode) #endif ) { *len = 0; return SUCCESS; } } if (php_stream_mmap_possible(src)) { char *p; size_t mapped; p = php_stream_mmap_range(src, php_stream_tell(src), maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped); if (p) { mapped = php_stream_write(dest, p, mapped); php_stream_mmap_unmap_ex(src, mapped); *len = mapped; /* we've got at least 1 byte to read. * less than 1 is an error */ if (mapped > 0) { return SUCCESS; } return FAILURE; } } while(1) { readchunk = sizeof(buf); if (maxlen && (maxlen - haveread) < readchunk) { readchunk = maxlen - haveread; } didread = php_stream_read(src, buf, readchunk); if (didread) { /* extra paranoid */ size_t didwrite, towrite; char *writeptr; towrite = didread; writeptr = buf; haveread += didread; while(towrite) { didwrite = php_stream_write(dest, writeptr, towrite); if (didwrite == 0) { *len = haveread - (didread - towrite); return FAILURE; } towrite -= didwrite; writeptr += didwrite; } } else { break; } if (maxlen - haveread == 0) { break; } } *len = haveread; /* we've got at least 1 byte to read. * less than 1 is an error */ if (haveread > 0 || src->eof) { return SUCCESS; } return FAILURE; }
true
true
false
false
false
1
GetNumberOfFixedTextureUnits() { if ( ! vtkgl::MultiTexCoord2d || ! vtkgl::ActiveTexture ) { if(!this->ExtensionManagerSet()) { vtkWarningMacro(<<"extension manager not set. Return 1."); return 1; } // multitexture is a core feature of OpenGL 1.3. // multitexture is an ARB extension of OpenGL 1.2.1 int supports_GL_1_3 = this->ExtensionManager->ExtensionSupported( "GL_VERSION_1_3" ); int supports_GL_1_2_1 = this->ExtensionManager->ExtensionSupported("GL_VERSION_1_2"); int supports_ARB_mutlitexture = this->ExtensionManager->ExtensionSupported("GL_ARB_multitexture"); if(supports_GL_1_3) { this->ExtensionManager->LoadExtension("GL_VERSION_1_3"); } else if(supports_GL_1_2_1 && supports_ARB_mutlitexture) { this->ExtensionManager->LoadExtension("GL_VERSION_1_2"); this->ExtensionManager->LoadCorePromotedExtension("GL_ARB_multitexture"); } else { return 1; } } GLint numSupportedTextures = 1; glGetIntegerv(vtkgl::MAX_TEXTURE_UNITS, &numSupportedTextures); return numSupportedTextures; }
false
false
false
false
false
0
sm_metadata_copy_root(struct dm_space_map *sm, void *where_le, size_t max) { struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); struct disk_sm_root root_le; root_le.nr_blocks = cpu_to_le64(smm->ll.nr_blocks); root_le.nr_allocated = cpu_to_le64(smm->ll.nr_allocated); root_le.bitmap_root = cpu_to_le64(smm->ll.bitmap_root); root_le.ref_count_root = cpu_to_le64(smm->ll.ref_count_root); if (max < sizeof(root_le)) return -ENOSPC; memcpy(where_le, &root_le, sizeof(root_le)); return 0; }
false
true
false
false
false
1
help_window_scroll(GtkWidget *text, const gchar *key) { gchar *needle; GtkTextBuffer *buffer; GtkTextIter iter; GtkTextIter start, end; if (!text || !key) return; needle = g_strdup_printf("[section:%s]", key); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)); gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0); if (gtk_text_iter_forward_search(&iter, needle, GTK_TEXT_SEARCH_TEXT_ONLY, &start, &end, NULL)) { gint line; GtkTextMark *mark; line = gtk_text_iter_get_line(&start); gtk_text_buffer_get_iter_at_line_offset(buffer, &iter, line, 0); gtk_text_buffer_place_cursor(buffer, &iter); #if 0 gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(text), &iter, 0.0, TRUE, 0, 0); #endif /* apparently only scroll_to_mark works when the textview is not visible yet */ /* if mark exists, move it instead of creating one for every scroll */ mark = gtk_text_buffer_get_mark(buffer, SCROLL_MARKNAME); if (mark) { gtk_text_buffer_move_mark(buffer, mark, &iter); } else { mark = gtk_text_buffer_create_mark(buffer, SCROLL_MARKNAME, &iter, FALSE); } gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(text), mark, 0.0, TRUE, 0, 0); } g_free(needle); }
false
false
false
false
false
0
GetChecked( vector<CComponentInfo*>& vecChecked) { // qDebug() << "WSU get checked"; // Step through list box and pick out the checked ones for (int i = 0; i < ui.updatesList->count(); ++i) { #ifndef Q_WS_MAC if (ui.updatesList->item(i)->checkState() == Qt::Checked) #endif { CComponentInfo* pComp = qVariantValue<CComponentInfo*>( ui.updatesList->item(i)->data(1)); vecChecked.push_back(pComp); } } }
false
false
false
false
false
0
at76_disconnect(struct usb_interface *interface) { struct at76_priv *priv; priv = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); /* Disconnect after loading internal firmware */ if (!priv) return; wiphy_info(priv->hw->wiphy, "disconnecting\n"); at76_delete_device(priv); usb_put_dev(priv->udev); dev_info(&interface->dev, "disconnected\n"); }
false
false
false
false
false
0
tracker_result_store_construct (GType object_type, gint _n_columns) { TrackerResultStore * self = NULL; GPtrArray* _tmp0_ = NULL; GPtrArray* _tmp1_ = NULL; GPtrArray* _tmp2_ = NULL; gint _tmp3_ = 0; GtkIconTheme* theme = NULL; GdkScreen* _tmp4_ = NULL; GtkIconTheme* _tmp5_ = NULL; GtkIconTheme* _tmp6_ = NULL; self = (TrackerResultStore*) g_object_new (object_type, NULL); _tmp0_ = g_ptr_array_new_with_free_func (_tracker_result_store_category_node_unref0_); _g_ptr_array_unref0 (self->priv->categories); self->priv->categories = _tmp0_; _tmp1_ = g_ptr_array_new_with_free_func (_g_object_unref0_); _g_ptr_array_unref0 (self->priv->running_operations); self->priv->running_operations = _tmp1_; _tmp2_ = g_ptr_array_new_with_free_func (_g_object_unref0_); _g_ptr_array_unref0 (self->priv->delayed_operations); self->priv->delayed_operations = _tmp2_; _tmp3_ = _n_columns; self->priv->n_columns = _tmp3_; self->priv->timestamp = 1; tracker_result_store_set_icon_size (self, 24); _tmp4_ = gdk_screen_get_default (); _tmp5_ = gtk_icon_theme_get_for_screen (_tmp4_); _tmp6_ = _g_object_ref0 (_tmp5_); theme = _tmp6_; g_signal_connect_object (theme, "changed", (GCallback) _tracker_result_store_theme_changed_gtk_icon_theme_changed, self, 0); _g_object_unref0 (theme); return self; }
false
false
false
false
false
0
constructArray(TIntermAggregate* aggNode, const TType* type, TOperator op, TSourceLoc line) { TType elementType = *type; int elementCount = type->getArraySize(); TIntermAggregate *newAgg = 0; elementType.clearArrayness(); TNodeArray &seq = aggNode->getNodes(); TNodeArray::iterator sit = seq.begin(); // Count the total size of the initializer sequence and make sure it matches the array size int nInitializerSize = 0; while ( sit != seq.end() ) { nInitializerSize += (*sit)->getAsTyped()->getSize(); sit++; } if ( nInitializerSize != elementType.getObjectSize() * elementCount) { error(line, "", "constructor", "improper number of arguments to array constructor, expected %d got %d", elementType.getObjectSize() *elementCount, nInitializerSize); recover(); return 0; } aggNode->setType(*type); aggNode->setOperator(EOpConstructArray); return aggNode; /* sit = seq.begin(); // Loop over each of the elements in the initializer sequence and add to the constructors for (int ii = 0; ii < elementCount; ii++) { TIntermAggregate *tempAgg = 0; // Initialize this element of the array int nInitSize = 0; while ( nInitSize < elementType.getObjectSize() ) { tempAgg = ir_grow_aggregate( tempAgg, *sit, line); nInitSize += (*sit)->getAsTyped()->getSize(); sit++; } // Check to make sure that the initializer does not span array size boundaries. This is allowed in // HLSL, although currently not supported by the translator. It could be done, it will just make // the array code generation much more complicated, because it will have to potentially break up // elements that span array boundaries. if ( nInitSize != elementType.getObjectSize() ) { error ( line, "", "constructor", "can not handle initializers that span array element boundaries"); recover(); return 0; } newAgg = ir_grow_aggregate( newAgg, addConstructor( tempAgg, &elementType, op, 0, line), line); }*/ return addConstructor( newAgg, type, op, 0, line); }
false
false
false
false
false
0
gtk_meta_get_type() { static GType meta_type = 0; if (!meta_type) { GTypeInfo meta_info = { sizeof (GtkMetaClass), NULL, NULL, (GClassInitFunc) gtk_meta_class_init, NULL, NULL, sizeof (GtkMeta), 0, (GInstanceInitFunc) gtk_meta_init }; meta_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkMeta", &meta_info, 0); } return meta_type; }
false
false
false
false
false
0
onCmdHome(FXObject*,FXSelector,void*){ if(allowNavigation()) setDirectory(FXSystem::getHomeDirectory()); return 1; }
false
false
false
false
false
0
init() { // require an atom style with molecule IDs if (atom->molecule == NULL) error->all(FLERR,"Must use atom style with molecule IDs with fix bond/swap"); int icompute = modify->find_compute(id_temp); if (icompute < 0) error->all(FLERR,"Temperature ID for fix bond/swap does not exist"); temperature = modify->compute[icompute]; // pair and bonds must be defined // no dihedral or improper potentials allowed // special bonds must be 0 1 1 if (force->pair == NULL || force->bond == NULL) error->all(FLERR,"Fix bond/swap requires pair and bond styles"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support fix bond/swap"); if (force->angle == NULL && atom->nangles > 0 && comm->me == 0) error->warning(FLERR,"Fix bond/swap will ignore defined angles"); if (force->dihedral || force->improper) error->all(FLERR,"Fix bond/swap cannot use dihedral or improper styles"); if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) error->all(FLERR,"Fix bond/swap requires special_bonds = 0,1,1"); // need a half neighbor list, built when ever re-neighboring occurs int irequest = neighbor->request((void *) this); neighbor->requests[irequest]->pair = 0; neighbor->requests[irequest]->fix = 1; // zero out stats naccept = foursome = 0; angleflag = 0; if (force->angle) angleflag = 1; }
false
false
false
true
false
1
set_timefilter(struct archive_match *a, int timetype, time_t mtime_sec, long mtime_nsec, time_t ctime_sec, long ctime_nsec) { if (timetype & ARCHIVE_MATCH_MTIME) { if ((timetype & ARCHIVE_MATCH_NEWER) || JUST_EQUAL(timetype)) { a->newer_mtime_filter = timetype; a->newer_mtime_sec = mtime_sec; a->newer_mtime_nsec = mtime_nsec; a->setflag |= TIME_IS_SET; } if ((timetype & ARCHIVE_MATCH_OLDER) || JUST_EQUAL(timetype)) { a->older_mtime_filter = timetype; a->older_mtime_sec = mtime_sec; a->older_mtime_nsec = mtime_nsec; a->setflag |= TIME_IS_SET; } } if (timetype & ARCHIVE_MATCH_CTIME) { if ((timetype & ARCHIVE_MATCH_NEWER) || JUST_EQUAL(timetype)) { a->newer_ctime_filter = timetype; a->newer_ctime_sec = ctime_sec; a->newer_ctime_nsec = ctime_nsec; a->setflag |= TIME_IS_SET; } if ((timetype & ARCHIVE_MATCH_OLDER) || JUST_EQUAL(timetype)) { a->older_ctime_filter = timetype; a->older_ctime_sec = ctime_sec; a->older_ctime_nsec = ctime_nsec; a->setflag |= TIME_IS_SET; } } return (ARCHIVE_OK); }
false
false
false
false
false
0
get_block(struct block_allocation *alloc, u32 block) { struct region *reg = alloc->list.iter; block += alloc->list.partial_iter; for (; reg; reg = reg->next) { if (block < reg->len) return reg->block + block; block -= reg->len; } return EXT4_ALLOCATE_FAILED; }
false
false
false
false
false
0
hpm2_get_lan_channel_capabilities(struct ipmi_intf * intf, uint8_t hpm2_lan_params_start, struct hpm2_lan_channel_capabilities * caps) { struct ipmi_rq req; struct ipmi_rs * rsp; uint8_t rq[4]; /* reset result */ memset(caps, 0, sizeof (struct hpm2_lan_channel_capabilities)); /* prepare request */ memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_TRANSPORT; req.msg.cmd = IPMI_LAN_GET_CONFIG; req.msg.data = (uint8_t *) &rq; req.msg.data_len = sizeof(rq); /* prepare request data */ rq[0] = 0xE; /* sending channel */ rq[1] = hpm2_lan_params_start; /* HPM.2 Channel Caps */ rq[2] = rq[3] = 0; /* send */ rsp = intf->sendrecv(intf, &req); if (rsp) { lprintf(LOG_NOTICE,"Error sending request\n"); return -1; } if (rsp->ccode == 0x80) { lprintf(LOG_DEBUG,"HPM.2 Channel Caps parameter is not supported\n"); return rsp->ccode; } else if (rsp->ccode) { lprintf(LOG_NOTICE,"Get LAN Configuration Parameters request failed," " compcode = %x\n", rsp->ccode); return rsp->ccode; } /* check response length */ if (rsp->data_len != sizeof (struct hpm2_lan_channel_capabilities) + 1) { lprintf(LOG_NOTICE,"Bad response length, len=%d\n", rsp->data_len); return -1; } /* check parameter revision */ if (rsp->data[0] != HPM2_LAN_PARAMS_REV) { lprintf(LOG_NOTICE,"Bad HPM.2 LAN parameter revision, rev=%d\n", rsp->data[0]); return -1; } /* copy parameter data */ memcpy(caps, &rsp->data[1], sizeof (struct hpm2_lan_channel_capabilities)); #if WORDS_BIGENDIAN /* swap bytes to convert from little-endian format */ caps->max_inbound_pld_size = BSWAP_16(caps->max_inbound_pld_size); caps->max_outbound_pld_size = BSWAP_16(caps->max_outbound_pld_size); #endif return 0; }
false
true
false
true
false
1
GetDataBlock_ (xgdIOCtx * fd, unsigned char *buf, int *ZeroDataBlockP) { unsigned char count; if (!ReadOK (fd, &count, 1)) { return -1; } *ZeroDataBlockP = count == 0; if ((count != 0) && (!ReadOK (fd, buf, count))) { return -1; } return count; }
false
false
false
false
false
0
hatsuda_wall_triangle_act(tenm_object *my, const tenm_object *player) { double edge_x; /* sanity check */ if (my == NULL) { fprintf(stderr, "hatsuda_wall_triangle_act: my is NULL\n"); return 0; } if (player == NULL) return 0; (my->count[2])++; if (my->count[1] == 0) { edge_x = hatsuda_wall_triangle_edge(my->count[2]); if ((my->x + my->count_d[2] >= edge_x) && (my->x - my->count_d[2] <= edge_x)) { my->count[1] = 1; my->count[2] = 0; if (my->count_d[0] > 0.0) my->count_d[1] = my->count_d[0]; else my->count_d[1] = -my->count_d[0]; if (my->y - my->count_d[2] > player->y) my->count_d[1] *= -1.0; my->count_d[0] = 0.0; } } return 0; }
false
false
false
false
false
0
decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) { uint32_t major = 0, minor = 0; __be32 *p; int ret = 0; *rdev = MKDEV(0,0); if (unlikely(bitmap[1] & (FATTR4_WORD1_RAWDEV - 1U))) return -EIO; if (likely(bitmap[1] & FATTR4_WORD1_RAWDEV)) { dev_t tmp; p = xdr_inline_decode(xdr, 8); if (unlikely(!p)) goto out_overflow; major = be32_to_cpup(p++); minor = be32_to_cpup(p); tmp = MKDEV(major, minor); if (MAJOR(tmp) == major && MINOR(tmp) == minor) *rdev = tmp; bitmap[1] &= ~ FATTR4_WORD1_RAWDEV; ret = NFS_ATTR_FATTR_RDEV; } dprintk("%s: rdev=(0x%x:0x%x)\n", __func__, major, minor); return ret; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; }
false
false
false
false
false
0
init_workarounds_ring(struct intel_engine_cs *ring) { struct drm_device *dev = ring->dev; struct drm_i915_private *dev_priv = dev->dev_private; WARN_ON(ring->id != RCS); dev_priv->workarounds.count = 0; if (IS_BROADWELL(dev)) return bdw_init_workarounds(ring); if (IS_CHERRYVIEW(dev)) return chv_init_workarounds(ring); if (IS_SKYLAKE(dev)) return skl_init_workarounds(ring); if (IS_BROXTON(dev)) return bxt_init_workarounds(ring); return 0; }
false
false
false
false
false
0
stereo_split(short *output1, short *output2, short *input, int n) { int i; for(i=0;i<n;i++) { *output1++ = *input++; *output2++ = *input++; } }
false
false
false
false
false
0
get_category(string name) { if(name != "") { xmlNode* category = doc->children->children; string cat_name = ""; while(category != NULL && !((cat_name = Utils::Xml::get_property(category, "name")) == name)) category = get_next_category(category); if(category != NULL && cat_name == name) return category; } return NULL; }
false
false
false
false
false
0
push_integer_local(int index) { //fprintf(out, " mov.w r12, r15\n"); //fprintf(out, " sub.w #0x%02x, r15\n", LOCALS(index)); if (reg < reg_max) { //fprintf(out, " mov.w @r15, r%d\n", REG_STACK(reg)); fprintf(out, " mov.w -%d(r12), r%d ; push local_%d\n", LOCALS(index), REG_STACK(reg), index); reg++; } else { //fprintf(out, " push @r15\n"); fprintf(out, " push -%d(r12) ; push local_%d\n", LOCALS(index), index); stack++; } return 0; }
false
false
false
false
false
0
mpeg_ts_type_find (GstTypeFind * tf, gpointer unused) { /* TS packet sizes to test: normal, DVHS packet size and * FEC with 16 or 20 byte codes packet size. */ const gint pack_sizes[] = { 188, 192, 204, 208 }; const guint8 *data = NULL; guint size = 0; guint64 skipped = 0; while (skipped < GST_MPEGTS_TYPEFIND_SCAN_LENGTH) { if (size < MPEGTS_HDR_SIZE) { data = gst_type_find_peek (tf, skipped, GST_MPEGTS_TYPEFIND_SYNC_SIZE); if (!data) break; size = GST_MPEGTS_TYPEFIND_SYNC_SIZE; } /* Have at least MPEGTS_HDR_SIZE bytes at this point */ if (IS_MPEGTS_HEADER (data)) { gint p; GST_LOG ("possible mpeg-ts sync at offset %" G_GUINT64_FORMAT, skipped); for (p = 0; p < G_N_ELEMENTS (pack_sizes); p++) { gint found; /* Probe ahead at size pack_sizes[p] */ found = mpeg_ts_probe_headers (tf, skipped, pack_sizes[p]); if (found >= GST_MPEGTS_TYPEFIND_MIN_HEADERS) { gint probability; /* found at least 4 headers. 10 headers = MAXIMUM probability. * Arbitrarily, I assigned 10% probability for each header we * found, 40% -> 100% */ probability = MIN (10 * found, GST_TYPE_FIND_MAXIMUM); gst_type_find_suggest_simple (tf, probability, "video/mpegts", "systemstream", G_TYPE_BOOLEAN, TRUE, "packetsize", G_TYPE_INT, pack_sizes[p], NULL); return; } } } data++; skipped++; size--; } }
false
false
false
false
false
0
test_object_tree_walk__0(void) { git_oid id; git_tree *tree; int ct; git_oid_fromstr(&id, tree_oid); cl_git_pass(git_tree_lookup(&tree, g_repo, &id)); ct = 0; cl_git_pass(git_tree_walk(tree, treewalk_count_cb, GIT_TREEWALK_PRE, &ct)); cl_assert_equal_i(3, ct); ct = 0; cl_git_pass(git_tree_walk(tree, treewalk_count_cb, GIT_TREEWALK_POST, &ct)); cl_assert_equal_i(3, ct); git_tree_free(tree); }
false
false
false
false
false
0
vp702x_fe_sleep(struct dvb_frontend *fe) { deb_fe("%s\n",__func__); return 0; }
false
false
false
false
false
0
gedit_file_browser_store_iter_has_child (GtkTreeModel *tree_model, GtkTreeIter *iter) { FileBrowserNode *node; GeditFileBrowserStore *model; g_return_val_if_fail (GEDIT_IS_FILE_BROWSER_STORE (tree_model), FALSE); g_return_val_if_fail (iter == NULL || iter->user_data != NULL, FALSE); model = GEDIT_FILE_BROWSER_STORE (tree_model); if (iter == NULL) node = model->priv->virtual_root; else node = (FileBrowserNode *) (iter->user_data); return filter_tree_model_iter_has_child_real (model, node); }
false
false
false
false
false
0
au_xino_set(struct super_block *sb, struct au_opt_xino *xino, int remount) { int err, skip; struct dentry *parent, *cur_parent; struct qstr *dname, *cur_name; struct file *cur_xino; struct inode *dir; struct au_sbinfo *sbinfo; SiMustWriteLock(sb); err = 0; sbinfo = au_sbi(sb); parent = dget_parent(xino->file->f_path.dentry); if (remount) { skip = 0; dname = &xino->file->f_path.dentry->d_name; cur_xino = sbinfo->si_xib; if (cur_xino) { cur_parent = dget_parent(cur_xino->f_path.dentry); cur_name = &cur_xino->f_path.dentry->d_name; skip = (cur_parent == parent && au_qstreq(dname, cur_name)); dput(cur_parent); } if (skip) goto out; } au_opt_set(sbinfo->si_mntflags, XINO); dir = d_inode(parent); mutex_lock_nested(&dir->i_mutex, AuLsc_I_PARENT); /* mnt_want_write() is unnecessary here */ err = au_xino_set_xib(sb, xino->file); if (!err) err = au_xigen_set(sb, xino->file); if (!err) err = au_xino_set_br(sb, xino->file); mutex_unlock(&dir->i_mutex); if (!err) goto out; /* success */ /* reset all */ AuIOErr("failed creating xino(%d).\n", err); au_xigen_clr(sb); xino_clear_xib(sb); out: dput(parent); return err; }
false
false
false
false
false
0
solveClusters(btScalar sor) { for(int i=0,ni=m_joints.size();i<ni;++i) { m_joints[i]->Solve(m_sst.sdt,sor); } }
false
false
false
false
false
0
redisAsyncHandleRead(redisAsyncContext *ac) { redisContext *c = &(ac->c); if (redisBufferRead(c) == REDIS_ERR) { __redisAsyncDisconnect(ac); } else { /* Always re-schedule reads */ if (ac->evAddRead) ac->evAddRead(ac->_adapter_data); redisProcessCallbacks(ac); } }
false
false
false
false
false
0
nrrdKindSize(int kind) { static const char me[]="nrrdKindSize"; unsigned int ret; if (!( AIR_IN_OP(nrrdKindUnknown, kind, nrrdKindLast) )) { /* they gave us invalid or unknown kind */ return 0; } switch (kind) { case nrrdKindDomain: case nrrdKindSpace: case nrrdKindTime: case nrrdKindList: case nrrdKindPoint: case nrrdKindVector: case nrrdKindCovariantVector: case nrrdKindNormal: ret = 0; break; case nrrdKindStub: case nrrdKindScalar: ret = 1; break; case nrrdKindComplex: case nrrdKind2Vector: ret = 2; break; case nrrdKind3Color: case nrrdKindRGBColor: case nrrdKindHSVColor: case nrrdKindXYZColor: ret = 3; break; case nrrdKind4Color: case nrrdKindRGBAColor: ret = 4; break; case nrrdKind3Vector: case nrrdKind3Normal: ret = 3; break; case nrrdKind4Vector: case nrrdKindQuaternion: ret = 4; break; case nrrdKind2DSymMatrix: ret = 3; break; case nrrdKind2DMaskedSymMatrix: ret = 4; break; case nrrdKind2DMatrix: ret = 4; break; case nrrdKind2DMaskedMatrix: ret = 5; break; case nrrdKind3DSymMatrix: ret = 6; break; case nrrdKind3DMaskedSymMatrix: ret = 7; break; case nrrdKind3DMatrix: ret = 9; break; case nrrdKind3DMaskedMatrix: ret = 10; break; default: fprintf(stderr, "%s: PANIC: nrrdKind %d not implemented!\n", me, kind); ret = UINT_MAX; } return ret; }
false
false
false
false
false
0
handle_output_queue(GuardType& g) { if (msg_queue()->is_empty()) return cancel_wakeup_output(g); ACE_Message_Block* mblk; if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { sLog.outError("WorldSocket::handle_output_queue dequeue_head"); return -1; } const size_t send_len = mblk->length(); #ifdef MSG_NOSIGNAL ssize_t n = peer().send(mblk->rd_ptr(), send_len, MSG_NOSIGNAL); #else ssize_t n = peer().send(mblk->rd_ptr(), send_len); #endif // MSG_NOSIGNAL if (n == 0) { mblk->release(); return -1; } else if (n == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) { msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero); return schedule_wakeup_output(g); } mblk->release(); return -1; } else if (n < (ssize_t)send_len) // now n > 0 { mblk->rd_ptr(static_cast<size_t>(n)); if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) { sLog.outError("WorldSocket::handle_output_queue enqueue_head"); mblk->release(); return -1; } return schedule_wakeup_output(g); } else // now n == send_len { mblk->release(); return msg_queue()->is_empty() ? cancel_wakeup_output(g) : ACE_Event_Handler::WRITE_MASK; } ACE_NOTREACHED(return -1); }
false
false
false
false
false
0
ioremap_change_attr(unsigned long vaddr, unsigned long size, enum page_cache_mode pcm) { unsigned long nrpages = size >> PAGE_SHIFT; int err; switch (pcm) { case _PAGE_CACHE_MODE_UC: default: err = _set_memory_uc(vaddr, nrpages); break; case _PAGE_CACHE_MODE_WC: err = _set_memory_wc(vaddr, nrpages); break; case _PAGE_CACHE_MODE_WT: err = _set_memory_wt(vaddr, nrpages); break; case _PAGE_CACHE_MODE_WB: err = _set_memory_wb(vaddr, nrpages); break; } return err; }
false
false
false
false
false
0
globus_rls_client_lrc_attr_value_get(globus_rls_handle_t *h, char *key, char *name, globus_rls_obj_type_t objtype, globus_list_t **attr_list) { static char *method = "lrc_attr_value_get"; globus_result_t r; globus_result_t saver; BUFFER b; char obuf[100]; char nbuf[BUFLEN]; char tbuf[BUFLEN]; char sval[BUFLEN]; globus_rls_attribute_t *attr; int nomem; RLSLIST *rlslist; if ((r = checkhandle(h)) != GLOBUS_SUCCESS) return r; if ((r = rrpc_call(h, &b, method, 3, key, name, iarg(objtype, obuf))) != GLOBUS_SUCCESS) return r; saver = GLOBUS_SUCCESS; if ((rlslist = rlslist_new(free_attr)) == NULL) nomem = 1; else nomem = 0; while (1) { if ((r = rrpc_getstr(h, &b, nbuf, BUFLEN)) != GLOBUS_SUCCESS) return r; if (!*nbuf) break; if ((r = rrpc_getstr(h, &b, tbuf, BUFLEN)) != GLOBUS_SUCCESS) return r; if ((r = rrpc_getstr(h, &b, sval, BUFLEN)) != GLOBUS_SUCCESS) return r; if (!(attr = globus_libc_calloc(1, sizeof(*attr)))) { nomem++; continue; } if ((attr->name = globus_libc_strdup(nbuf)) == NULL) { free_attr(attr); nomem++; continue; } if ((r = globus_rls_client_s2attr(atoi(tbuf), sval, attr)) != GLOBUS_RLS_SUCCESS) { saver = r; free_attr(attr); continue; } attr->objtype = objtype; if (globus_list_insert(&rlslist->list, attr) != GLOBUS_SUCCESS) { free_attr(attr); nomem++; continue; } } if (nomem && rlslist) globus_rls_client_free_list(rlslist->list); else *attr_list = rlslist->list; if (nomem) return mkresult(GLOBUS_RLS_NOMEMORY, NULL); return saver; }
false
false
false
false
false
0
create_verify_ctx(char *data, char *digest, char *queryfile, char *ca_path, char *ca_file, char *untrusted) { TS_VERIFY_CTX *ctx = NULL; BIO *input = NULL; TS_REQ *request = NULL; int ret = 0; if (data != NULL || digest != NULL) { if (!(ctx = TS_VERIFY_CTX_new())) goto err; ctx->flags = TS_VFY_VERSION | TS_VFY_SIGNER; if (data != NULL) { ctx->flags |= TS_VFY_DATA; if (!(ctx->data = BIO_new_file(data, "rb"))) goto err; } else if (digest != NULL) { long imprint_len; ctx->flags |= TS_VFY_IMPRINT; if (!(ctx->imprint = string_to_hex(digest, &imprint_len))) { BIO_printf(bio_err, "invalid digest string\n"); goto err; } ctx->imprint_len = imprint_len; } } else if (queryfile != NULL) { /* The request has just to be read, decoded and converted to a verify context object. */ if (!(input = BIO_new_file(queryfile, "rb"))) goto err; if (!(request = d2i_TS_REQ_bio(input, NULL))) goto err; if (!(ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL))) goto err; } else return NULL; /* Add the signature verification flag and arguments. */ ctx->flags |= TS_VFY_SIGNATURE; /* Initialising the X509_STORE object. */ if (!(ctx->store = create_cert_store(ca_path, ca_file))) goto err; /* Loading untrusted certificates. */ if (untrusted && !(ctx->certs = TS_CONF_load_certs(untrusted))) goto err; ret = 1; err: if (!ret) { TS_VERIFY_CTX_free(ctx); ctx = NULL; } BIO_free_all(input); TS_REQ_free(request); return ctx; }
false
false
false
false
false
0
updateColumnTransposePFI ( CoinIndexedVector * regionSparse) const { double *region = regionSparse->denseVector ( ); int numberNonZero = regionSparse->getNumElements(); int *index = regionSparse->getIndices ( ); int i; #ifdef COIN_DEBUG for (i=0;i<numberNonZero;i++) { int iRow=index[i]; assert (iRow>=0&&iRow<numberRows_); assert (region[iRow]); } #endif const int * pivotColumn = pivotColumn_.array()+numberRows_; const CoinFactorizationDouble *pivotRegion = pivotRegion_.array()+numberRows_; double tolerance = zeroTolerance_; const CoinBigIndex *startColumn = startColumnU_.array()+numberRows_; const int *indexRow = indexRowU_.array(); const CoinFactorizationDouble *element = elementU_.array(); for (i=numberPivots_-1 ; i>=0; i-- ) { int pivotRow = pivotColumn[i]; CoinFactorizationDouble pivotValue = region[pivotRow]*pivotRegion[i]; for (CoinBigIndex j= startColumn[i] ; j < startColumn[i+1]; j++ ) { int iRow = indexRow[j]; CoinFactorizationDouble value = element[j]; pivotValue -= value * region[iRow]; } //pivotValue *= pivotRegion[i]; if ( fabs ( pivotValue ) > tolerance ) { if (!region[pivotRow]) index[numberNonZero++] = pivotRow; region[pivotRow] = pivotValue; } else { if (region[pivotRow]) region[pivotRow] = COIN_INDEXED_REALLY_TINY_ELEMENT; } } //set counts regionSparse->setNumElements ( numberNonZero ); }
false
false
false
false
false
0
parse_fragmentation_key(section_config_t *section, char *value) { if(!strcasecmp(value, "enable")) { section->config.fragmentation_enabled = 1; } else if (!strcasecmp(value, "disable")) { section->config.fragmentation_enabled = 0; } else { ML_ERROR(("Line %d, unexpected fragmentation value %s. Legal values are: enable/disable", coll_ml_config_yynewlines, value)); return OMPI_ERROR; } return OMPI_SUCCESS; }
false
false
false
false
false
0
load(const std::string &fontname) { if (fontname.empty()) return false; XFontSet set = createFontSet(fontname.c_str(), m_utf8mode); if (set == 0) return false; if (m_fontset != 0) XFreeFontSet(App::instance()->display(), m_fontset); m_fontset = set; m_setextents = XExtentsOfFontSet(m_fontset); return true; }
false
false
false
false
false
0
mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) { mp_digit D, r, rr; int x, res; mp_int t; /* if the shift count is <= 0 then we do no work */ if (b <= 0) { res = mp_copy (a, c); if (d != NULL) { mp_zero (d); } return res; } if ((res = mp_init (&t)) != MP_OKAY) { return res; } /* get the remainder */ if (d != NULL) { if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { mp_clear (&t); return res; } } /* copy */ if ((res = mp_copy (a, c)) != MP_OKAY) { mp_clear (&t); return res; } /* shift by as many digits in the bit count */ if (b >= (int)DIGIT_BIT) { mp_rshd (c, b / DIGIT_BIT); } /* shift any bit count < DIGIT_BIT */ D = (mp_digit) (b % DIGIT_BIT); if (D != 0) { register mp_digit *tmpc, mask, shift; /* mask */ mask = (((mp_digit)1) << D) - 1; /* shift for lsb */ shift = DIGIT_BIT - D; /* alias */ tmpc = c->dp + (c->used - 1); /* carry */ r = 0; for (x = c->used - 1; x >= 0; x--) { /* get the lower bits of this word in a temp */ rr = *tmpc & mask; /* shift the current word and mix in the carry bits from the previous word */ *tmpc = (*tmpc >> D) | (r << shift); --tmpc; /* set the carry to the carry bits of the current word found above */ r = rr; } } mp_clamp (c); if (d != NULL) { mp_exch (&t, d); } mp_clear (&t); return MP_OKAY; }
false
false
false
false
false
0
parse_noopt( char **sp, const char *shortopt, const char *longopt, lList **ppcmdline, lList **alpp ) { DENTER (TOP_LAYER, "parse_noopt"); if ( (!strcmp(shortopt, *sp)) || (longopt && !strcmp(longopt, *sp)) ) { if(!lGetElemStr(*ppcmdline, SPA_switch, shortopt)) { sge_add_noarg(ppcmdline, 0, shortopt, NULL); } sp++; } DEXIT; return sp; }
false
false
false
false
false
0
ext2fs_image_super_read(ext2_filsys fs, int fd, int flags EXT2FS_ATTR((unused))) { char *buf; ssize_t actual, size; errcode_t retval; size = fs->blocksize * (fs->group_desc_count + 1); buf = malloc(size); if (!buf) return ENOMEM; /* * Read it all in. */ actual = read(fd, buf, size); if (actual == -1) { retval = errno; goto errout; } if (actual != size) { retval = EXT2_ET_SHORT_READ; goto errout; } /* * Now copy in the superblock and group descriptors */ memcpy(fs->super, buf, SUPERBLOCK_SIZE); memcpy(fs->group_desc, buf + fs->blocksize, fs->blocksize * fs->group_desc_count); retval = 0; errout: free(buf); return retval; }
false
true
false
false
true
1
ISO2UNIX(char *timestring) { char c, *p; struct tm when; time_t t; // let localtime fill in all default fields such as summer time, TZ etc. t = time(NULL); localtime_r(&t, &when); when.tm_sec = 0; when.tm_wday = 0; when.tm_yday = 0; when.tm_isdst = -1; if ( strlen(timestring) != 12 ) { LogError( "Wrong time format '%s'\n", timestring); return 0; } // 2006 05 05 12 00 // year p = timestring; c = p[4]; p[4] = '\0'; when.tm_year = atoi(p) - 1900; p[4] = c; // month p += 4; c = p[2]; p[2] = '\0'; when.tm_mon = atoi(p) - 1; p[2] = c; // day p += 2; c = p[2]; p[2] = '\0'; when.tm_mday = atoi(p); p[2] = c; // hour p += 2; c = p[2]; p[2] = '\0'; when.tm_hour = atoi(p); p[2] = c; // minute p += 2; when.tm_min = atoi(p); t = mktime(&when); if ( t == -1 ) { LogError( "Failed to convert string '%s'\n", timestring); return 0; } else { // printf("%s %s", timestring, ctime(&t)); return t; } }
false
false
false
false
true
1
pscr(int l, int o) { if((l >= 0 && l <= term.t_nrow) && (o >= 0 && o < term.t_ncol)) return(&(pscreen[l]->v_text[o])); else return(NULL); }
false
false
false
false
false
0
handle_skipped_hlink(struct file_struct *file, int itemizing, enum logcode code, int f_out) { char fbuf[MAXPATHLEN]; int new_last_ndx; struct file_list *save_flist = cur_flist; /* If we skip the last item in a chain of links and there was a * prior non-skipped hard-link waiting to finish, finish it now. */ if ((new_last_ndx = skip_hard_link(file, &cur_flist)) < 0) return; file = cur_flist->files[new_last_ndx - cur_flist->ndx_start]; cur_flist->in_progress--; /* undo prior increment */ f_name(file, fbuf); recv_generator(fbuf, file, new_last_ndx, itemizing, code, f_out); cur_flist = save_flist; }
false
false
false
false
false
0
run_task(Task *) { if (!_active) return false; Packet *p; while (1) { p = read_packet(0); if (_dead) { if (_stop) router()->please_stop_driver(); return false; } // check sampling probability if (_sampling_prob >= (1 << SAMPLING_SHIFT) || (click_random() & ((1 << SAMPLING_SHIFT) - 1)) < _sampling_prob) break; if (p) p->kill(); } if (p) output(0).push(p); _task.fast_reschedule(); return true; }
false
false
false
false
false
0
cdb_make_put(struct cdb_make *cdbmp, const void *key, unsigned klen, const void *val, unsigned vlen, enum cdb_put_mode mode) { unsigned hval = cdb_hash(key, klen); int r; switch(mode) { case CDB_PUT_REPLACE: case CDB_PUT_INSERT: case CDB_PUT_WARN: case CDB_PUT_REPLACE0: r = findrec(cdbmp, key, klen, hval, mode); if (r < 0) return -1; if (r && mode == CDB_PUT_INSERT) return errno = EEXIST, 1; break; case CDB_PUT_ADD: r = 0; break; default: return errno = EINVAL, -1; } if (_cdb_make_add(cdbmp, hval, key, klen, val, vlen) < 0) return -1; return r; }
false
false
false
false
false
0
fxresize(void** ptr,unsigned long size){ register void *p=NULL; if(size!=0){ if((p=realloc(*ptr,size))==NULL) return FALSE; } else{ if(*ptr) free(*ptr); } *ptr=p; return TRUE; }
false
false
false
false
false
0
obtain_firmware(struct hfi1_devdata *dd) { int err = 0; mutex_lock(&fw_mutex); if (fw_state == FW_ACQUIRED) { goto done; /* already acquired */ } else if (fw_state == FW_ERR) { err = fw_err; goto done; /* already tried and failed */ } if (fw_8051_load) { err = obtain_one_firmware(dd, fw_8051_name, &fw_8051); if (err) goto done; } if (fw_fabric_serdes_load) { err = obtain_one_firmware(dd, fw_fabric_serdes_name, &fw_fabric); if (err) goto done; } if (fw_sbus_load) { err = obtain_one_firmware(dd, fw_sbus_name, &fw_sbus); if (err) goto done; } if (fw_pcie_serdes_load) { err = obtain_one_firmware(dd, fw_pcie_serdes_name, &fw_pcie); if (err) goto done; } if (platform_config_load) { platform_config = NULL; err = request_firmware(&platform_config, platform_config_name, &dd->pcidev->dev); if (err) { err = 0; platform_config = NULL; } } /* success */ fw_state = FW_ACQUIRED; done: if (err) { fw_err = err; fw_state = FW_ERR; } mutex_unlock(&fw_mutex); return err; }
false
false
false
false
false
0
tax_brief_op_dec (NODE_T * p) { if (p != NO_NODE) { if (IS (p, BRIEF_OPERATOR_DECLARATION)) { tax_brief_op_dec (SUB (p)); tax_brief_op_dec (NEXT (p)); } else if (is_one_of (p, OP_SYMBOL, COMMA_SYMBOL, STOP)) { tax_brief_op_dec (NEXT (p)); } else if (IS (p, DEFINING_OPERATOR)) { TAG_T *entry = OPERATORS (TABLE (p)); MOID_T *m = MOID (NEXT_NEXT (p)); check_operator_dec (p); while (entry != NO_TAG && NODE (entry) != p) { FORWARD (entry); } MOID (p) = m; TAX (p) = entry; HEAP (entry) = LOC_SYMBOL; MOID (entry) = m; tax_brief_op_dec (NEXT (p)); } else { tax_tags (p); } } }
false
false
false
false
false
0
i40e_aq_str(struct i40e_hw *hw, enum i40e_admin_queue_err aq_err) { switch (aq_err) { case I40E_AQ_RC_OK: return "OK"; case I40E_AQ_RC_EPERM: return "I40E_AQ_RC_EPERM"; case I40E_AQ_RC_ENOENT: return "I40E_AQ_RC_ENOENT"; case I40E_AQ_RC_ESRCH: return "I40E_AQ_RC_ESRCH"; case I40E_AQ_RC_EINTR: return "I40E_AQ_RC_EINTR"; case I40E_AQ_RC_EIO: return "I40E_AQ_RC_EIO"; case I40E_AQ_RC_ENXIO: return "I40E_AQ_RC_ENXIO"; case I40E_AQ_RC_E2BIG: return "I40E_AQ_RC_E2BIG"; case I40E_AQ_RC_EAGAIN: return "I40E_AQ_RC_EAGAIN"; case I40E_AQ_RC_ENOMEM: return "I40E_AQ_RC_ENOMEM"; case I40E_AQ_RC_EACCES: return "I40E_AQ_RC_EACCES"; case I40E_AQ_RC_EFAULT: return "I40E_AQ_RC_EFAULT"; case I40E_AQ_RC_EBUSY: return "I40E_AQ_RC_EBUSY"; case I40E_AQ_RC_EEXIST: return "I40E_AQ_RC_EEXIST"; case I40E_AQ_RC_EINVAL: return "I40E_AQ_RC_EINVAL"; case I40E_AQ_RC_ENOTTY: return "I40E_AQ_RC_ENOTTY"; case I40E_AQ_RC_ENOSPC: return "I40E_AQ_RC_ENOSPC"; case I40E_AQ_RC_ENOSYS: return "I40E_AQ_RC_ENOSYS"; case I40E_AQ_RC_ERANGE: return "I40E_AQ_RC_ERANGE"; case I40E_AQ_RC_EFLUSHED: return "I40E_AQ_RC_EFLUSHED"; case I40E_AQ_RC_BAD_ADDR: return "I40E_AQ_RC_BAD_ADDR"; case I40E_AQ_RC_EMODE: return "I40E_AQ_RC_EMODE"; case I40E_AQ_RC_EFBIG: return "I40E_AQ_RC_EFBIG"; } snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err); return hw->err_str; }
false
false
false
false
false
0
bValidate( void ) { // Validate the base class SimnBase::bValidate( ); if( ! m_oCmdOPT.bIsValid( ) ) SetErrMsg( m_oCmdOPT.rosGetErrMsg( ) ); if( ! m_oCmdPR .bIsValid( ) ) SetErrMsg( m_oCmdPR .rosGetErrMsg( ) ); if( ! m_oCmdGEN.bIsValid( ) ) SetErrMsg( m_oCmdGEN.rosGetErrMsg( ) ); switch( eGetAnaType( ) ) { case eCMD_OP : if( ! m_oCmdOP.bIsValid( ) ) SetErrMsg( m_oCmdOP.rosGetErrMsg( ) ); break; case eCMD_DC : if( ! m_oCmdDC.bIsValid( ) ) SetErrMsg( m_oCmdDC.rosGetErrMsg( ) ); break; case eCMD_AC : if( ! m_oCmdAC.bIsValid( ) ) SetErrMsg( m_oCmdAC.rosGetErrMsg( ) ); break; case eCMD_TR : if( ! m_oCmdTR.bIsValid( ) ) SetErrMsg( m_oCmdTR.rosGetErrMsg( ) ); break; case eCMD_FO : if( ! m_oCmdFO.bIsValid( ) ) SetErrMsg( m_oCmdFO.rosGetErrMsg( ) ); break; default : SetErrMsg( wxT("No valid analysis command exists.") ); } return( bIsValid( ) ); }
false
false
false
false
false
0
free_rule_list_func (void *data) { DBusList **list = data; if (list == NULL) /* DBusHashTable is on crack */ return; _dbus_list_foreach (list, free_rule_func, NULL); _dbus_list_clear (list); dbus_free (list); }
false
false
false
false
false
0
showAddTags(AjPStr *tagsout, const AjPFeature feat, AjBool values) { AjPStr tagnam = NULL; AjPStr tagval = NULL; AjIList titer; /* ** iterate through the tags and test for match to patterns */ (void) values; /* make it used */ tagval = ajStrNew(); tagnam = ajStrNew(); titer = ajFeatTagIter(feat); /* don't display the translation tag - it is far too long */ while(ajFeatTagval(titer, &tagnam, &tagval)) if(ajStrCmpC(tagnam, "translation")) { if(ajStrGetLen(tagval)) ajFmtPrintAppS(tagsout, " %S=\"%S\"", tagnam, tagval); else ajFmtPrintAppS(tagsout, " %S", tagnam); } ajListIterDel(&titer); ajStrDel(&tagval); ajStrDel(&tagnam); return; }
false
false
false
false
false
0
ocfs2_rw_unlock(struct inode *inode, int write) { int level = write ? DLM_LOCK_EX : DLM_LOCK_PR; struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); mlog(0, "inode %llu drop %s RW lock\n", (unsigned long long)OCFS2_I(inode)->ip_blkno, write ? "EXMODE" : "PRMODE"); if (!ocfs2_mount_local(osb)) ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); }
false
false
false
false
false
0
Pan() { if (this->CurrentRenderer == NULL) { return; } vtkRenderWindowInteractor *rwi = this->Interactor; double ViewFocus[4]; double NewPickPoint[4]; // Calculate the focal depth since we'll be using it a lot vtkCamera* camera = this->CurrentRenderer->GetActiveCamera(); camera->GetFocalPoint(ViewFocus); this->ComputeWorldToDisplay(ViewFocus[0], ViewFocus[1], ViewFocus[2], ViewFocus); double focalDepth = ViewFocus[2]; this->ComputeDisplayToWorld(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1], focalDepth, NewPickPoint); // Get the current focal point and position camera->GetFocalPoint(ViewFocus); double *ViewPoint = camera->GetPosition(); // Compute a translation vector, moving everything 1/10 // the distance to the cursor. (Arbitrary scale factor) double MotionVector[3]; MotionVector[0] = 0.1 * (ViewFocus[0] - NewPickPoint[0]); MotionVector[1] = 0.1 * (ViewFocus[1] - NewPickPoint[1]); MotionVector[2] = 0.1 * (ViewFocus[2] - NewPickPoint[2]); camera->SetFocalPoint(MotionVector[0] + ViewFocus[0], MotionVector[1] + ViewFocus[1], MotionVector[2] + ViewFocus[2]); camera->SetPosition(MotionVector[0] + ViewPoint[0], MotionVector[1] + ViewPoint[1], MotionVector[2] + ViewPoint[2]); if (rwi->GetLightFollowCamera()) { this->CurrentRenderer->UpdateLightsGeometryToFollowCamera(); } rwi->Render(); }
false
false
false
false
false
0
redo() { if (!m_undoOnly) { m_sketchWidget->moveLegBendpoint(m_fromID, m_fromConnectorID, m_index, m_newPos); } BaseCommand::redo(); }
false
false
false
false
false
0
create_convert(std::locale const &in,cdata const &cd,character_facet_type type) { switch(type) { case char_facet: #ifdef WITH_CASE_MAPS if(cd.utf8) return std::locale(in,new utf8_converter_impl(cd)); #endif return std::locale(in,new converter_impl<char>(cd)); case wchar_t_facet: return std::locale(in,new converter_impl<wchar_t>(cd)); #ifdef BOOST_HAS_CHAR16_T case char16_t_facet: return std::locale(in,new converter_impl<char16_t>(cd)); #endif #ifdef BOOST_HAS_CHAR32_T case char32_t_facet: return std::locale(in,new converter_impl<char32_t>(cd)); #endif default: return in; } }
false
false
false
false
false
0
nvkm_device_init(struct nvkm_device *device) { struct nvkm_subdev *subdev; int ret, i; s64 time; ret = nvkm_device_preinit(device); if (ret) return ret; nvkm_device_fini(device, false); nvdev_trace(device, "init running...\n"); time = ktime_to_us(ktime_get()); if (device->func->init) { ret = device->func->init(device); if (ret) goto fail; } for (i = 0; i < NVKM_SUBDEV_NR; i++) { if ((subdev = nvkm_device_subdev(device, i))) { ret = nvkm_subdev_init(subdev); if (ret) goto fail_subdev; } } nvkm_acpi_init(device); time = ktime_to_us(ktime_get()) - time; nvdev_trace(device, "init completed in %lldus\n", time); return 0; fail_subdev: do { if ((subdev = nvkm_device_subdev(device, i))) nvkm_subdev_fini(subdev, false); } while (--i >= 0); fail: nvdev_error(device, "init failed with %d\n", ret); return ret; }
false
false
false
false
false
0
gtk_text_region_new (GtkTextBuffer *buffer) { GtkTextRegion *region; g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL); region = g_new (GtkTextRegion, 1); region->subregions = NULL; region->time_stamp = 0; region->buffer = buffer; g_object_add_weak_pointer (G_OBJECT (buffer), (gpointer *)&region->buffer); return region; }
false
false
false
false
false
0
ProcessGenericSpell(Unit *u,int spell, OrdersCheck *pCheck ) { CastOrder *orders = new CastOrder; orders->spell = spell; orders->level = 1; u->ClearCastOrders(); u->castorders = orders; }
false
false
false
false
false
0
__ecereNameSpace__ecere__gui__Desktop3DTitleBarClicked(struct __ecereNameSpace__ecere__com__Instance * clickedWindow, int x, int y) { struct __ecereNameSpace__ecere__sys__Size __simpleStruct3; struct __ecereNameSpace__ecere__sys__Size __simpleStruct2; struct __ecereNameSpace__ecere__sys__Point __simpleStruct1; struct __ecereNameSpace__ecere__sys__Point __simpleStruct0; struct __ecereNameSpace__ecere__com__Instance * windowAt = __ecereMethod___ecereNameSpace__ecere__gui__Window_GetAtPosition(clickedWindow, x, y, 0x1, 0x1, (((void *)0))); if(windowAt == clickedWindow) if(((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int, int, int, int))__ecereProp___ecereNameSpace__ecere__gui__GuiApplication_Get_currentSkin(__ecereNameSpace__ecere__gui__guiApp)->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Skin_IsMouseMoving])(clickedWindow, (__ecereProp___ecereNameSpace__ecere__gui__Window_Get_absPosition(clickedWindow, &__simpleStruct0), x - __simpleStruct0.x), (__ecereProp___ecereNameSpace__ecere__gui__Window_Get_absPosition(clickedWindow, &__simpleStruct1), y - __simpleStruct1.y), (int)(__ecereProp___ecereNameSpace__ecere__gui__Window_Get_size(clickedWindow, &__simpleStruct2), __simpleStruct2).w, (int)(__ecereProp___ecereNameSpace__ecere__gui__Window_Get_size(clickedWindow, &__simpleStruct3), __simpleStruct3).h)) { return 0x1; } return 0x0; }
false
false
false
false
false
0
libnet_host_lookup_r(u_long in, u_short use_name, u_char *hostname) { u_char *p; struct hostent *host_ent = NULL; struct in_addr addr; if (use_name == LIBNET_RESOLVE) { addr.s_addr = in; host_ent = gethostbyaddr((char *)&addr, sizeof(struct in_addr), AF_INET); } if (!host_ent) { p = (u_char *)&in; sprintf(hostname, "%d.%d.%d.%d", (p[0] & 255), (p[1] & 255), (p[2] & 255), (p[3] & 255)); } else { /* XXX - sizeof(hostname) == 4 bytes you moron. FIX THAT. - r */ strncpy(hostname, host_ent->h_name, sizeof(hostname)); } }
false
false
false
false
true
1
screen_monitor_pointer() { gint x, y; if (!screen_pointer_pos(&x, &y)) x = y = 0; return screen_find_monitor_point(x, y); }
false
false
false
false
false
0
write(hsStream* S, plResManager* mgr) { plBitmap::write(S, mgr); S->writeInt(fVisWidth); S->writeInt(fVisHeight); S->writeBool(fHasAlpha); S->writeInt(fInitBufferLen); if (fInitBuffer != NULL) S->writeInts(fInitBufferLen, (uint32_t*)fInitBuffer); }
false
false
false
false
false
0
f2fs_llseek(struct file *file, loff_t offset, int whence) { struct inode *inode = file->f_mapping->host; loff_t maxbytes = inode->i_sb->s_maxbytes; switch (whence) { case SEEK_SET: case SEEK_CUR: case SEEK_END: return generic_file_llseek_size(file, offset, whence, maxbytes, i_size_read(inode)); case SEEK_DATA: case SEEK_HOLE: if (offset < 0) return -ENXIO; return f2fs_seek_block(file, offset, whence); } return -EINVAL; }
false
false
false
false
false
0
DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front) { do { ASSERT(new_space_front <= new_space_.top()); // The addresses new_space_front and new_space_.top() define a // queue of unprocessed copied objects. Process them until the // queue is empty. while (new_space_front < new_space_.top()) { HeapObject* object = HeapObject::FromAddress(new_space_front); object->Iterate(scavenge_visitor); new_space_front += object->Size(); } // Promote and process all the to-be-promoted objects. while (!promotion_queue.is_empty()) { HeapObject* source; Map* map; promotion_queue.remove(&source, &map); // Copy the from-space object to its new location (given by the // forwarding address) and fix its map. HeapObject* target = source->map_word().ToForwardingAddress(); CopyBlock(reinterpret_cast<Object**>(target->address()), reinterpret_cast<Object**>(source->address()), source->SizeFromMap(map)); target->set_map(map); #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) // Update NewSpace stats if necessary. RecordCopiedObject(target); #endif // Visit the newly copied object for pointers to new space. target->Iterate(scavenge_visitor); UpdateRSet(target); } // Take another spin if there are now unswept objects in new space // (there are currently no more unswept promoted objects). } while (new_space_front < new_space_.top()); return new_space_front; }
false
false
false
false
false
0
Print(const char *label, const char *varName, Prt_TYPE fmt, ...) { static char *buffer = NULL; /* Copy of message generated so far. */ va_list ap; /* pointer to variable argument list. */ sInt4 lival; /* Store a sInt4 val from argument list. */ char *sval; /* Store a string val from argument. */ char *unit; /* Second string val is usually a unit string. */ double dval; /* Store a double val from argument list. */ char *ans; /* Final message to return if fmt = Prt_NULL. */ if (fmt == Prt_NULL) { ans = buffer; buffer = NULL; return ans; } va_start (ap, fmt); /* make ap point to 1st unnamed arg. */ switch (fmt) { case Prt_D: lival = va_arg (ap, sInt4); reallocSprintf (&buffer, "%s | %s | %ld\n", label, varName, lival); break; case Prt_DS: lival = va_arg (ap, sInt4); sval = va_arg (ap, char *); reallocSprintf (&buffer, "%s | %s | %ld (%s)\n", label, varName, lival, sval); break; case Prt_DSS: lival = va_arg (ap, sInt4); sval = va_arg (ap, char *); unit = va_arg (ap, char *); reallocSprintf (&buffer, "%s | %s | %ld (%s [%s])\n", label, varName, lival, sval, unit); break; case Prt_S: sval = va_arg (ap, char *); reallocSprintf (&buffer, "%s | %s | %s\n", label, varName, sval); break; case Prt_SS: sval = va_arg (ap, char *); unit = va_arg (ap, char *); reallocSprintf (&buffer, "%s | %s | %s (%s)\n", label, varName, sval, unit); break; case Prt_F: dval = va_arg (ap, double); reallocSprintf (&buffer, "%s | %s | %f\n", label, varName, dval); break; case Prt_E: dval = va_arg (ap, double); reallocSprintf (&buffer, "%s | %s | %e\n", label, varName, dval); break; case Prt_G: dval = va_arg (ap, double); reallocSprintf (&buffer, "%s | %s | %g\n", label, varName, dval); break; case Prt_FS: dval = va_arg (ap, double); unit = va_arg (ap, char *); reallocSprintf (&buffer, "%s | %s | %f (%s)\n", label, varName, dval, unit); break; case Prt_ES: dval = va_arg (ap, double); unit = va_arg (ap, char *); reallocSprintf (&buffer, "%s | %s | %e (%s)\n", label, varName, dval, unit); break; case Prt_GS: dval = va_arg (ap, double); unit = va_arg (ap, char *); reallocSprintf (&buffer, "%s | %s | %g (%s)\n", label, varName, dval, unit); break; default: reallocSprintf (&buffer, "ERROR: Invalid Print option '%d'\n", fmt); } va_end (ap); /* clean up when done. */ return NULL; }
false
false
false
false
false
0
debrief_init_music() { int score = SCORE_DEBRIEF_AVERAGE; Debrief_music_timeout = 0; if ( (Game_mode & GM_CAMPAIGN_MODE) && (Campaign.next_mission == Campaign.current_mission) ) { // you failed the mission, so you get the fail music score = SCORE_DEBRIEF_FAIL; } else if ( mission_goals_met() ) { // you completed all primaries and secondaries, so you get the win music score = SCORE_DEBRIEF_SUCCESS; } else { // you somehow passed the mission, so you get a little something for your efforts. score = SCORE_DEBRIEF_AVERAGE; } // if multi client then give a slight delay before playing average music // since we'd like to eval the goals once more for slow clients if ( MULTIPLAYER_CLIENT && (score == SCORE_DEBRIEF_AVERAGE) ) { Debrief_music_timeout = timestamp(2000); return; } common_music_init(score); }
false
false
false
false
false
0
fromRGB565(PyObject *self, PyObject *args){ guchar* rgbdata; gint width, height; gint swap_bytes; // = TRUE; gint rotate; // = FALSE; gchar* savefilename; // = "gpixpod_imgconvert_test.png"; gint rgbdatalen; if(!PyArg_ParseTuple(args, "s#iiiis", &rgbdata, &rgbdatalen, &width, &height, &swap_bytes, &rotate, &savefilename)){ printf("Argh! Failed to parse tuple!\n"); exit(1); } fromRGB565C(rgbdata, width, height, swap_bytes, rotate, savefilename); Py_INCREF(Py_None); return Py_None; }
false
false
false
false
false
0
createTipLabel(const QString& text, QWidget* parent) { PsiTipLabel* label = new PsiTipLabel(parent); label->init(text); return label; }
false
false
false
false
false
0
parse_emacs_modeline (gchar *s, ModelineOptions *options) { guint intval; GString *key, *value; key = g_string_sized_new (8); value = g_string_sized_new (8); while (*s != '\0') { while (*s != '\0' && (*s == ';' || g_ascii_isspace (*s))) s++; if (*s == '\0' || strncmp (s, "-*-", 3) == 0) break; g_string_assign (key, ""); g_string_assign (value, ""); while (*s != '\0' && *s != ':' && *s != ';' && !g_ascii_isspace (*s)) { g_string_append_c (key, *s); s++; } if (!skip_whitespaces (&s)) break; if (*s != ':') continue; s++; if (!skip_whitespaces (&s)) break; while (*s != '\0' && *s != ';' && !g_ascii_isspace (*s)) { g_string_append_c (value, *s); s++; } gedit_debug_message (DEBUG_PLUGINS, "Emacs modeline bit: %s = %s", key->str, value->str); /* "Mode" key is case insenstive */ if (g_ascii_strcasecmp (key->str, "Mode") == 0) { g_free (options->language_id); options->language_id = get_language_id_emacs (value->str); options->set |= MODELINE_SET_LANGUAGE; } else if (strcmp (key->str, "tab-width") == 0) { intval = atoi (value->str); if (intval) { options->tab_width = intval; options->set |= MODELINE_SET_TAB_WIDTH; } } else if (strcmp (key->str, "indent-offset") == 0) { intval = atoi (value->str); if (intval) { options->indent_width = intval; options->set |= MODELINE_SET_INDENT_WIDTH; } } else if (strcmp (key->str, "indent-tabs-mode") == 0) { intval = strcmp (value->str, "nil") == 0; options->insert_spaces = intval; options->set |= MODELINE_SET_INSERT_SPACES; } else if (strcmp (key->str, "autowrap") == 0) { intval = strcmp (value->str, "nil") != 0; options->wrap_mode = intval ? GTK_WRAP_WORD : GTK_WRAP_NONE; options->set |= MODELINE_SET_WRAP_MODE; } } g_string_free (key, TRUE); g_string_free (value, TRUE); return *s == '\0' ? s : s + 2; }
false
false
false
false
false
0
ooH323EpPrintConfig(void) { OOTRACEINFO1("H.323 Endpoint Configuration is as follows:\n"); OOTRACEINFO2("\tTrace File: %s\n", gH323ep.traceFile); if(!OO_TESTFLAG(gH323ep.flags, OO_M_FASTSTART)) { OOTRACEINFO1("\tFastStart - disabled\n"); } else{ OOTRACEINFO1("\tFastStart - enabled\n"); } if(!OO_TESTFLAG(gH323ep.flags, OO_M_TUNNELING)) { OOTRACEINFO1("\tH245 Tunneling - disabled\n"); } else{ OOTRACEINFO1("\tH245 Tunneling - enabled\n"); } if(!OO_TESTFLAG(gH323ep.flags, OO_M_MEDIAWAITFORCONN)) { OOTRACEINFO1("\tMediaWaitForConnect - disabled\n"); } else{ OOTRACEINFO1("\tMediaWaitForConnect - enabled\n"); } if(OO_TESTFLAG(gH323ep.flags, OO_M_AUTOANSWER)) OOTRACEINFO1("\tAutoAnswer - enabled\n"); else OOTRACEINFO1("\tAutoAnswer - disabled\n"); OOTRACEINFO2("\tTerminal Type - %d\n", gH323ep.termType); OOTRACEINFO2("\tT35 CountryCode - %d\n", gH323ep.t35CountryCode); OOTRACEINFO2("\tT35 Extension - %d\n", gH323ep.t35Extension); OOTRACEINFO2("\tManufacturer Code - %d\n", gH323ep.manufacturerCode); OOTRACEINFO2("\tProductID - %s\n", gH323ep.productID); OOTRACEINFO2("\tVersionID - %s\n", gH323ep.versionID); OOTRACEINFO2("\tLocal signalling IP address - %s\n", gH323ep.signallingIP); OOTRACEINFO2("\tH225 ListenPort - %d\n", gH323ep.listenPort); OOTRACEINFO2("\tCallerID - %s\n", gH323ep.callerid); OOTRACEINFO2("\tCall Establishment Timeout - %d seconds\n", gH323ep.callEstablishmentTimeout); OOTRACEINFO2("\tMasterSlaveDetermination Timeout - %d seconds\n", gH323ep.msdTimeout); OOTRACEINFO2("\tTerminalCapabilityExchange Timeout - %d seconds\n", gH323ep.tcsTimeout); OOTRACEINFO2("\tLogicalChannel Timeout - %d seconds\n", gH323ep.logicalChannelTimeout); OOTRACEINFO2("\tSession Timeout - %d seconds\n", gH323ep.sessionTimeout); return; }
false
false
false
false
false
0
CopyElement(const List * l, size_t position, void *outBuffer) { ListElement *rvp; if (l == NULL || outBuffer == NULL) { if (l) l->RaiseError("iList.CopyElement", CONTAINER_ERROR_BADARG); else NullPtrError("CopyElement"); return CONTAINER_ERROR_BADARG; } if (position >= l->count) { l->RaiseError("iList.CopyElement", CONTAINER_ERROR_INDEX,l,position); return CONTAINER_ERROR_INDEX; } rvp = l->First; while (position) { rvp = rvp->Next; position--; } memcpy(outBuffer, rvp->Data, l->ElementSize); return 1; }
false
false
false
false
false
0
mq_delete_contribution_node (dict_t *dict, char *key, inode_contribution_t *contribution) { if (dict_get (dict, key) != NULL) goto out; QUOTA_FREE_CONTRIBUTION_NODE (contribution); out: return 0; }
false
false
false
false
false
0
host_aliases_dialog_prepare (OobsStaticHost *host) { GtkWidget *address, *aliases; GtkTextBuffer *buffer; GList *alias_list; gchar *alias_str; address = gst_dialog_get_widget (tool->main_dialog, "host_alias_address"); aliases = gst_dialog_get_widget (tool->main_dialog, "host_alias_list"); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (aliases)); if (host) { gtk_entry_set_text (GTK_ENTRY (address), oobs_static_host_get_ip_address (host)); alias_list = oobs_static_host_get_aliases (host); alias_str = concatenate_aliases (alias_list, "\n"); g_list_free (alias_list); gtk_text_buffer_set_text (buffer, alias_str, -1); g_free (alias_str); } else { gtk_entry_set_text (GTK_ENTRY (address), ""); gtk_text_buffer_set_text (buffer, "", -1); } host_aliases_check_fields (); }
false
false
false
false
false
0
addAppender(Logger& logger, log4cplus::SharedAppenderPtr& appender) { for(LoggerListIterator it=loggerList.begin(); it!=loggerList.end(); ++it) { if((*it).value == logger.value) { LOG4CPLUS_MUTEX_UNLOCK( logger.value->appender_list_mutex ); logger.addAppender(appender); LOG4CPLUS_MUTEX_LOCK( logger.value->appender_list_mutex ); return; } } // I don't have this Logger locked logger.addAppender(appender); }
false
false
false
false
false
0
AbsoluteToPercentage(double value) { double convertedVal = 0; // convert from absolute to percent if (_hundred_percent == 0) { if (_percentage_is_increment) convertedVal = 0; else convertedVal = 100; } else { double hundred_converted = _hundred_percent / _unit_menu->getConversion("px", lastUnits); // _hundred_percent is in px if (_absolute_is_increment) value += hundred_converted; convertedVal = 100 * value / hundred_converted; if (_percentage_is_increment) convertedVal -= 100; } return convertedVal; }
false
false
false
false
false
0
get_messages(struct chat_history_data* data, size_t num, struct cbuffer* outbuf) { struct linked_list* messages = data->chat_history; char* message; int skiplines = 0; size_t lines = 0; size_t total = list_size(messages); if (total == 0) return 0; if (num <= 0 || num > total) num = total; if (num != total) skiplines = total - num; cbuf_append(outbuf, "\n"); LIST_FOREACH(char*, message, messages, { if (--skiplines < 0) { cbuf_append(outbuf, message); lines++; } }); cbuf_append(outbuf, "\n"); return lines; }
false
false
false
false
false
0
aarch64_strip_shift (rtx x) { rtx op = x; if ((GET_CODE (op) == ASHIFT || GET_CODE (op) == ASHIFTRT || GET_CODE (op) == LSHIFTRT) && CONST_INT_P (XEXP (op, 1))) return XEXP (op, 0); if (GET_CODE (op) == MULT && CONST_INT_P (XEXP (op, 1)) && ((unsigned) exact_log2 (INTVAL (XEXP (op, 1)))) < 64) return XEXP (op, 0); return x; }
false
false
false
false
false
0
process_next_chunk(struct web_session *session) { GString *buf = session->send_buffer; const guint8 *body; gsize length; if (session->input_func == NULL) { session->more_data = FALSE; return; } session->more_data = session->input_func(&body, &length, session->user_data); if (length > 0) { g_string_append_printf(buf, "%zx\r\n", length); g_string_append_len(buf, (char *) body, length); g_string_append(buf, "\r\n"); } if (session->more_data == FALSE) g_string_append(buf, "0\r\n\r\n"); }
false
false
false
false
false
0
readblock( int port, unsigned short len) { int retval,i; memset( frage, 0x00, sizeof(frage)); if(tcgetattr(port,&tios)==-1)err(1,NULL); tios.c_cc[VMIN]=len; if(tcsetattr(port,TCSANOW,&tios)==-1)err(1,NULL); retval=read(port,frage,len); if (retval < 0)return retval; #ifdef DEBUG /* fprintf(stdout,"retval=%d\n",retval); */ for(i=0;i<retval;i++){ fprintf(stdout," %02x",frage[i]); } fprintf(stdout,"\n"); #endif return(retval); }
false
false
false
false
false
0
pdfextract_main(int argc, char **argv) { char *infile; char *password = ""; int c, o; while ((c = fz_getopt(argc, argv, "p:r")) != -1) { switch (c) { case 'p': password = fz_optarg; break; case 'r': dorgb++; break; default: usage(); break; } } if (fz_optind == argc) usage(); infile = argv[fz_optind++]; ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED); if (!ctx) { fprintf(stderr, "cannot initialise context\n"); exit(1); } doc = pdf_open_document_no_run(ctx, infile); if (pdf_needs_password(doc)) if (!pdf_authenticate_password(doc, password)) fz_throw(ctx, "cannot authenticate password: %s", infile); if (fz_optind == argc) { int len = pdf_count_objects(doc); for (o = 0; o < len; o++) showobject(o); } else { while (fz_optind < argc) { showobject(atoi(argv[fz_optind])); fz_optind++; } } pdf_close_document(doc); fz_flush_warnings(ctx); fz_free_context(ctx); return 0; }
false
false
false
false
true
1
gw_menu_file_exit_save_file_ok ( GtkWidget *bt, GtkWindow *dg) { GWDBCatalog *catalog = NULL; gboolean result = FALSE; #ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif gtk_widget_destroy ( GTK_WIDGET ( dg)); /* Checks if it's a new catalog (in this case his full name is "./[catalog_full_name]"). */ if ( gw_helper_db_catalog_is_new ( catalog)) { // if ( gw_db_catalog_get_db_name ( catalog)==NULL || strlen ( gw_db_catalog_get_db_name ( catalog))==0 ) { /* If it's a new catalog, asks a file name. */ // gw_file_selection_box_create ( _( "Save as catalog"), gw_db_catalog_get_name ( catalog), (GtkSignalFunc)gw_menu_file_exit_saveas_file_selection_ok, NULL); gw_file_selection_box_create ( _( "Save as catalog"), gw_helper_db_catalog_get_usefull_name ( catalog), (GtkSignalFunc)gw_menu_file_exit_saveas_file_selection_ok, NULL); } else { /* Else save the catalog directly and exit program. */ gw_menu_file_save_click ( NULL, NULL); gw_menu_file_exit ( ); } result = TRUE; return result; }
false
false
false
false
false
0
binder_vma_open(struct vm_area_struct *vma) { struct binder_proc *proc = vma->vm_private_data; binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%d open vm area %lx-%lx (%ld K) vma %lx pagep %lx\n", proc->pid, vma->vm_start, vma->vm_end, (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, (unsigned long)pgprot_val(vma->vm_page_prot)); }
false
false
false
false
false
0
cb_index_styles (GnmStyle *style, IndexerState *state) { if (gnm_style_is_element_set (style, MSTYLE_HLINK)) { GnmHLink const *lnk = gnm_style_get_hlink (style); if (lnk != NULL) ssindex_hlink (state, lnk); } if (gnm_style_is_element_set (style, MSTYLE_VALIDATION)) { GnmValidation const *valid = gnm_style_get_validation (style); if (valid) ssindex_validation (state, valid); } /* Input Msg? */ }
false
false
false
false
false
0
PyNumber_ToBase(PyObject *n, int base) { PyObject *res = NULL; PyObject *index = PyNumber_Index(n); if (!index) return NULL; if (PyLong_Check(index)) res = _PyLong_Format(index, base, 0, 1); else if (PyInt_Check(index)) res = _PyInt_Format((PyIntObject*)index, base, 1); else /* It should not be possible to get here, as PyNumber_Index already has a check for the same condition */ PyErr_SetString(PyExc_ValueError, "PyNumber_ToBase: index not " "int or long"); Py_DECREF(index); return res; }
false
false
false
false
false
0
clean_up (void) { GdkWindow *root; GdkDeviceManager *dev_manager; GdkDevice *device; GList *devices, *l; root = gdk_get_default_root_window (); dev_manager = gdk_display_get_device_manager (gdk_display_get_default ()); gdk_window_remove_filter (root, (GdkFilterFunc) target_filter, NULL); device = gdk_device_manager_get_client_pointer (dev_manager); gdk_device_ungrab (device, GDK_CURRENT_TIME); devices = gdk_device_manager_list_devices (dev_manager, GDK_DEVICE_TYPE_MASTER); for (l = devices; l; l = l->next) { device = GDK_DEVICE (l->data); if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD) continue; gdk_device_ungrab (device, GDK_CURRENT_TIME); } g_list_free (devices); gtk_main_quit (); }
false
false
false
false
false
0
get_atomic_generic_size (location_t loc, tree function, VEC(tree,gc) *params) { unsigned int n_param; unsigned int n_model; unsigned int x; int size_0; tree type_0; /* Determine the parameter makeup. */ switch (DECL_FUNCTION_CODE (function)) { case BUILT_IN_ATOMIC_EXCHANGE: n_param = 4; n_model = 1; break; case BUILT_IN_ATOMIC_LOAD: case BUILT_IN_ATOMIC_STORE: n_param = 3; n_model = 1; break; case BUILT_IN_ATOMIC_COMPARE_EXCHANGE: n_param = 6; n_model = 2; break; default: gcc_unreachable (); } if (VEC_length (tree, params) != n_param) { error_at (loc, "incorrect number of arguments to function %qE", function); return 0; } /* Get type of first parameter, and determine its size. */ type_0 = TREE_TYPE (VEC_index (tree, params, 0)); if (TREE_CODE (type_0) != POINTER_TYPE || VOID_TYPE_P (TREE_TYPE (type_0))) { error_at (loc, "argument 1 of %qE must be a non-void pointer type", function); return 0; } /* Types must be compile time constant sizes. */ if (TREE_CODE ((TYPE_SIZE_UNIT (TREE_TYPE (type_0)))) != INTEGER_CST) { error_at (loc, "argument 1 of %qE must be a pointer to a constant size type", function); return 0; } size_0 = tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type_0)), 1); /* Zero size objects are not allowed. */ if (size_0 == 0) { error_at (loc, "argument 1 of %qE must be a pointer to a nonzero size object", function); return 0; } /* Check each other parameter is a pointer and the same size. */ for (x = 0; x < n_param - n_model; x++) { int size; tree type = TREE_TYPE (VEC_index (tree, params, x)); /* __atomic_compare_exchange has a bool in the 4th postion, skip it. */ if (n_param == 6 && x == 3) continue; if (!POINTER_TYPE_P (type)) { error_at (loc, "argument %d of %qE must be a pointer type", x + 1, function); return 0; } size = tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type)), 1); if (size != size_0) { error_at (loc, "size mismatch in argument %d of %qE", x + 1, function); return 0; } } /* Check memory model parameters for validity. */ for (x = n_param - n_model ; x < n_param; x++) { tree p = VEC_index (tree, params, x); if (TREE_CODE (p) == INTEGER_CST) { int i = tree_low_cst (p, 1); if (i < 0 || i >= MEMMODEL_LAST) { warning_at (loc, OPT_Winvalid_memory_model, "invalid memory model argument %d of %qE", x + 1, function); } } else if (!INTEGRAL_TYPE_P (TREE_TYPE (p))) { error_at (loc, "non-integer memory model argument %d of %qE", x + 1, function); return 0; } } return size_0; }
false
false
false
false
false
0
btrfs_free_block_groups(struct btrfs_fs_info *info) { struct btrfs_block_group_cache *block_group; struct btrfs_space_info *space_info; struct btrfs_caching_control *caching_ctl; struct rb_node *n; down_write(&info->commit_root_sem); while (!list_empty(&info->caching_block_groups)) { caching_ctl = list_entry(info->caching_block_groups.next, struct btrfs_caching_control, list); list_del(&caching_ctl->list); put_caching_control(caching_ctl); } up_write(&info->commit_root_sem); spin_lock(&info->unused_bgs_lock); while (!list_empty(&info->unused_bgs)) { block_group = list_first_entry(&info->unused_bgs, struct btrfs_block_group_cache, bg_list); list_del_init(&block_group->bg_list); btrfs_put_block_group(block_group); } spin_unlock(&info->unused_bgs_lock); spin_lock(&info->block_group_cache_lock); while ((n = rb_last(&info->block_group_cache_tree)) != NULL) { block_group = rb_entry(n, struct btrfs_block_group_cache, cache_node); rb_erase(&block_group->cache_node, &info->block_group_cache_tree); RB_CLEAR_NODE(&block_group->cache_node); spin_unlock(&info->block_group_cache_lock); down_write(&block_group->space_info->groups_sem); list_del(&block_group->list); up_write(&block_group->space_info->groups_sem); if (block_group->cached == BTRFS_CACHE_STARTED) wait_block_group_cache_done(block_group); /* * We haven't cached this block group, which means we could * possibly have excluded extents on this block group. */ if (block_group->cached == BTRFS_CACHE_NO || block_group->cached == BTRFS_CACHE_ERROR) free_excluded_extents(info->extent_root, block_group); btrfs_remove_free_space_cache(block_group); btrfs_put_block_group(block_group); spin_lock(&info->block_group_cache_lock); } spin_unlock(&info->block_group_cache_lock); /* now that all the block groups are freed, go through and * free all the space_info structs. This is only called during * the final stages of unmount, and so we know nobody is * using them. We call synchronize_rcu() once before we start, * just to be on the safe side. */ synchronize_rcu(); release_global_block_rsv(info); while (!list_empty(&info->space_info)) { int i; space_info = list_entry(info->space_info.next, struct btrfs_space_info, list); if (btrfs_test_opt(info->tree_root, ENOSPC_DEBUG)) { if (WARN_ON(space_info->bytes_pinned > 0 || space_info->bytes_reserved > 0 || space_info->bytes_may_use > 0)) { dump_space_info(space_info, 0, 0); } } list_del(&space_info->list); for (i = 0; i < BTRFS_NR_RAID_TYPES; i++) { struct kobject *kobj; kobj = space_info->block_group_kobjs[i]; space_info->block_group_kobjs[i] = NULL; if (kobj) { kobject_del(kobj); kobject_put(kobj); } } kobject_del(&space_info->kobj); kobject_put(&space_info->kobj); } return 0; }
false
false
false
false
false
0
get_frame( hnd_t handle, cli_pic_t *output, int frame ) { depth_hnd_t *h = handle; if( h->prev_filter.get_frame( h->prev_hnd, output, frame ) ) return -1; if( h->bit_depth < 16 && output->img.csp & X264_CSP_HIGH_DEPTH ) { dither_image( &h->buffer.img, &output->img, h->error_buf ); output->img = h->buffer.img; } else if( h->bit_depth > 8 && !(output->img.csp & X264_CSP_HIGH_DEPTH) ) { scale_image( &h->buffer.img, &output->img ); output->img = h->buffer.img; } return 0; }
false
false
false
false
false
0
Timestamp2Unix(const Glib::ustring &stamp, time_t &result) { struct tm split; bool utc; if( !Barry::Sync::iso_to_tm(stamp.c_str(), &split, utc) ) return false; split.tm_isdst = -1; if( utc ) result = Barry::Sync::utc_mktime(&split); else result = mktime(&split); return result != (time_t)-1; }
false
false
false
false
false
0
find_ticket (context, cc, client, server, found) krb5_context context; krb5_ccache cc; krb5_principal client; krb5_principal server; krb5_boolean *found; { krb5_creds tgt, tgtq; krb5_error_code retval; *found = FALSE; memset(&tgtq, 0, sizeof(tgtq)); memset(&tgt, 0, sizeof(tgt)); retval= krb5_copy_principal(context, client, &tgtq.client); if (retval) return retval; retval= krb5_copy_principal(context, server, &tgtq.server); if (retval) return retval ; retval = krb5_cc_retrieve_cred(context, cc, KRB5_TC_MATCH_SRV_NAMEONLY | KRB5_TC_SUPPORTED_KTYPES, &tgtq, &tgt); if (! retval) retval = krb5_check_exp(context, tgt.times); if (retval){ if ((retval != KRB5_CC_NOTFOUND) && (retval != KRB5KRB_AP_ERR_TKT_EXPIRED)){ return retval ; } } else{ *found = TRUE; return 0; } free(tgtq.server); free(tgtq.client); return 0; }
false
false
false
false
false
0
array_free_wipe(array *a) { size_t bytes = a->allocated; if (bytes) memset(a->mem, 0, bytes); array_free(a); }
false
false
false
false
false
0
snmplite_ups_get_capabilities(UPSINFO *ups) { struct snmplite_ups_internal_data *sid = (struct snmplite_ups_internal_data *)ups->driver_internal_data; write_lock(ups); // Walk the OID map, issuing an SNMP query for each item, one at a time. // If the query succeeds, sanity check the returned value and set the // capabilities flag. CiOidMap *mib = sid->strategy->mib; for (unsigned int i = 0; mib[i].ci != -1; i++) { Snmp::Variable data; data.type = mib[i].type; if (sid->snmp->Get(mib[i].oid, &data)) { ups->UPS_Cap[mib[i].ci] = snmplite_ups_check_ci(mib[i].ci, data); } } write_unlock(ups); // Succeed if we found CI_STATUS return ups->UPS_Cap[CI_STATUS]; }
false
false
false
false
false
0
UndefconstructCommand( void *theEnv, char *command, struct construct *constructClass) { char *constructName; char buffer[80]; /*==============================================*/ /* Get the name of the construct to be deleted. */ /*==============================================*/ sprintf(buffer,"%s name",constructClass->constructName); constructName = GetConstructName(theEnv,command,buffer); if (constructName == NULL) return; #if (! RUN_TIME) && (! BLOAD_ONLY) /*=============================================*/ /* Check to see if the named construct exists. */ /*=============================================*/ if (((*constructClass->findFunction)(theEnv,constructName) == NULL) && (strcmp("*",constructName) != 0)) { CantFindItemErrorMessage(theEnv,constructClass->constructName,constructName); return; } /*===============================================*/ /* If the construct does exist, try deleting it. */ /*===============================================*/ else if (DeleteNamedConstruct(theEnv,constructName,constructClass) == FALSE) { CantDeleteItemErrorMessage(theEnv,constructClass->constructName,constructName); return; } return; #else /*=====================================*/ /* Constructs can't be deleted in a */ /* run-time or bload only environment. */ /*=====================================*/ CantDeleteItemErrorMessage(theEnv,constructClass->constructName,constructName); return; #endif }
true
true
true
false
false
1
eprimer32_send_range_pair(FILE * stream, const char * tag, const AjPRange avalue, const AjPRange bvalue, ajint begin) { AjPStr str; ajuint n = 0; ajuint start; ajuint end; ajuint asize; ajuint bsize; asize = ajRangeGetSize(avalue); bsize = ajRangeGetSize(bvalue); if(asize || bsize) { str = ajStrNew(); ajFmtPrintS(&str, "%s=", tag); for(n=0; n < asize; n++) { if(n) ajFmtPrintAppS(&str,";"); ajRangeElementGetValues(avalue, n, &start, &end); start -= begin; end -= begin; ajFmtPrintAppS(&str, "%u,%u", start, end-start+1); if(n < bsize) { ajRangeElementGetValues(bvalue, n, &start, &end); start -= begin; end -= begin; ajFmtPrintAppS(&str, ",%u,%u", start, end-start+1); } else { ajFmtPrintAppS(&str, ",,"); } } for(n=asize; n < bsize; n++) { if(n) ajFmtPrintAppS(&str,";"); ajFmtPrintAppS(&str, ",,"); ajRangeElementGetValues(bvalue, n, &start, &end); start -= begin; end -= begin; ajFmtPrintAppS(&str, ",%u,%u", start, end-start+1); } if(ajStrGetLen(str)) { ajFmtPrintAppS(&str, "\n"); eprimer32_write(str, stream); } ajStrDel(&str); } return; }
false
false
false
false
false
0
glusterd_friend_add (const char *hoststr, int port, glusterd_friend_sm_state_t state, uuid_t *uuid, glusterd_peerinfo_t **friend, gf_boolean_t restore, glusterd_peerctx_args_t *args) { int ret = 0; xlator_t *this = NULL; glusterd_conf_t *conf = NULL; glusterd_peerctx_t *peerctx = NULL; dict_t *options = NULL; gf_boolean_t handover = _gf_false; this = THIS; conf = this->private; GF_ASSERT (conf); GF_ASSERT (hoststr); peerctx = GF_CALLOC (1, sizeof (*peerctx), gf_gld_mt_peerctx_t); if (!peerctx) { ret = -1; goto out; } if (args) peerctx->args = *args; ret = glusterd_peerinfo_new (friend, state, uuid, hoststr); if (ret) goto out; peerctx->peerinfo = *friend; ret = glusterd_transport_inet_keepalive_options_build (&options, hoststr, port); if (ret) goto out; if (!restore) { ret = glusterd_store_peerinfo (*friend); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Failed to store " "peerinfo"); goto out; } } list_add_tail (&(*friend)->uuid_list, &conf->peers); ret = glusterd_rpc_create (&(*friend)->rpc, options, glusterd_peer_rpc_notify, peerctx); if (ret) { gf_log (this->name, GF_LOG_ERROR, "failed to create rpc for" " peer %s", (char*)hoststr); goto out; } handover = _gf_true; out: if (ret && !handover) { (void) glusterd_friend_cleanup (*friend); *friend = NULL; } gf_log (this->name, GF_LOG_INFO, "connect returned %d", ret); return ret; }
false
false
false
false
false
0
Clamp8b(int val) { const int min_val = 0; const int max_val = 0xff; return (val < min_val) ? min_val : (val > max_val) ? max_val : val; }
false
false
false
false
false
0
set_listen_port (unsigned port) { listen_iface.protocol = "tcp"; listen_iface.voip_protocol = "h323"; listen_iface.id = "*"; if (port > 0) { std::stringstream str; RemoveListener (NULL); str << "tcp$*:" << port; if (StartListeners (PStringArray (str.str ()))) { listen_iface.port = port; return true; } } return false; }
false
false
false
false
false
0
tree_lower_complex (void) { int old_last_basic_block; gimple_stmt_iterator gsi; basic_block bb; if (!init_dont_simulate_again ()) return 0; complex_lattice_values = VEC_alloc (complex_lattice_t, heap, num_ssa_names); VEC_safe_grow_cleared (complex_lattice_t, heap, complex_lattice_values, num_ssa_names); init_parameter_lattice_values (); ssa_propagate (complex_visit_stmt, complex_visit_phi); complex_variable_components = htab_create (10, int_tree_map_hash, int_tree_map_eq, free); complex_ssa_name_components = VEC_alloc (tree, heap, 2*num_ssa_names); VEC_safe_grow_cleared (tree, heap, complex_ssa_name_components, 2 * num_ssa_names); update_parameter_components (); /* ??? Ideally we'd traverse the blocks in breadth-first order. */ old_last_basic_block = last_basic_block; FOR_EACH_BB (bb) { if (bb->index >= old_last_basic_block) continue; update_phi_components (bb); for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) expand_complex_operations_1 (&gsi); } gsi_commit_edge_inserts (); htab_delete (complex_variable_components); VEC_free (tree, heap, complex_ssa_name_components); VEC_free (complex_lattice_t, heap, complex_lattice_values); return 0; }
false
false
false
false
false
0
putChar(ByteOutStream & os, StdVnChar stdChar, int & outLen) { outLen = sizeof(UnicodeChar); return os.putW((stdChar >= VnStdCharOffset)? m_toUnicode[stdChar-VnStdCharOffset] : (UnicodeChar)stdChar); }
false
false
false
false
false
0