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
load_city_name_list(struct section_file *file, struct nation_type *pnation, const char *secfile_str1, const char *secfile_str2) { size_t dim, j; const char **cities = secfile_lookup_str_vec(file, &dim, "%s.%s", secfile_str1, secfile_str2); /* Each string will be of the form "<cityname> (<label>, <label>, ...)". * The cityname is just the name for this city, while each "label" matches * a terrain type for the city (or "river"), with a preceeding ! to negate * it. The parentheses are optional (but necessary to have the settings, * of course). Our job is now to parse it. */ for (j = 0; j < dim; j++) { size_t len = strlen(cities[j]); char city_name[len + 1], *p, *next, *end; struct nation_city *pncity; sz_strlcpy(city_name, cities[j]); /* Now we wish to determine values for all of the city labels. A value * of NCP_NONE means no preference (which is necessary so that the use * of this is optional); NCP_DISLIKE means the label is negated and * NCP_LIKE means it's labelled. Mostly the parsing just involves * a lot of ugly string handling... */ if ((p = strchr(city_name, '('))) { *p++ = '\0'; if (!(end = strchr(p, ')'))) { ruleset_error(LOG_ERROR, "\"%s\" [%s] %s: city name \"%s\" " "unmatched parenthesis.", secfile_name(file), secfile_str1, secfile_str2, cities[j]); } for (*end++ = '\0'; '\0' != *end; end++) { if (!fc_isspace(*end)) { ruleset_error(LOG_ERROR, "\"%s\" [%s] %s: city name \"%s\" " "contains characthers after last parenthesis, " "ignoring...", secfile_name(file), secfile_str1, secfile_str2, cities[j]); } } } /* Build the nation_city. */ remove_leading_trailing_spaces(city_name); if (check_name(city_name)) { /* The ruleset contains a name that is too long. This shouldn't * happen - if it does, the author should get immediate feedback. */ ruleset_error(LOG_ERROR, "\"%s\" [%s] %s: city name \"%s\" " "is too long; shortening it.", secfile_name(file), secfile_str1, secfile_str2, city_name); city_name[MAX_LEN_NAME - 1] = '\0'; } pncity = nation_city_new(pnation, city_name); if (NULL != p) { /* Handle the labels one at a time. */ do { enum nation_city_preference prefer; if ((next = strchr(p, ','))) { *next = '\0'; } remove_leading_trailing_spaces(p); /* The ! is used to mark a negative, which is recorded with * NCP_DISLIKE. Otherwise we use a NCP_LIKE. */ if (*p == '!') { p++; prefer = NCP_DISLIKE; } else { prefer = NCP_LIKE; } if (0 == fc_strcasecmp(p, "river")) { nation_city_set_river_preference(pncity, prefer); } else { const struct terrain *pterrain = terrain_by_rule_name(p); if (NULL == pterrain) { /* Try with removing frequent trailing 's'. */ size_t l = strlen(p); if (0 < l && 's' == fc_tolower(p[l - 1])) { p[l - 1] = '\0'; } pterrain = terrain_by_rule_name(p); } if (NULL != pterrain) { nation_city_set_terrain_preference(pncity, pterrain, prefer); } else { /* Nation authors may use terrains like "lake" that are * available in the default ruleset but not in civ1/civ2. * In normal use we should just ignore hints for unknown * terrains, but nation authors may want to know about this * to spot typos etc. */ log_verbose("\"%s\" [%s] %s: terrain \"%s\" not found;" " skipping it.", secfile_name(file), secfile_str1, secfile_str2, p); } } p = next ? next + 1 : NULL; } while (NULL != p && '\0' != *p); } } if (NULL != cities) { free(cities); } }
true
true
false
false
false
1
clear() { if (reg) XDestroyRegion(reg); for (unsigned i = 0; i < 256; ++i) if (GCs[i]) XFreeGC(display, GCs[i]); }
false
false
false
false
false
0
DecodePosition(void){ USHORT i, j, c; i = GETBITS(8); DROPBITS(8); c = (USHORT) (d_code[i] << 8); j = d_len[i]; i = (USHORT) (((i << j) | GETBITS(j)) & 0xff); DROPBITS(j); return (USHORT) (c | i) ; }
false
false
false
false
false
0
read_blk(struct quota_handle *h, unsigned int blk, dqbuf_t buf) { int err; err = h->e2fs_read(&h->qh_qf, blk << QT_BLKSIZE_BITS, buf, QT_BLKSIZE); if (err < 0) log_err("Cannot read block %u: %s", blk, strerror(errno)); else if (err != QT_BLKSIZE) memset(buf + err, 0, QT_BLKSIZE - err); }
false
false
false
false
false
0
cfapi_object_pay_item(int *type, ...) { object *op; object *tobuy; int *rint; va_list args; va_start(args, type); tobuy = va_arg(args, object *); op = va_arg(args, object *); rint = va_arg(args, int *); va_end(args); *rint = pay_for_item(tobuy, op); *type = CFAPI_INT; }
false
false
false
false
false
0
GdipGetImageDecoders (UINT numDecoders, UINT size, ImageCodecInfo *decoders) { if (!decoders || (numDecoders != g_decoders) || (size != sizeof (ImageCodecInfo) * g_decoders)) return GenericError; memcpy (decoders, g_decoder_list, size); return Ok; }
false
true
false
false
false
1
sqlite3Expr(int op, Expr *pLeft, Expr *pRight, const Token *pToken){ Expr *pNew; pNew = sqliteMalloc( sizeof(Expr) ); if( pNew==0 ){ /* When malloc fails, delete pLeft and pRight. Expressions passed to ** this function must always be allocated with sqlite3Expr() for this ** reason. */ sqlite3ExprDelete(pLeft); sqlite3ExprDelete(pRight); return 0; } pNew->op = op; pNew->pLeft = pLeft; pNew->pRight = pRight; pNew->iAgg = -1; if( pToken ){ assert( pToken->dyn==0 ); pNew->span = pNew->token = *pToken; }else if( pLeft ){ if( pRight ){ sqlite3ExprSpan(pNew, &pLeft->span, &pRight->span); if( pRight->flags & EP_ExpCollate ){ pNew->flags |= EP_ExpCollate; pNew->pColl = pRight->pColl; } } if( pLeft->flags & EP_ExpCollate ){ pNew->flags |= EP_ExpCollate; pNew->pColl = pLeft->pColl; } } return pNew; }
false
false
false
false
false
0
reg_block_dump(struct adapter *ap, void *buf, unsigned int start, unsigned int end) { u32 *p = buf + start; for ( ; start <= end; start += sizeof(u32)) *p++ = readl(ap->regs + start); }
false
false
false
false
false
0
GetLogSize(UInt32 size) { for (int i = kSubBits; i < 32; i++) for (UInt32 j = 0; j < (1 << kSubBits); j++) if (size <= (((UInt32)1) << i) + (j << (i - kSubBits))) return (i << kSubBits) + j; return (32 << kSubBits); }
false
false
false
false
false
0
EXEC_auto_create(CLASS *class, bool ref) { void *object; object = CLASS_auto_create(class, 0); /* object is checked by CLASS_auto_create */ /*if (UNLIKELY(class->must_check && (*(class->check))(object))) THROW(E_IOBJECT);*/ if (ref) OBJECT_REF(object, "EXEC_auto_create"); return object; }
false
false
false
false
false
0
indicator_menu_item_get_icon_name (IndicatorMenuItem *self) { const gchar *name = NULL; if (gtk_image_get_storage_type (self->priv->image) == GTK_IMAGE_ICON_NAME) gtk_image_get_icon_name (self->priv->image, &name, NULL); return name; }
false
false
false
false
false
0
crypt_cipher_destroy(struct crypt_cipher *ctx) { if (ctx->tfmfd != -1) close(ctx->tfmfd); if (ctx->opfd != -1) close(ctx->opfd); memset(ctx, 0, sizeof(*ctx)); free(ctx); return 0; }
false
false
false
false
false
0
redrat3_init_rc_dev(struct redrat3_dev *rr3) { struct device *dev = rr3->dev; struct rc_dev *rc; int ret = -ENODEV; u16 prod = le16_to_cpu(rr3->udev->descriptor.idProduct); rc = rc_allocate_device(); if (!rc) { dev_err(dev, "remote input dev allocation failed\n"); goto out; } snprintf(rr3->name, sizeof(rr3->name), "RedRat3%s " "Infrared Remote Transceiver (%04x:%04x)", prod == USB_RR3IIUSB_PRODUCT_ID ? "-II" : "", le16_to_cpu(rr3->udev->descriptor.idVendor), prod); usb_make_path(rr3->udev, rr3->phys, sizeof(rr3->phys)); rc->input_name = rr3->name; rc->input_phys = rr3->phys; usb_to_input_id(rr3->udev, &rc->input_id); rc->dev.parent = dev; rc->priv = rr3; rc->driver_type = RC_DRIVER_IR_RAW; rc->allowed_protocols = RC_BIT_ALL; rc->timeout = US_TO_NS(2750); rc->tx_ir = redrat3_transmit_ir; rc->s_tx_carrier = redrat3_set_tx_carrier; rc->driver_name = DRIVER_NAME; rc->rx_resolution = US_TO_NS(2); rc->map_name = RC_MAP_HAUPPAUGE; ret = rc_register_device(rc); if (ret < 0) { dev_err(dev, "remote dev registration failed\n"); goto out; } return rc; out: rc_free_device(rc); return NULL; }
false
false
false
false
false
0
gst_tag_to_metadata_block_picture (const gchar * tag, const GValue * image_value) { gchar *comment_data, *data_result; const gchar *mime_type; guint mime_type_len; GstStructure *mime_struct; GstBuffer *buffer; GList *l = NULL; GstByteWriter writer; GstTagImageType image_type = GST_TAG_IMAGE_TYPE_NONE; gint width = 0, height = 0; guint8 *metadata_block; guint metadata_block_len; g_return_val_if_fail (image_value != NULL, NULL); buffer = gst_value_get_buffer (image_value); g_return_val_if_fail (gst_caps_is_fixed (buffer->caps), NULL); mime_struct = gst_caps_get_structure (buffer->caps, 0); mime_type = gst_structure_get_name (mime_struct); if (strcmp (mime_type, "text/uri-list") == 0) mime_type = "-->"; mime_type_len = strlen (mime_type); gst_structure_get (mime_struct, "image-type", GST_TYPE_TAG_IMAGE_TYPE, &image_type, "width", G_TYPE_INT, &width, "height", G_TYPE_INT, &height, NULL); metadata_block_len = 32 + mime_type_len + GST_BUFFER_SIZE (buffer); gst_byte_writer_init_with_size (&writer, metadata_block_len, TRUE); if (image_type == GST_TAG_IMAGE_TYPE_NONE && strcmp (tag, GST_TAG_PREVIEW_IMAGE) == 0) { gst_byte_writer_put_uint32_be_unchecked (&writer, 0x01); } else { /* Convert to ID3v2 APIC image type */ if (image_type == GST_TAG_IMAGE_TYPE_NONE) image_type = GST_TAG_IMAGE_TYPE_UNDEFINED; else image_type = image_type + 2; gst_byte_writer_put_uint32_be_unchecked (&writer, image_type); } gst_byte_writer_put_uint32_be_unchecked (&writer, mime_type_len); gst_byte_writer_put_data_unchecked (&writer, (guint8 *) mime_type, mime_type_len); /* description length */ gst_byte_writer_put_uint32_be_unchecked (&writer, 0); gst_byte_writer_put_uint32_be_unchecked (&writer, width); gst_byte_writer_put_uint32_be_unchecked (&writer, height); /* color depth */ gst_byte_writer_put_uint32_be_unchecked (&writer, 0); /* for indexed formats the number of colors */ gst_byte_writer_put_uint32_be_unchecked (&writer, 0); gst_byte_writer_put_uint32_be_unchecked (&writer, GST_BUFFER_SIZE (buffer)); gst_byte_writer_put_data_unchecked (&writer, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer)); g_assert (gst_byte_writer_get_pos (&writer) == metadata_block_len); metadata_block = gst_byte_writer_reset_and_get_data (&writer); comment_data = g_base64_encode (metadata_block, metadata_block_len); g_free (metadata_block); data_result = g_strdup_printf ("METADATA_BLOCK_PICTURE=%s", comment_data); g_free (comment_data); l = g_list_append (l, data_result); return l; }
false
false
false
false
false
0
Scale( double *p1, double *p2, int vtkNotUsed( X ), int Y ) { // Get the motion vector double v[3]; v[0] = p2[0] - p1[0]; v[1] = p2[1] - p1[1]; v[2] = p2[2] - p1[2]; double center[3] = { 0., 0., 0. }; double avgdist = 0.; double *prevctr = this->HandleGeometry[0]->GetCenter(); double *ctr; center[0] += prevctr[0]; center[1] += prevctr[1]; center[2] += prevctr[2]; int i; for ( i = 1; i < this->NumberOfHandles; ++ i ) { ctr = this->HandleGeometry[i]->GetCenter(); center[0] += ctr[0]; center[1] += ctr[1]; center[2] += ctr[2]; avgdist += sqrt( vtkMath::Distance2BetweenPoints( ctr,prevctr ) ); prevctr = ctr; } avgdist /= this->NumberOfHandles; center[0] /= this->NumberOfHandles; center[1] /= this->NumberOfHandles; center[2] /= this->NumberOfHandles; // Compute the scale factor double sf = vtkMath::Norm( v ) / avgdist; if ( Y > this->Interactor->GetLastEventPosition()[1] ) { sf = 1.0 + sf; } else { sf = 1.0 - sf; } // Move the handle points double newCtr[3]; for ( i = 0; i < this->NumberOfHandles; ++ i ) { ctr = this->HandleGeometry[i]->GetCenter(); for ( int j = 0; j < 3; ++j ) { newCtr[j] = sf * ( ctr[j] - center[j]) + center[j]; } this->HandleGeometry[i]->SetCenter( newCtr ); this->HandleGeometry[i]->Update(); } }
false
false
false
false
false
0
JS_RemoveArgumentFormatter(JSContext *cx, const char *format) { size_t length; JSArgumentFormatMap **mpp, *map; length = strlen(format); mpp = &cx->argumentFormatMap; while ((map = *mpp) != NULL) { if (map->length == length && !strcmp(map->format, format)) { *mpp = map->next; cx->free(map); return; } mpp = &map->next; } }
false
false
false
false
false
0
Gif_ReleaseUncompressedImage(Gif_Image *gfi) { Gif_DeleteArray(gfi->img); if (gfi->image_data && gfi->free_image_data) (*gfi->free_image_data)(gfi->image_data); gfi->img = 0; gfi->image_data = 0; gfi->free_image_data = 0; }
false
false
false
false
false
0
acf_cut_exec(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) { int ret = -1; struct ast_str *str = ast_str_create(16); switch (cut_internal(chan, data, &str, len)) { case ERROR_NOARG: ast_log(LOG_ERROR, "Syntax: CUT(<varname>,<char-delim>,<range-spec>) - missing argument!\n"); break; case ERROR_NOMEM: ast_log(LOG_ERROR, "Out of memory\n"); break; case ERROR_USAGE: ast_log(LOG_ERROR, "Usage: CUT(<varname>,<char-delim>,<range-spec>)\n"); break; case 0: ret = 0; ast_copy_string(buf, ast_str_buffer(str), len); break; default: ast_log(LOG_ERROR, "Unknown internal error\n"); } ast_free(str); return ret; }
false
false
false
false
false
0
entries( const std::string& path ) { std::list<std::string> result; DirTree* dt = io->dirtree; DirEntry* e = dt->entry( path, false ); if( e && e->dir ) { unsigned parent = dt->indexOf( e ); std::vector<unsigned> children = dt->children( parent ); for( unsigned i = 0; i < children.size(); i++ ) result.push_back( dt->entry( children[i] )->name ); } return result; }
false
false
false
false
false
0
show_parconfig_smsc37c669(int io, int key) { int cr1, cr4, cra, cr23, cr26, cr27; struct superio_struct *s; static const char *const modes[] = { "SPP and Bidirectional (PS/2)", "EPP and SPP", "ECP", "ECP and EPP" }; outb(key, io); outb(key, io); outb(1, io); cr1 = inb(io + 1); outb(4, io); cr4 = inb(io + 1); outb(0x0a, io); cra = inb(io + 1); outb(0x23, io); cr23 = inb(io + 1); outb(0x26, io); cr26 = inb(io + 1); outb(0x27, io); cr27 = inb(io + 1); outb(0xaa, io); if (verbose_probing) { printk(KERN_INFO "SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, " "A=0x%2x, 23=0x%02x, 26=0x%02x, 27=0x%02x\n", cr1, cr4, cra, cr23, cr26, cr27); /* The documentation calls DMA and IRQ-Lines by letters, so the board maker can/will wire them appropriately/randomly... G=reserved H=IDE-irq, */ printk(KERN_INFO "SMSC LPT Config: io=0x%04x, irq=%c, dma=%c, fifo threshold=%d\n", cr23 * 4, (cr27 & 0x0f) ? 'A' - 1 + (cr27 & 0x0f) : '-', (cr26 & 0x0f) ? 'A' - 1 + (cr26 & 0x0f) : '-', cra & 0x0f); printk(KERN_INFO "SMSC LPT Config: enabled=%s power=%s\n", (cr23 * 4 >= 0x100) ? "yes" : "no", (cr1 & 4) ? "yes" : "no"); printk(KERN_INFO "SMSC LPT Config: Port mode=%s, EPP version =%s\n", (cr1 & 0x08) ? "Standard mode only (SPP)" : modes[cr4 & 0x03], (cr4 & 0x40) ? "1.7" : "1.9"); } /* Heuristics ! BIOS setup for this mainboard device limits the choices to standard settings, i.e. io-address and IRQ are related, however DMA can be 1 or 3, assume DMA_A=DMA1, DMA_C=DMA3 (this is true e.g. for TYAN 1564D Tomcat IV) */ if (cr23 * 4 >= 0x100) { /* if active */ s = find_free_superio(); if (s == NULL) printk(KERN_INFO "Super-IO: too many chips!\n"); else { int d; switch (cr23 * 4) { case 0x3bc: s->io = 0x3bc; s->irq = 7; break; case 0x378: s->io = 0x378; s->irq = 7; break; case 0x278: s->io = 0x278; s->irq = 5; } d = (cr26 & 0x0f); if (d == 1 || d == 3) s->dma = d; else s->dma = PARPORT_DMA_NONE; } } }
false
false
false
false
false
0
setStyle(RenderStyle* style) { RenderStyle* useStyle = style; // SVG text layout code expects us to be a block-level style element. if (useStyle->display() == NONE) setChildrenInline(false); else if (useStyle->isDisplayInlineType()) { useStyle = new /*khtml: don't use it like that!(renderArena())*/ RenderStyle(); useStyle->inheritFrom(style); useStyle->setDisplay(BLOCK); } RenderBlock::setStyle(useStyle); setReplaced(false); //FIXME: Once overflow rules are supported by SVG we should //probably map the CSS overflow rules rather than just ignoring //them setHasOverflowClip(false); }
false
false
false
false
false
0
fnmatch_pattern_has_wildcards (const char *str, int options) { while (1) { switch (*str++) { case '\\': str += ! (options & FNM_NOESCAPE) && *str; break; case '+': case '@': case '!': if (options & FNM_EXTMATCH && *str == '(') return true; break; case '?': case '*': case '[': return true; case '\0': return false; } } }
false
false
false
false
false
0
read_ancestry(const char *graft_file) { FILE *fp = fopen(graft_file, "r"); char buf[1024]; if (!fp) return -1; while (fgets(buf, sizeof(buf), fp)) { /* The format is just "Commit Parent1 Parent2 ...\n" */ int len = strlen(buf); struct commit_graft *graft = read_graft_line(buf, len); if (graft) register_commit_graft(graft, 0); } fclose(fp); return 0; }
true
true
false
false
true
1
rb_ary_collect(VALUE ary) { long i; VALUE collect; RETURN_ENUMERATOR(ary, 0, 0); collect = rb_ary_new2(RARRAY_LEN(ary)); for (i = 0; i < RARRAY_LEN(ary); i++) { rb_ary_push(collect, rb_yield(RARRAY_PTR(ary)[i])); } return collect; }
false
false
false
false
false
0
theora_enc_stop (GstVideoEncoder * benc) { GstTheoraEnc *enc; GST_DEBUG_OBJECT (benc, "stop: clearing theora state"); enc = GST_THEORA_ENC (benc); if (enc->encoder) th_encode_free (enc->encoder); enc->encoder = NULL; th_comment_clear (&enc->comment); th_info_clear (&enc->info); if (enc->input_state) gst_video_codec_state_unref (enc->input_state); enc->input_state = NULL; /* Everything else is handled in reset() */ theora_enc_clear_multipass_cache (enc); return TRUE; }
false
false
false
false
false
0
star_list_update_labels(GtkWidget *window) { struct gui_star *gs; GSList *sl = NULL; struct gui_star_list *gsl; gsl = gtk_object_get_data(GTK_OBJECT(window), "gui_star_list"); if (gsl == NULL) return; sl = gsl->sl; while(sl != NULL) { gs = GUI_STAR(sl->data); sl = g_slist_next(sl); if (gs->s) { gui_star_label_from_cats(gs); } } }
false
false
false
false
false
0
M_SetupReadFields(void) { if(META_DEBUG) METAIO_STREAM::cout << "MetaGroup: M_SetupReadFields" << METAIO_STREAM::endl; MetaObject::M_SetupReadFields(); MET_FieldRecordType * mF = new MET_FieldRecordType; MET_InitReadField(mF, "EndGroup", MET_NONE, true); mF->terminateRead = true; m_Fields.push_back(mF); mF = MET_GetFieldRecord("ElementSpacing", &m_Fields); mF->required = false; }
false
false
false
false
false
0
e_gadcon_layout_orientation_get(Evas_Object *obj) { E_Smart_Data *sd; if (!obj) return 0; sd = evas_object_smart_data_get(obj); if (!sd) return 0; return sd->horizontal; }
false
false
false
false
false
0
tst_flt_delta_equal(int line_num, tst_case *tc, const double expected, const double actual, const double delta) { double diff; a_cnt++; update_status(); if (tc->failed && !force) { return false; } if (expected == actual) { return true; } /* account for floating point error */ diff = (expected - actual) / expected; if ((diff * diff) < delta) { return true; } tc->failed = true; tst_msg(tc->name, tc->suite->name, line_num, "expected <%G>, but saw <%G>\n", expected, actual); return false; }
false
false
false
false
false
0
xmlSecNssDigestInitialize(xmlSecTransformPtr transform) { xmlSecNssDigestCtxPtr ctx; xmlSecAssert2(xmlSecNssDigestCheckId(transform), -1); xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssDigestSize), -1); ctx = xmlSecNssDigestGetCtx(transform); xmlSecAssert2(ctx != NULL, -1); /* initialize context */ memset(ctx, 0, sizeof(xmlSecNssDigestCtx)); #ifndef XMLSEC_NO_SHA1 if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha1Id)) { ctx->digest = SECOID_FindOIDByTag(SEC_OID_SHA1); } else #endif /* XMLSEC_NO_SHA1 */ if(1) { xmlSecError(XMLSEC_ERRORS_HERE, xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), NULL, XMLSEC_ERRORS_R_INVALID_TRANSFORM, XMLSEC_ERRORS_NO_MESSAGE); return(-1); } if(ctx->digest == NULL) { xmlSecError(XMLSEC_ERRORS_HERE, xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), "SECOID_FindOIDByTag", XMLSEC_ERRORS_R_CRYPTO_FAILED, "error code=%d", PORT_GetError()); return(-1); } ctx->digestCtx = PK11_CreateDigestContext(ctx->digest->offset); if(ctx->digestCtx == NULL) { xmlSecError(XMLSEC_ERRORS_HERE, xmlSecErrorsSafeString(xmlSecTransformGetName(transform)), "PK11_CreateDigestContext", XMLSEC_ERRORS_R_CRYPTO_FAILED, "error code=%d", PORT_GetError()); return(-1); } return(0); }
false
false
false
false
false
0
load_method(private_xauth_t* this) { identification_t *server, *peer; enumerator_t *enumerator; xauth_method_t *xauth; xauth_role_t role; peer_cfg_t *peer_cfg; auth_cfg_t *auth; char *name; if (this->initiator) { server = this->ike_sa->get_my_id(this->ike_sa); peer = this->ike_sa->get_other_id(this->ike_sa); role = XAUTH_SERVER; } else { peer = this->ike_sa->get_my_id(this->ike_sa); server = this->ike_sa->get_other_id(this->ike_sa); role = XAUTH_PEER; } peer_cfg = this->ike_sa->get_peer_cfg(this->ike_sa); enumerator = peer_cfg->create_auth_cfg_enumerator(peer_cfg, !this->initiator); if (!enumerator->enumerate(enumerator, &auth) || (uintptr_t)auth->get(auth, AUTH_RULE_AUTH_CLASS) != AUTH_CLASS_XAUTH) { if (!enumerator->enumerate(enumerator, &auth) || (uintptr_t)auth->get(auth, AUTH_RULE_AUTH_CLASS) != AUTH_CLASS_XAUTH) { DBG1(DBG_CFG, "no XAuth authentication round found"); enumerator->destroy(enumerator); return NULL; } } name = auth->get(auth, AUTH_RULE_XAUTH_BACKEND); this->user = auth->get(auth, AUTH_RULE_XAUTH_IDENTITY); enumerator->destroy(enumerator); if (!this->initiator && this->user) { /* use XAUTH username, if configured */ peer = this->user; } xauth = charon->xauth->create_instance(charon->xauth, name, role, server, peer); if (!xauth) { if (name) { DBG1(DBG_CFG, "no XAuth method found for '%s'", name); } else { DBG1(DBG_CFG, "no XAuth method found"); } } return xauth; }
false
false
false
false
false
0
jgdi_report_queue_begin(qhost_report_handler_t* handler, const char* qname, lList** alpp) { jgdi_report_handler_t* ctx = (jgdi_report_handler_t*)handler->ctx; JNIEnv *env = ctx->env; DENTER(JGDI_LAYER, "jgdi_report_queue_begin"); DPRINTF(("jgdi_report_queue_begin: %s\n", qname)); if (QueueInfoImpl_init(env, &(ctx->queue_info), alpp) != JGDI_SUCCESS) { goto error; } if (QueueInfoImpl_setQname(env, ctx->queue_info, qname, alpp) != JGDI_SUCCESS) { goto error; } DRETURN(QHOST_SUCCESS); error: DRETURN(QHOST_ERROR); }
false
false
false
false
false
0
GenerateEnchSuffixFactor(uint32 item_id) { ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id); if (!itemProto) return 0; if (!itemProto->RandomSuffix) return 0; RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel); if (!randomProperty) return 0; uint32 suffixFactor; switch (itemProto->InventoryType) { // Items of that type don`t have points case INVTYPE_NON_EQUIP: case INVTYPE_BAG: case INVTYPE_TABARD: case INVTYPE_AMMO: case INVTYPE_QUIVER: case INVTYPE_RELIC: return 0; // Select point coefficient case INVTYPE_HEAD: case INVTYPE_BODY: case INVTYPE_CHEST: case INVTYPE_LEGS: case INVTYPE_2HWEAPON: case INVTYPE_ROBE: suffixFactor = 0; break; case INVTYPE_SHOULDERS: case INVTYPE_WAIST: case INVTYPE_FEET: case INVTYPE_HANDS: case INVTYPE_TRINKET: suffixFactor = 1; break; case INVTYPE_NECK: case INVTYPE_WRISTS: case INVTYPE_FINGER: case INVTYPE_SHIELD: case INVTYPE_CLOAK: case INVTYPE_HOLDABLE: suffixFactor = 2; break; case INVTYPE_WEAPON: case INVTYPE_WEAPONMAINHAND: case INVTYPE_WEAPONOFFHAND: suffixFactor = 3; break; case INVTYPE_RANGED: case INVTYPE_THROWN: case INVTYPE_RANGEDRIGHT: suffixFactor = 4; break; default: return 0; } // Select rare/epic modifier switch (itemProto->Quality) { case ITEM_QUALITY_UNCOMMON: return randomProperty->UncommonPropertiesPoints[suffixFactor]; case ITEM_QUALITY_RARE: return randomProperty->RarePropertiesPoints[suffixFactor]; case ITEM_QUALITY_EPIC: return randomProperty->EpicPropertiesPoints[suffixFactor]; case ITEM_QUALITY_LEGENDARY: case ITEM_QUALITY_ARTIFACT: return 0; // not have random properties default: break; } return 0; }
false
false
false
false
false
0
disk_cache_shift(struct key_disk_cache *c) { UINT32 key_size, offset; struct key_disk_cache *tmp = key_disk_cache_head; /* offset is the end of the key location in the file */ offset = TSSPS_VENDOR_DATA_OFFSET(c) + c->vendor_data_size; /* key_size is the size of the key entry on disk */ key_size = offset - TSSPS_UUID_OFFSET(c); /* for each disk cache entry, if the data for that entry is at an * offset greater than the key beign removed, then the entry needs to * be decremented by the size of key's disk footprint (the key_size * variable) */ while (tmp) { if (tmp->offset >= offset) { tmp->offset -= key_size; } tmp = tmp->next; } }
false
false
false
false
false
0
open(const std::string& mode) { close(); p_->openMode_ = mode; p_->opMode_ = Impl::opSeek; #ifdef EXV_UNICODE_PATH if (p_->wpMode_ == Impl::wpUnicode) { p_->fp_ = ::_wfopen(wpath().c_str(), s2ws(mode).c_str()); } else #endif { p_->fp_ = ::fopen(path().c_str(), mode.c_str()); } if (!p_->fp_) return 1; return 0; }
false
false
false
false
false
0
getConfigItemQualityAmount(AuctionQuality quality) const { switch (quality) { case AUCTION_QUALITY_GREY: return getConfig(CONFIG_UINT32_AHBOT_ITEM_GREY_AMOUNT); case AUCTION_QUALITY_WHITE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_WHITE_AMOUNT); case AUCTION_QUALITY_GREEN: return getConfig(CONFIG_UINT32_AHBOT_ITEM_GREEN_AMOUNT); case AUCTION_QUALITY_BLUE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_BLUE_AMOUNT); case AUCTION_QUALITY_PURPLE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_PURPLE_AMOUNT); case AUCTION_QUALITY_ORANGE: return getConfig(CONFIG_UINT32_AHBOT_ITEM_ORANGE_AMOUNT); default: return getConfig(CONFIG_UINT32_AHBOT_ITEM_YELLOW_AMOUNT); } }
false
false
false
false
false
0
qstrlower(char *str) { char *cp; if (!str) return NULL; for (cp = str; *cp; cp++) if (*cp >= 'A' && *cp <= 'Z') *cp += 32; return str; }
false
false
false
false
false
0
locateItemforSignatureCreation(DcmItem& dataset, const char *location) { DcmTagKey key; Uint32 idx; int pos = 0; int token = 0; int expected = 1; OFBool finished = OFFalse; DcmItem *result = &dataset; DcmSequenceOfItems *sq = NULL; DcmStack stack; do { token = readNextToken(location, pos, key, idx); if ((token != expected)&&(token != -1)) { OFLOG_ERROR(dcmsignLogger, "parse error in item location string '" << location << "'"); return NULL; } if (token == -1) { if (! finished) { OFLOG_ERROR(dcmsignLogger, "item location string '" << location << "' incomplete."); return NULL; } return result; } if (token == 1) { // we have read a tag key stack.clear(); if (EC_Normal != result->search(key, stack, ESM_fromHere, OFFalse)) { OFLOG_ERROR(dcmsignLogger, "attribute " << key << " not found in dataset (item location string is '" << location << "')"); return NULL; } if (stack.top()->ident() == EVR_SQ) { sq = OFstatic_cast(DcmSequenceOfItems *, (stack.top())); } else { OFLOG_ERROR(dcmsignLogger, "attribute " << key << " is not a sequence (item location string is '" << location << "')"); return NULL; } expected = 2; finished = OFFalse; } else if (token == 2) { // we have read an index if (sq == NULL) { OFLOG_ERROR(dcmsignLogger, "sequence not found in item location string '" << location << "'"); return NULL; } if (idx >= sq->card()) { OFLOG_ERROR(dcmsignLogger, "sequence " << sq->getTag() << " only has " << sq->card() << " items, cannot locate item " << idx << " (item location string is '" << location << "')"); return NULL; } result = sq->getItem(idx); if (result == NULL) { OFLOG_ERROR(dcmsignLogger, "item not found in item location string '" << location << "'"); return NULL; } expected = 3; finished = OFTrue; } else if (token == 3) { // we have read a period expected = 1; finished = OFFalse; } } while (token > 0); return NULL; }
false
false
false
false
false
0
crypto_spawn_alg(struct crypto_spawn *spawn) { struct crypto_alg *alg; struct crypto_alg *alg2; down_read(&crypto_alg_sem); alg = spawn->alg; alg2 = alg; if (alg2) alg2 = crypto_mod_get(alg2); up_read(&crypto_alg_sem); if (!alg2) { if (alg) crypto_shoot_alg(alg); return ERR_PTR(-EAGAIN); } return alg; }
false
false
false
false
false
0
H5Tenum_create(hid_t parent_id) { H5T_t *parent = NULL; /*base integer data type */ H5T_t *dt = NULL; /*new enumeration data type */ hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", parent_id); /* Check args */ if(NULL == (parent = (H5T_t *)H5I_object_verify(parent_id, H5I_DATATYPE)) || H5T_INTEGER != parent->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer data type") /* Build new type */ if(NULL == (dt = H5T__enum_create(parent))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot create enum type") /* Atomize the type */ if ((ret_value=H5I_register(H5I_DATATYPE, dt, TRUE))<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type atom") done: FUNC_LEAVE_API(ret_value) }
false
false
false
false
false
0
dm_get_live_table_fast(struct mapped_device *md) __acquires(RCU) { rcu_read_lock(); return rcu_dereference(md->map); }
false
false
false
false
false
0
GetDomainMinNumberOfPeriods(const String& domain) const { // Well ... if a domain has been specified, we need some check-ups // as the standard says. static char* TopLevelDomains[] = { "com", "edu", "net", "org", "gov", "mil", "int", 0}; const char* s = strrchr(domain.get(), '.'); if (!s) // no 'dot' has been found. Not valid return 0; if (! *(++s)) // nothing after the dot. Not Valid return 0; for (char** p = TopLevelDomains; *p; ++p) { if (!strncmp(*p, s, strlen(*p))) return 2; } return 3; // By default the minimum value }
false
false
false
false
false
0
FSBlkNextElm( BTSK * pStack) { RCODE rc = FERR_BT_END_OF_DATA; FLMBYTE * elmPtr; FLMUINT uiElmSize; elmPtr = &pStack->pBlk[pStack->uiCurElm]; if (pStack->uiBlkType == BHT_LEAF) { uiElmSize = BBE_LEN( elmPtr); if (pStack->uiCurElm + BBE_LEM_LEN < pStack->uiBlkEnd) { if ((pStack->uiCurElm += uiElmSize) + BBE_LEM_LEN < pStack->uiBlkEnd) { rc = FERR_OK; } } } else { if (pStack->uiBlkType == BHT_NON_LEAF_DATA) { uiElmSize = BNE_DATA_OVHD; } else { uiElmSize = (FLMUINT) BNE_LEN( pStack, elmPtr); } if (pStack->uiCurElm < pStack->uiBlkEnd) { // Check if this is not the last element within the block if ((pStack->uiCurElm += uiElmSize) < pStack->uiBlkEnd) { rc = FERR_OK; } } } return (rc); }
false
false
false
false
false
0
mark_address (gimple stmt, tree addr, tree, void *data) { addr = get_base_address (addr); if (TREE_CODE (addr) == FUNCTION_DECL) { struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr); cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)data, (symtab_node)node, IPA_REF_ADDR, stmt); } else if (addr && TREE_CODE (addr) == VAR_DECL && (TREE_STATIC (addr) || DECL_EXTERNAL (addr))) { struct varpool_node *vnode = varpool_node_for_decl (addr); ipa_record_reference ((symtab_node)data, (symtab_node)vnode, IPA_REF_ADDR, stmt); } return false; }
false
false
false
false
false
0
ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number, void *endp, struct urb *urb, u8 address, u8 ep_number, u8 toggle_bits, void (*callback) (void *endp, struct urb *urb, u8 *buf, int len, int toggle_bits, int error_count, int condition_code, int repeat_number, int halted, int skipped, int actual, int non_null)) { u8 ed = ed_number - 1; wait:if (ftdi->disconnected > 0) { return -ENODEV; } else if (ftdi->initialized == 0) { return -ENODEV; } else { int command_size; mutex_lock(&ftdi->u132_lock); command_size = ftdi->command_next - ftdi->command_head; if (command_size < COMMAND_SIZE) { u8 *b; u16 urb_size; int i = 0; char data[30 *3 + 4]; char *d = data; int m = (sizeof(data) - 1) / 3; int l = 0; struct u132_target *target = &ftdi->target[ed]; struct u132_command *command = &ftdi->command[ COMMAND_MASK & ftdi->command_next]; command->header = 0x81 | (ed << 5); command->address = (toggle_bits << 6) | (ep_number << 2) | (address << 0); command->width = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); command->follows = min_t(u32, 1024, urb->transfer_buffer_length - urb->actual_length); command->value = 0; command->buffer = urb->transfer_buffer + urb->actual_length; command->length = 0x8000 | (command->follows - 1); b = command->buffer; urb_size = command->follows; data[0] = 0; while (urb_size-- > 0) { if (i > m) { } else if (i++ < m) { int w = sprintf(d, " %02X", *b++); d += w; l += w; } else d += sprintf(d, " .."); } target->callback = callback; target->endp = endp; target->urb = urb; target->active = 1; ftdi->command_next += 1; ftdi_elan_kick_command_queue(ftdi); mutex_unlock(&ftdi->u132_lock); return 0; } else { mutex_unlock(&ftdi->u132_lock); msleep(100); goto wait; } } }
false
false
false
false
false
0
_parse_subpath_extension(BITSTREAM *bits, MPLS_PL *pl) { MPLS_SUB *sub_path; int ii; uint32_t len = bs_read(bits, 32); int sub_count = bs_read(bits, 16); if (len < 1 || sub_count < 1) { return 0; } sub_path = calloc(sub_count, sizeof(MPLS_SUB)); for (ii = 0; ii < sub_count; ii++) { if (!_parse_subpath(bits, &sub_path[ii])) { X_FREE(sub_path); fprintf(stderr, "error parsing extension subpath\n"); return 0; } } pl->ext_sub_path = sub_path; pl->ext_sub_count = sub_count; return 1; }
false
false
false
false
false
0
xkill (class reader_t *pipe_) { zmq_assert (pipe_ == reply_pipe); reply_pipe_active = false; }
false
false
false
false
false
0
evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (a.negative) return IdlLongLongVal(IDL_LongLong(a.s ^ b.s)); else return IdlLongLongVal(IDL_ULongLong(a.u ^ b.u)); }
false
false
false
false
false
0
proc_sync_cmd(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len) { if (!mcl->mi->csp_enabled || !mcl->csp) { switch (cmd[0]) { case MCAP_MD_SYNC_CAP_REQ: send_unsupported_cap_req(mcl); break; case MCAP_MD_SYNC_SET_REQ: send_unsupported_set_req(mcl); break; } return; } switch (cmd[0]) { case MCAP_MD_SYNC_CAP_REQ: proc_sync_cap_req(mcl, cmd, len); break; case MCAP_MD_SYNC_CAP_RSP: proc_sync_cap_rsp(mcl, cmd, len); break; case MCAP_MD_SYNC_SET_REQ: proc_sync_set_req(mcl, cmd, len); break; case MCAP_MD_SYNC_SET_RSP: proc_sync_set_rsp(mcl, cmd, len); break; case MCAP_MD_SYNC_INFO_IND: proc_sync_info_ind(mcl, cmd, len); break; } }
false
false
false
false
false
0
isl_seq_lcm(isl_int *p, unsigned len, isl_int *lcm) { int i; if (len == 0) { isl_int_set_si(*lcm, 1); return; } isl_int_set(*lcm, p[0]); for (i = 1; i < len; ++i) isl_int_lcm(*lcm, *lcm, p[i]); }
false
false
false
false
false
0
search_neighbors(double **x,double **cy,struct param p,struct sfound sf) { int ei,ej,i,hdim,whichsize,whichbox; long found; double epsilon; hdim=p.hdim; ei=(int)(cy[0][hdim]*EPSILONS); if (ei < 0) ei=0; else if (ei>(EPSILONS-1)) ei=EPSILONS-1; ej=(int)(cy[nsseconddim][hdim]*EPSILONS); if (ej < 0) ej=0; else if (ej>(EPSILONS-1)) ej=EPSILONS-1; if (countstarteps[ei][ej] > 0) epsilon=starteps[ei][ej]/countstarteps[ei][ej]; else epsilon=0.001; found=0; epsilon /= EPSFAC; while (found < p.MINN) { epsilon *= EPSFAC; whichsize=(int)(1.0/epsilon); if (whichsize > neigh[NEIGH-1].n) whichbox=NEIGH-1; else { whichbox=0; for (i=NEIGH-1;i>0;i--) { if ((whichsize > neigh[i-1].n) && (whichsize <= neigh[i].n)) whichbox=i-1; } } found=find_neighbors(x,cy,whichbox,p,sf,epsilon); } sort(found,p,sf); if (sf.distance[p.MINN-1] == 0.0) { fprintf(stderr,"all neighbors collapse to one point. Maybe add\n" "initial noise to the data\n"); exit(SEARCH_NEIGHBORS_ZERO_DISTANCE); } starteps[ei][ej] += sf.distance[p.MINN-1]; countstarteps[ei][ej]++; }
false
false
false
false
false
0
callAsFunction(ExecState *exec, JSObject *thisObj, const List &args) { KJS_CHECK_THIS( KJS::DOMNamedNodeMap, thisObj ); DOMExceptionTranslator exception(exec); DOM::NamedNodeMapImpl& map = *static_cast<DOMNamedNodeMap *>(thisObj)->impl(); switch(id) { case DOMNamedNodeMap::GetNamedItem: return getDOMNode(exec, map.getNamedItem(args[0]->toString(exec).domString())); case DOMNamedNodeMap::SetNamedItem: { DOM::Node old = map.setNamedItem(toNode(args[0]),exception); return getDOMNode(exec, old.handle()); } case DOMNamedNodeMap::RemoveNamedItem: { DOM::Attr toRet = map.removeNamedItem(args[0]->toString(exec).domString(), exception); return getDOMNode(exec, toRet.handle()); } case DOMNamedNodeMap::Item: return getDOMNode(exec, map.item(args[0]->toInt32(exec))); case DOMNamedNodeMap::GetNamedItemNS: {// DOM2 DOM::Node old = map.getNamedItemNS(args[0]->toString(exec).domString(),args[1]->toString(exec).domString()); return getDOMNode(exec, old.handle()); } case DOMNamedNodeMap::SetNamedItemNS: {// DOM2 DOM::Node old = map.setNamedItemNS(toNode(args[0]),exception); return getDOMNode(exec, old.handle()); } case DOMNamedNodeMap::RemoveNamedItemNS: { // DOM2 DOM::Node old = map.removeNamedItemNS(args[0]->toString(exec).domString(),args[1]->toString(exec).domString(),exception); return getDOMNode(exec, old.handle()); } default: break; } return jsUndefined(); }
false
false
false
true
false
1
tei_debug(struct FsmInst *fi, char *fmt, ...) { struct teimgr *tm = fi->userdata; struct va_format vaf; va_list va; if (!(*debug & DEBUG_L2_TEIFSM)) return; va_start(va, fmt); vaf.fmt = fmt; vaf.va = &va; printk(KERN_DEBUG "sapi(%d) tei(%d): %pV\n", tm->l2->sapi, tm->l2->tei, &vaf); va_end(va); }
false
false
false
false
false
0
cyttsp4_spi_probe(struct spi_device *spi) { struct cyttsp4 *ts; int error; /* Set up SPI*/ spi->bits_per_word = CY_SPI_BITS_PER_WORD; spi->mode = SPI_MODE_0; error = spi_setup(spi); if (error < 0) { dev_err(&spi->dev, "%s: SPI setup error %d\n", __func__, error); return error; } ts = cyttsp4_probe(&cyttsp_spi_bus_ops, &spi->dev, spi->irq, CY_SPI_DATA_BUF_SIZE); return PTR_ERR_OR_ZERO(ts); }
false
false
false
false
false
0
SP(GeneralMatrix* gm, GeneralMatrix* gm2) { REPORT Real* s2=gm2->Store(); Real* s=gm->Store(); int i=gm->Storage() >> 2; while (i--) { *s++ *= *s2++; *s++ *= *s2++; *s++ *= *s2++; *s++ *= *s2++; } i=gm->Storage() & 3; while (i--) *s++ *= *s2++; }
false
false
false
false
false
0
saveLog(std::string name) { mrpt::synch::CCriticalSectionLocker cs( &semaphore ); saveToFile( name ); }
false
false
false
false
false
0
py_rgb_px(uint8_t *img_out, comp_t px, const int ch) { for (int k = 0; k < ch; k++) { img_out[k] = (uint8_t)px; px >>= CHANNEL_WIDTH_RGB; } }
false
false
false
false
false
0
get_pixbuf (GdkPixbufAnimationIter *anim_iter) { GdkPixbufSimpleAnimIter *iter; GdkPixbufFrame *frame; iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter); if (iter->current_frame) frame = iter->current_frame->data; else if (g_list_length (iter->simple_anim->frames) > 0) frame = g_list_last (iter->simple_anim->frames)->data; else frame = NULL; if (frame == NULL) return NULL; return frame->pixbuf; }
false
false
false
false
false
0
update_state() { for (int i=0, ss=sreg; i<8; i++,ss>>=1) m_Q[i]->putState(ss&1); }
false
false
false
false
false
0
on_cme__response (GtkWidget *widget, gint response_id, GapCmeGlobalParams *gpp) { GtkWidget *dialog; if(gpp) { gpp->val.run = FALSE; } switch (response_id) { case GTK_RESPONSE_OK: if(gpp) { switch(gpp->video_encoder_run_state) { case GAP_CME_ENC_RUN_STATE_READY: if(gpp->val.gui_proc_thread) { if(gap_cme_gui_check_gui_thread_is_active(gpp)) { return; } } if(gpp->ow__dialog_window != NULL) { /* Overwrite dialog is already open * but the User pressed the OK button in the qte main dialog again. */ gtk_window_present(GTK_WINDOW(gpp->ow__dialog_window)); return; } if(FALSE == gap_cme_gui_check_encode_OK (gpp)) { return; /* can not start, illegal parameter value combinations */ } gpp->val.run = TRUE; p_switch_gui_to_running_encoder_state(gpp); p_drop_chache_and_start_video_encoder(gpp); return; break; case GAP_CME_ENC_RUN_STATE_RUNNING: return; /* ignore further clicks on OK button while encoder is running */ break; case GAP_CME_ENC_RUN_STATE_FINISHED: /* close the master encoder window if OK button clicked after while encoder has finished */ break; } } /* now run into the default case, to close the shell_window (dont break) */ default: dialog = NULL; if(gpp) { gap_gve_misc_set_master_encoder_cancel_request(&gpp->encStatus, TRUE); gap_cme_gui_remove_poll_timer(gpp); p_remove_encoder_status_poll_timer(gpp); dialog = gpp->shell_window; if(dialog) { gpp->shell_window = NULL; gtk_widget_destroy (dialog); } gtk_main_quit (); } else { gtk_main_quit (); } break; } }
false
false
false
false
false
0
ftglue_qalloc( FT_Memory memory, FT_ULong size, FT_Error *perror ) { FT_Error error = 0; FT_Pointer block = NULL; if ( size > 0 ) { block = memory->alloc( memory, size ); if ( !block ) error = FT_Err_Out_Of_Memory; } *perror = error; return block; }
false
false
false
false
false
0
uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) { uv_fs_req_init(loop, req, UV_FS_UNLINK, cb); if (cb) { /* async */ uv_ref(loop); req->eio = eio_unlink(path, EIO_PRI_DEFAULT, uv__fs_after, req); if (!req->eio) { uv_err_new(loop, ENOMEM); return -1; } } else { /* sync */ req->result = unlink(path); if (req->result) { uv_err_new(loop, errno); return -1; } } return 0; }
false
false
false
false
false
0
STRING(ch) int ch; { int nest_level = 1; tokenType = TOKEN_STRING; do { ch = next_ch(); while(!isSTRING_SPECIAL(ch)) { save_ch(ch); ch = next_ch(); }; switch (ch) { case '(': ++nest_level; save_ch(ch); break; case ')': if (--nest_level > 0) save_ch(ch); break; case '\\': save_digraph(next_ch()); break; case '\r': /* All carriage returns (\r) are turned into linefeeds (\n)*/ ch = next_ch(); /* get the next one, is it \n? */ if (ch != '\n') { /* if not, then put it back. */ back_ch(ch); } save_ch('\n'); /* in either case, save a linefeed */ break; case EOF: tokenType = TOKEN_INVALID; /* Unterminated string */ nest_level = 0; break; } } while(nest_level > 0); return(DONE); }
false
false
false
false
false
0
restore_from_file(VMG_ vm_obj_id_t, CVmFile *fp, CVmObjFixup *) { size_t prec; /* read the precision */ prec = fp->read_uint2(); /* free any existing extension */ if (ext_ != 0) { G_mem->get_var_heap()->free_mem(ext_); ext_ = 0; } /* allocate the space */ alloc_bignum(vmg_ prec); /* store our precision */ set_prec(ext_, prec); /* read the contents */ fp->read_bytes(ext_ + VMBN_EXP, calc_alloc(prec) - VMBN_EXP); }
false
false
false
false
false
0
b44_phy_reset(struct b44_private *bp) { u32 val; int err; err = b44_phy_write(bp, MII_BMCR, BMCR_RESET); if (err) return err; udelay(100); err = b44_phy_read(bp, MII_BMCR, &val); if (!err) { if (val & BMCR_RESET) { return -ENODEV; } } return 0; }
false
false
false
false
false
0
decl_instconns(struct mod_t *mdp) { register struct cell_t *cp; register struct cell_pin_t *cpp; /* at this point all mod. insts., and gates on cell list */ /* SJM 03/25/99 - all gate ports including control must be declared imp. */ for (cp = mdp->mcells; cp != NULL; cp = cp->cnxt) { if (cp->cmsym == NULL) continue; for (cpp = cp->cpins; cpp != NULL; cpp = cpp->cpnxt) { /* this should always be at least 'bx by here */ /* change to special unc. indicator and check/fix here */ /* cell port connections lost */ if (cpp->cpxnd == NULL) __misc_terr(__FILE__, __LINE__); dcl_iconn_wires(cp, cpp->cpxnd); } } }
false
false
false
false
false
0
SetSocket( int handle, eSocketType sockettype ) { CString ip; int port; if ( m_eState != estNONE ) { return -1; } m_pConnMutex->Lock(); m_sIP.Empty(); m_nPort = 0; if ( CSocket::SetSocket(handle,sockettype) == -1 ) { m_pConnMutex->UnLock(); return -1; } // get remote host & port if ( GetPeerName( &ip, &port ) == false ) { m_pConnMutex->UnLock(); return -1; } // set remote host & port SetHost( ip, port ); m_bForceDisconnect = false; // init data timeout m_timeConnection = time(0); // init notify timer m_timeNotify = time(0); m_eState = estCONNECTED; if ( m_eSocketMode == esmSOCKET ) { connectionState(estCONNECTED); } else { connectionState(estSSLCONNECTED); } m_pConnMutex->UnLock(); return 0; }
false
false
false
false
false
0
utf8word_to_unicode(uint32 c) { uint32 ucs; if (c <= 0x7F) { ucs = c; } else if (c <= 0xFFFF) { ucs = ((c >> 8) & 0x1F) << 6; ucs |= c & 0x3F; } else if (c <= 0xFFFFFF) { ucs = ((c >> 16) & 0x0F) << 12; ucs |= ((c >> 8) & 0x3F) << 6; ucs |= c & 0x3F; } else { ucs = ((c >> 24) & 0x07) << 18; ucs |= ((c >> 16) & 0x3F) << 12; ucs |= ((c >> 8) & 0x3F) << 6; ucs |= c & 0x3F; } return ucs; }
false
false
false
false
false
0
x_T_hot(KILL_NODE *node, ARTICLE *articles, SUBJECT *subj) { long n = 0; ARTICLE *art, *thr; while (subj) { thr = subj->thread; if (THREAD_HAS_UNREAD(subj)) for (art = thr ; art ; art = next_in_thread_preorder(art)) if (art->xref && regexec(node->expr_re, art->xref, 0, NULL, 0) == 0) { n += mark_thread_hot(subj->thread, node->pixmap); break; } do { subj = subj->next; } while (subj && subj->thread == thr); } return n; }
false
false
false
false
false
0
runnable_alias (gchar *def, gint argc, gchar **argv, const gchar *line, gchar **runnable) { gint k, len; gchar **subst; gboolean retval = TRUE; GList *tokens, *it; /* Substitute parameters: $0: line, $@: line, $1: field 1, $2: field 2, ... */ tokens = alias_tokenize (def); len = g_list_length (tokens); subst = g_new0 (gchar *, len + 2); subst[len] = (gchar *) ";"; subst[len + 1] = NULL; if (!line) { line = (gchar *) ""; } k = 0; for (it = g_list_first (tokens); it != NULL; it = g_list_next (it)) { gchar *tok = it->data; gint i, size = strlen (tok); if (*tok == '$' && strspn (tok, "$@123456789") == size) { if (*(tok+1) == '@') { i = 0; } else { i = strtol (tok + 1, NULL, 10); } if (argc < i) { g_printf ("Error: Invalid alias call (missing parameters)!\n"); *runnable = NULL; retval = FALSE; goto finish; } if (i == 0) { subst[k] = (gchar *) line; } else { subst[k] = argv[i - 1]; } } else { subst[k] = tok; } k++; } /* put ';' to make parsing simple */ *runnable = g_strjoinv (" ", subst); finish: /* free tokens */ g_list_foreach (tokens, free_token, NULL); g_list_free (tokens); g_free (subst); return retval;; }
false
false
false
false
false
0
mmc_test_profile_trim_perf(struct mmc_test_card *test) { struct mmc_test_area *t = &test->area; unsigned long sz; unsigned int dev_addr; struct timespec ts1, ts2; int ret; if (!mmc_can_trim(test->card)) return RESULT_UNSUP_CARD; if (!mmc_can_erase(test->card)) return RESULT_UNSUP_HOST; for (sz = 512; sz < t->max_sz; sz <<= 1) { dev_addr = t->dev_addr + (sz >> 9); getnstimeofday(&ts1); ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); if (ret) return ret; getnstimeofday(&ts2); mmc_test_print_rate(test, sz, &ts1, &ts2); } dev_addr = t->dev_addr; getnstimeofday(&ts1); ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); if (ret) return ret; getnstimeofday(&ts2); mmc_test_print_rate(test, sz, &ts1, &ts2); return 0; }
false
false
false
false
false
0
read_config(void) { DIR *conf_dir; struct dirent *dent; char *path; conf_dir = opendir(IBV_CONFIG_DIR); if (!conf_dir) { fprintf(stderr, PFX "Warning: couldn't open config directory '%s'.\n", IBV_CONFIG_DIR); return; } while ((dent = readdir(conf_dir))) { struct stat buf; if (asprintf(&path, "%s/%s", IBV_CONFIG_DIR, dent->d_name) < 0) { fprintf(stderr, PFX "Warning: couldn't read config file %s/%s.\n", IBV_CONFIG_DIR, dent->d_name); goto out; } if (stat(path, &buf)) { fprintf(stderr, PFX "Warning: couldn't stat config file '%s'.\n", path); goto next; } if (!S_ISREG(buf.st_mode)) goto next; read_config_file(path); next: free(path); } out: closedir(conf_dir); }
true
true
false
false
true
1
clear_huge_page(struct page *page, unsigned long addr, unsigned int pages_per_huge_page) { int i; if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) { clear_gigantic_page(page, addr, pages_per_huge_page); return; } might_sleep(); for (i = 0; i < pages_per_huge_page; i++) { cond_resched(); clear_user_highpage(page + i, addr + i * PAGE_SIZE); } }
false
false
false
false
false
0
add_class_flag (class_flag_node **rootp, const char *ident, int value) { class_flag_node *root = *rootp; class_flag_node *parent, *node; /* Create the root of the tree if it doesn't exist yet. */ if (NULL == root) { root = XNEW (class_flag_node); root->ident = ""; root->value = 0; root->sibling = NULL; root->child = NULL; root->parent = NULL; *rootp = root; } /* Calling the function with the empty string means we're setting value for the root of the hierarchy. */ if (0 == ident[0]) { root->value = value; return; } /* Find the parent node for this new node. PARENT will either be a class or a package name. Adjust PARENT accordingly. */ parent = find_class_flag_node (root, ident); if (strcmp (ident, parent->ident) == 0) parent->value = value; else { /* Insert new node into the tree. */ node = XNEW (class_flag_node); node->ident = xstrdup (ident); node->value = value; node->child = NULL; node->parent = parent; node->sibling = parent->child; parent->child = node; } }
false
false
false
false
false
0
start_program() { struct stat info; int result; result = stat(program_argv[0], &info); if(result != 0) { debug(D_DEBUG, "couldn't stat %s: %s\n", program_argv[0], strerror(errno)); return 0; } program_mtime = info.st_mtime; program_ctime = info.st_ctime; pid = fork(); if(pid == 0) { setpgid(getpid(), getpid()); execv(program_argv[0], program_argv); exit(1); } else if(pid > 0) { debug(D_DEBUG, "%s started as pid %d", program_argv[0], pid); return 1; } else { debug(D_DEBUG, "unable to fork: %s\n", strerror(errno)); return 0; } }
false
false
false
false
true
1
tryUriConvert(std::string& filename) { void* gLib = dlopen("libglib-2.0.so", RTLD_LAZY); void* gobjectLib = dlopen("libgobject-2.0.so", RTLD_LAZY); void* gioLib = dlopen("libgio-2.0.so", RTLD_LAZY); if (gioLib && gLib && gobjectLib) { FileCreateFunc createFunc = (FileCreateFunc) dlsym(gioLib, "g_file_new_for_uri"); IsNativeFunc nativeFunc = (IsNativeFunc) dlsym(gioLib, "g_file_is_native"); FileGetFunc getFunc = (FileGetFunc) dlsym(gioLib, "g_file_get_path"); InitFunc initFunc = (InitFunc) dlsym(gobjectLib, "g_type_init"); UnrefFunc unrefFunc = (UnrefFunc) dlsym(gobjectLib, "g_object_unref"); FreeFunc freeFunc = (FreeFunc) dlsym(gLib, "g_free"); if (createFunc && nativeFunc && getFunc && freeFunc && initFunc && unrefFunc) { initFunc(); void* pFile = createFunc(filename.c_str()); if (nativeFunc(pFile)) { char* pPath = getFunc(pFile); if (pPath) { filename = pPath; freeFunc(pPath); } } else { cerr << "Not a native file, thumbnailing will likely fail" << endl; } unrefFunc(pFile); } } else { cerr << "Failed to load gio libraries" << endl; } if (gioLib) dlclose(gioLib); if (gobjectLib) dlclose(gobjectLib); if (gLib) dlclose(gLib); }
false
false
false
false
false
0
sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; if (sd->sensor == SENSOR_PAS106) Et_init1(gspca_dev); else Et_init2(gspca_dev); setautogain(gspca_dev); reg_w_val(gspca_dev, ET_RESET_ALL, 0x08); et_video(gspca_dev, 1); /* video on */ return 0; }
false
false
false
false
false
0
OnLeftButtonDown() { int x = this->Interactor->GetEventPosition()[0]; int y = this->Interactor->GetEventPosition()[1]; this->FindPokedRenderer(x, y); this->FindPickedActor(x, y); if (this->CurrentRenderer == NULL || this->InteractionProp == NULL) { return; } this->GrabFocus(this->EventCallbackCommand); if (this->Interactor->GetShiftKey()) { this->StartPan(); } else if (this->Interactor->GetControlKey()) { this->StartSpin(); } else { this->StartRotate(); } }
false
false
false
false
false
0
activate_back_or_forward_menu_item (GtkMenuItem *menu_item, NemoWindow *window, gboolean back) { int index; g_assert (GTK_IS_MENU_ITEM (menu_item)); index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "user_data")); nemo_window_back_or_forward (window, back, index, should_open_in_new_tab ()); }
false
false
false
false
false
0
browseModule(mod,all) Module mod; Bool all; { /* include all names in scope in the module? */ List exports = resolveImportList(mod, DOTDOT, FALSE); Printf("module %s where\n",textToStr(module(mod).text)); if (all) { List all_names = dupList(module(mod).names); mapProc(browseName,rev(all_names)); } else { mapProc(browseEntity,exports); } }
false
false
false
false
false
0
g_strconcat (const gchar *string1, ...) { gsize l; va_list args; gchar *s; gchar *concat; gchar *ptr; if (!string1) return NULL; l = 1 + strlen (string1); va_start (args, string1); s = va_arg (args, gchar*); while (s) { l += strlen (s); s = va_arg (args, gchar*); } va_end (args); concat = g_new (gchar, l); ptr = concat; ptr = g_stpcpy (ptr, string1); va_start (args, string1); s = va_arg (args, gchar*); while (s) { ptr = g_stpcpy (ptr, s); s = va_arg (args, gchar*); } va_end (args); return concat; }
false
false
false
false
false
0
add_bracket () { int gauge; if (importflag != 0) return; gauge = 10 + (boxgap * mark.h / 600 * mark.w / 600); add_struct (mark.x, mark.y, mark.x + gauge, mark.y, 0, 0, 0, 1, curpen); add_struct (mark.x, mark.y, mark.x, mark.y + mark.h, 0, 0, 0, 1, curpen); add_struct (mark.x, mark.y + mark.h, mark.x + gauge, mark.y + mark.h, 0, 0, 0, 1, curpen); add_struct (mark.x + mark.w - gauge, mark.y, mark.x + mark.w, mark.y, 0, 0, 0, 1, curpen); add_struct (mark.x + mark.w, mark.y, mark.x + mark.w, mark.y + mark.h, 0, 0, 0, 1, curpen); add_struct (mark.x + mark.w - gauge, mark.y + mark.h, mark.x + mark.w, mark.y + mark.h, 0, 0, 0, 1, curpen); FreePix (); CreatePix (); Display_Mol (); }
false
false
false
false
false
0
IsJFPFile(FileHelper * fh) { char firstbyte; fhReset(fh); firstbyte = fhReadNextChar(fh); if (firstbyte < 124 || firstbyte > 126) return FALSE; if ((fhReadNextChar(fh) == '\0')) return TRUE; else return FALSE; }
false
false
false
false
false
0
folder_have_mailbox (void) { GList *cur; for (cur = folder_list; cur != NULL; cur = g_list_next(cur)) { Folder *folder = FOLDER(cur->data); if (folder->inbox && folder->outbox) return TRUE; } return FALSE; }
false
false
false
false
false
0
parse_config(const char *filename) { char line[MAX_LINE], *p; FILE *f; struct match *list = NULL; struct match **ep = &list; struct match *m; if (!filename) filename = syslinux_config_file(); f = fopen(filename, "r"); if (!f) return list; while (fgets(line, sizeof line, f)) { p = skipspace(line); if (!looking_at(p, "#")) continue; p = skipspace(p + 1); if (!looking_at(p, "dev")) continue; p = skipspace(p + 3); m = malloc(sizeof(struct match)); if (!m) continue; memset(m, 0, sizeof *m); m->rid_max = 0xff; for (;;) { p = skipspace(p); if (looking_at(p, "did")) { p = get_did(p + 3, &m->did, &m->did_mask); } else if (looking_at(p, "sid")) { p = get_did(p + 3, &m->sid, &m->sid_mask); } else if (looking_at(p, "rid")) { p = get_rid_range(p + 3, &m->rid_min, &m->rid_max); } else { char *e; e = strchr(p, '\n'); if (*e) *e = '\0'; e = strchr(p, '\r'); if (*e) *e = '\0'; m->filename = strdup(p); if (!m->filename) m->did = -1; break; /* Done with this line */ } } dprintf("DEV DID %08x/%08x SID %08x/%08x RID %02x-%02x CMD %s\n", m->did, m->did_mask, m->sid, m->sid_mask, m->rid_min, m->rid_max, m->filename); *ep = m; ep = &m->next; } return list; }
false
false
false
false
true
1
option_color_command(int argc, const char *argv[]) { struct line_info *info; if (argc != 3 && argc != 4) { config_msg = "Wrong number of arguments given to color command"; return ERR; } info = get_line_info(argv[0]); if (!info) { if (!string_enum_compare(argv[0], "main-delim", strlen("main-delim"))) { info = get_line_info("delimiter"); } else if (!string_enum_compare(argv[0], "main-date", strlen("main-date"))) { info = get_line_info("date"); } else if (!string_enum_compare(argv[0], "main-author", strlen("main-author"))) { info = get_line_info("author"); } else { config_msg = "Unknown color name"; return ERR; } } if (set_color(&info->fg, argv[1]) == ERR || set_color(&info->bg, argv[2]) == ERR) { config_msg = "Unknown color"; return ERR; } if (argc == 4 && set_attribute(&info->attr, argv[3]) == ERR) { config_msg = "Unknown attribute"; return ERR; } return OK; }
false
false
false
false
false
0
f_setpos(argvars, rettv) typval_T *argvars; typval_T *rettv; { pos_T pos; int fnum; char_u *name; rettv->vval.v_number = -1; name = get_tv_string_chk(argvars); if (name != NULL) { if (list2fpos(&argvars[1], &pos, &fnum) == OK) { if (--pos.col < 0) pos.col = 0; if (name[0] == '.' && name[1] == NUL) { /* set cursor */ if (fnum == curbuf->b_fnum) { curwin->w_cursor = pos; check_cursor(); rettv->vval.v_number = 0; } else EMSG(_(e_invarg)); } else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) { /* set mark */ if (setmark_pos(name[1], &pos, fnum) == OK) rettv->vval.v_number = 0; } else EMSG(_(e_invarg)); } } }
false
false
false
false
false
0
computeVertexStat ( BipolarPointer p ) { DLVertex& v = (*this)[p]; bool pos = isPositive(p); // this vertex is already processed if ( v.isProcessed(pos) ) return; // in case of cycle: mark concept as such if ( v.isVisited(pos) ) { v.setInCycle(pos); return; } v.setVisited(pos); // ensure that the statistic is gather for all sub-concepts of the expression switch ( v.Type() ) { case dtAnd: // check all the conjuncts case dtSplitConcept: for ( DLVertex::const_iterator q = v.begin(), q_end = v.end(); q < q_end; ++q ) computeVertexStat ( *q, pos ); break; case dtProj: if ( !pos ) // ~Proj -- nothing to do break; // fallthrough case dtName: case dtForall: case dtChoose: case dtLE: // check a single referenced concept computeVertexStat ( v.getC(), pos ); break; default: // nothing to do break; } v.setProcessed(pos); // here all the necessary statistics is gathered -- use it in the init updateVertexStat(p); }
false
false
false
false
false
0
bt_ctf_field_sequence_serialize(struct bt_ctf_field *field, struct ctf_stream_pos *pos) { size_t i; int ret = 0; struct bt_ctf_field_sequence *sequence = container_of( field, struct bt_ctf_field_sequence, parent); for (i = 0; i < sequence->elements->len; i++) { ret = bt_ctf_field_serialize( g_ptr_array_index(sequence->elements, i), pos); if (ret) { goto end; } } end: return ret; }
false
false
false
false
false
0
gap_story_render_debug_print_maskdef_elem(GapStoryRenderMaskDefElem *maskdef_elem, gint l_idx) { if(maskdef_elem) { printf("\n ===== maskdef_elem start ============ \n" ); printf(" [%d] record_type : %d\n", (int)l_idx, (int)maskdef_elem->record_type ); printf(" [%d] mask_name : ", (int)l_idx); if(maskdef_elem->mask_name) { printf("%s\n", maskdef_elem->mask_name );} else { printf ("(null)\n"); } printf(" [%d] mask_vidhand : %d\n", (int)l_idx, (int)maskdef_elem->mask_vidhand ); printf(" [%d] frame_count : %d\n", (int)l_idx, (int)maskdef_elem->frame_count ); printf(" [%d] flip_request : %d\n", (int)l_idx, (int)maskdef_elem->flip_request ); if(maskdef_elem->mask_vidhand) { printf("Storyboard list for this maskdef_elem:\n" ); gap_story_render_debug_print_framerange_list(maskdef_elem->mask_vidhand->frn_list, -1); } printf("\n ===== maskdef_elem end ============ \n" ); } }
false
false
false
false
false
0
scsi_prep_fn(struct request_queue *q, struct request *req) { struct scsi_device *sdev = q->queuedata; struct scsi_cmnd *cmd; int ret; ret = scsi_prep_state_check(sdev, req); if (ret != BLKPREP_OK) goto out; cmd = scsi_get_cmd_from_req(sdev, req); if (unlikely(!cmd)) { ret = BLKPREP_DEFER; goto out; } ret = scsi_setup_cmnd(sdev, req); out: return scsi_prep_return(q, req, ret); }
false
false
false
false
false
0
rfb_decoder_state_wait_for_security (RfbDecoder * decoder) { /* * Version 3.3 The server decides the security type and sends a single word * * The security-type may only take the value 0, 1 or 2. A value of 0 means that the * connection has failed and is followed by a string giving the reason, as described * above. */ if (IS_VERSION_3_3 (decoder)) { rfb_decoder_read (decoder, 4); decoder->security_type = RFB_GET_UINT32 (decoder->data); GST_DEBUG ("security = %d", decoder->security_type); g_return_val_if_fail (decoder->security_type < 3, FALSE); g_return_val_if_fail (decoder->security_type != SECURITY_FAIL, rfb_decoder_state_reason (decoder)); } else { /* \TODO Add behavoir for the rfb 3.7 and 3.8 servers */ GST_WARNING ("Other versions are not yet supported"); } switch (decoder->security_type) { case SECURITY_NONE: GST_DEBUG ("Security type is None"); if (IS_VERSION_3_8 (decoder)) { decoder->state = rfb_decoder_state_security_result; } else { decoder->state = rfb_decoder_state_send_client_initialisation; } break; case SECURITY_VNC: /* * VNC authentication is to be used and protocol data is to be sent unencrypted. The * server sends a random 16-byte challenge */ GST_DEBUG ("Security type is VNC Authentication"); /* VNC Authentication can't be used if the password is not set */ if (!decoder->password) { GST_WARNING ("VNC Authentication can't be used if the password is not set"); return FALSE; } rfb_decoder_read (decoder, 16); vncEncryptBytes ((unsigned char *) decoder->data, decoder->password); rfb_decoder_send (decoder, decoder->data, 16); GST_DEBUG ("Encrypted challenge send to server"); decoder->state = rfb_decoder_state_security_result; break; default: GST_WARNING ("Security type is not known"); return FALSE; break; } return TRUE; }
false
false
false
false
false
0
mono_metadata_generic_inst_hash (gconstpointer data) { const MonoGenericInst *ginst = (const MonoGenericInst *) data; guint hash = 0; int i; for (i = 0; i < ginst->type_argc; ++i) { hash *= 13; hash += mono_metadata_type_hash (ginst->type_argv [i]); } return hash ^ (ginst->is_open << 8); }
false
false
false
false
false
0
gst_stream_synchronizer_src_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstStreamSynchronizer *self = GST_STREAM_SYNCHRONIZER (parent); gboolean ret = FALSE; GST_LOG_OBJECT (pad, "Handling event %s: %" GST_PTR_FORMAT, GST_EVENT_TYPE_NAME (event), event); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_QOS:{ gdouble proportion; GstClockTimeDiff diff; GstClockTime timestamp; gint64 running_time_diff = -1; GstStream *stream; gst_event_parse_qos (event, NULL, &proportion, &diff, &timestamp); gst_event_unref (event); GST_STREAM_SYNCHRONIZER_LOCK (self); stream = gst_pad_get_element_private (pad); if (stream) running_time_diff = stream->segment.base; GST_STREAM_SYNCHRONIZER_UNLOCK (self); if (running_time_diff == -1) { GST_WARNING_OBJECT (pad, "QOS event before group start"); goto out; } if (timestamp < running_time_diff) { GST_DEBUG_OBJECT (pad, "QOS event from previous group"); goto out; } GST_LOG_OBJECT (pad, "Adjusting QOS event: %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT " = %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp), GST_TIME_ARGS (running_time_diff), GST_TIME_ARGS (timestamp - running_time_diff)); timestamp -= running_time_diff; /* That case is invalid for QoS events */ if (diff < 0 && -diff > timestamp) { GST_DEBUG_OBJECT (pad, "QOS event from previous group"); ret = TRUE; goto out; } event = gst_event_new_qos (GST_QOS_TYPE_UNDERFLOW, proportion, diff, timestamp); break; } default: break; } ret = gst_pad_event_default (pad, parent, event); out: return ret; }
false
false
false
false
false
0
make_args(int argc, char **argv, intmax_t seed) { if (*argv && !strncmp("--", *argv, 3)) { argc--; argv++; } const char **args = malloc((argc+6)*sizeof(*args)); int i = 0; args[i++] = atc_cmd; if (seed != -1) { static char buf[30]; sprintf(buf, "%jd", seed); args[i++] = "-r"; args[i++] = buf; } if (game) { args[i++] = "-g"; args[i++] = game; } for (;;) { if (!(args[i++] = *(argv++))) return args; } }
false
false
false
false
false
0
PyvtkMath_AreBoundsInitialized(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "AreBoundsInitialized"); double temp0[6]; double save0[6]; const int size0 = 6; PyObject *result = NULL; if (ap.CheckArgCount(1) && ap.GetArray(temp0, size0)) { ap.SaveArray(temp0, save0, size0); int tempr = vtkMath::AreBoundsInitialized(temp0); if (ap.ArrayHasChanged(temp0, save0, size0) && !ap.ErrorOccurred()) { ap.SetArray(0, temp0, size0); } if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; }
false
false
false
false
false
0
forward_page_function (gint current_page, glNewLabelDialog *this) { gchar *name; lglTemplate *template; const lglTemplateFrame *frame; gdouble w, h; switch (current_page) { case TEMPLATE_PAGE_NUM: name = gl_media_select_get_name (GL_MEDIA_SELECT (this->priv->combo)); if ( name != NULL ) { template = lgl_db_lookup_template_from_name (name); frame = (lglTemplateFrame *)template->frames->data; lgl_template_frame_get_size (frame, &w, &h); if ( w == h ) { /* Skip rotate page for square and circular labels. */ return CONFIRM_PAGE_NUM; } } return ROTATE_PAGE_NUM; case ROTATE_PAGE_NUM: return CONFIRM_PAGE_NUM; case CONFIRM_PAGE_NUM: default: return -1; } return -1; }
false
false
false
false
false
0
send_to_channel (MsgChannel *c) const { Msg::send_to_channel (c); *c << (uint32_t) job->language(); *c << job->jobID(); if (IS_PROTOCOL_30(c)) *c << job->remoteFlags(); else { if (job->compilerName().find("clang") != string::npos) { // Hack for compilerwrapper. std::list<std::string> flags = job->remoteFlags(); flags.push_front("clang"); *c << flags; } else *c << job->remoteFlags(); } *c << job->restFlags(); *c << job->environmentVersion(); *c << job->targetPlatform(); if (IS_PROTOCOL_30(c)) *c << remote_compiler_name(); }
false
false
false
false
false
0
apcmaster_status(StonithPlugin *s) { struct pluginDevice* ms; int rc; ERRIFNOTCONFIGED(s,S_OOPS); ms = (struct pluginDevice*) s; if ((rc = MSRobustLogin(ms) != S_OK)) { LOG(PIL_CRIT, "Cannot log into %s.", ms->idinfo); return(rc); } /* Expect ">" */ SEND(ms->wrfd, "\033\r"); EXPECT(ms->rdfd, Prompt, 5); return(MSLogout(ms)); }
true
true
false
false
false
1
updateHashChain(unsigned short* hashchain, int* hashhead, int* hashval, size_t pos, int hash, unsigned windowSize) { unsigned wpos = pos % windowSize; hashval[wpos] = hash; if(hashhead[hash] != -1) hashchain[wpos] = hashhead[hash]; hashhead[hash] = wpos; }
false
false
false
false
false
0