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
sq_newclass(HSQUIRRELVM v,SQBool hasbase) { SQClass *baseclass = NULL; if(hasbase) { SQObjectPtr &base = stack_get(v,-1); if(type(base) != OT_CLASS) return sq_throwerror(v,_SC("invalid base type")); baseclass = _class(base); } SQClass *newclass = SQClass::Create(_ss(v), baseclass); if(baseclass) v->Pop(); v->Push(newclass); return SQ_OK; }
false
false
false
false
false
0
ov5642_s_power(struct v4l2_subdev *sd, int on) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); struct ov5642 *priv = to_ov5642(client); int ret; if (!on) return soc_camera_power_off(&client->dev, ssdd, priv->clk); ret = soc_camera_power_on(&client->dev, ssdd, priv->clk); if (ret < 0) return ret; ret = ov5642_write_array(client, ov5642_default_regs_init); if (!ret) ret = ov5642_set_resolution(sd); if (!ret) ret = ov5642_write_array(client, ov5642_default_regs_finalise); return ret; }
false
false
false
false
false
0
tp_call_stream_set_sending_async (TpCallStream *self, gboolean send, GAsyncReadyCallback callback, gpointer user_data) { GSimpleAsyncResult *result; g_return_if_fail (TP_IS_CALL_STREAM (self)); result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, tp_call_stream_set_sending_async); tp_cli_call_stream_call_set_sending (self, -1, send, generic_async_cb, result, g_object_unref, G_OBJECT (self)); }
false
false
false
false
false
0
StripSlash(char *topdest,unsigned char *source) { char *dest; int englen; unsigned char *parse = source; if(*parse != '/'){ topdest = '\0'; return 1; } parse=strrchr(source, '/'); if(parse<&source[2]){ fprintf(stderr,"Error: english part too short\n"); fprintf(stderr,"%s\n", source); return 1; } englen=parse- source - 1; strncpy(topdest, &source[1], parse- source - 1); topdest[englen]='\0'; /* we've copied the relavant part over to topdest. Now rewrite * in-place */ dest=topdest; dest=strchr(dest, '/'); while(dest!=NULL){ *dest=':'; dest=strchr(dest, '/'); } return 0; }
false
true
false
false
false
1
tracker_writeback_module_get (const gchar *name) { static GHashTable *modules = NULL; TrackerWritebackModule *module; g_return_val_if_fail (name != NULL, NULL); if (G_UNLIKELY (!modules)) { modules = g_hash_table_new (g_str_hash, g_str_equal); } module = g_hash_table_lookup (modules, name); if (G_UNLIKELY (!module)) { module = g_object_new (TRACKER_TYPE_WRITEBACK_MODULE, NULL); g_type_module_set_name (G_TYPE_MODULE (module), name); module->name = g_strdup (name); g_hash_table_insert (modules, module->name, module); } if (!g_type_module_use (G_TYPE_MODULE (module))) { return NULL; } return module; }
false
false
false
false
false
0
paint_inset_box_shadow_to_cairo_context (StThemeNode *node, StShadow *shadow_spec, cairo_t *cr, cairo_path_t *shadow_outline) { cairo_surface_t *shadow_surface; cairo_pattern_t *shadow_pattern; double extents_x1, extents_y1, extents_x2, extents_y2; double shrunk_extents_x1, shrunk_extents_y1, shrunk_extents_x2, shrunk_extents_y2; gboolean fill_exterior; g_assert (shadow_spec != NULL); g_assert (shadow_outline != NULL); /* Create the pattern used to create the inset shadow; as the shadow * should be drawn as if everything outside the outline was opaque, * we use a temporary surface to draw the background as a solid shape, * which is inverted when creating the shadow pattern. */ /* First we need to find the size of the temporary surface */ path_extents (shadow_outline, &extents_x1, &extents_y1, &extents_x2, &extents_y2); /* Shrink the extents by the spread, and offset */ shrunk_extents_x1 = extents_x1 + shadow_spec->xoffset + shadow_spec->spread; shrunk_extents_y1 = extents_y1 + shadow_spec->yoffset + shadow_spec->spread; shrunk_extents_x2 = extents_x2 + shadow_spec->xoffset - shadow_spec->spread; shrunk_extents_y2 = extents_y2 + shadow_spec->yoffset - shadow_spec->spread; if (shrunk_extents_x1 >= shrunk_extents_x2 || shrunk_extents_y1 >= shrunk_extents_x2) { /* Shadow occupies entire area within border */ shadow_pattern = cairo_pattern_create_rgb (0., 0., 0.); fill_exterior = FALSE; } else { /* Bounds of temporary surface */ int surface_x = floor (shrunk_extents_x1); int surface_y = floor (shrunk_extents_y1); int surface_width = ceil (shrunk_extents_x2) - surface_x; int surface_height = ceil (shrunk_extents_y2) - surface_y; /* Center of the original path */ double x_center = (extents_x1 + extents_x2) / 2; double y_center = (extents_y1 + extents_y2) / 2; cairo_pattern_t *pattern; cairo_t *temp_cr; cairo_matrix_t matrix; shadow_surface = cairo_image_surface_create (CAIRO_FORMAT_A8, surface_width, surface_height); temp_cr = cairo_create (shadow_surface); /* Match the coordinates in the temporary context to the parent context */ cairo_translate (temp_cr, - surface_x, - surface_y); /* Shadow offset */ cairo_translate (temp_cr, shadow_spec->xoffset, shadow_spec->yoffset); /* Scale the path around the center to match the shrunk bounds */ cairo_translate (temp_cr, x_center, y_center); cairo_scale (temp_cr, (shrunk_extents_x2 - shrunk_extents_x1) / (extents_x2 - extents_x1), (shrunk_extents_y2 - shrunk_extents_y1) / (extents_y2 - extents_y1)); cairo_translate (temp_cr, - x_center, - y_center); cairo_append_path (temp_cr, shadow_outline); cairo_fill (temp_cr); cairo_destroy (temp_cr); pattern = cairo_pattern_create_for_surface (shadow_surface); cairo_surface_destroy (shadow_surface); /* The pattern needs to be offset back to coordinates in the parent context */ cairo_matrix_init_translate (&matrix, - surface_x, - surface_y); cairo_pattern_set_matrix (pattern, &matrix); shadow_pattern = _st_create_shadow_cairo_pattern (shadow_spec, pattern); fill_exterior = TRUE; cairo_pattern_destroy (pattern); } paint_shadow_pattern_to_cairo_context (shadow_spec, shadow_pattern, fill_exterior, cr, shadow_outline, NULL); cairo_pattern_destroy (shadow_pattern); }
false
false
false
false
false
0
Curl_pgrsDone(struct connectdata *conn) { int rc; struct SessionHandle *data = conn->data; data->progress.lastshow=0; rc = Curl_pgrsUpdate(conn); /* the final (forced) update */ if(rc) return rc; if(!(data->progress.flags & PGRS_HIDE) && !data->progress.callback) /* only output if we don't use a progress callback and we're not * hidden */ fprintf(data->set.err, "\n"); data->progress.speeder_c = 0; /* reset the progress meter display */ return 0; }
false
false
false
false
false
0
usb6fire_midi_out_drain(struct snd_rawmidi_substream *alsa_sub) { struct midi_runtime *rt = alsa_sub->rmidi->private_data; int retry = 0; while (rt->out && retry++ < 100) msleep(10); }
false
false
false
false
false
0
cb_uri_type_changed_cb( GtkComboBoxText* cb ) { GtkWidget* dialog; FileAccessWindow* faw; const gchar* type; g_return_if_fail( cb != NULL ); dialog = gtk_widget_get_toplevel( GTK_WIDGET(cb) ); g_return_if_fail( dialog != NULL ); faw = g_object_get_data( G_OBJECT(dialog), "FileAccessWindow" ); g_return_if_fail( faw != NULL ); type = gtk_combo_box_text_get_active_text( cb ); set_widget_sensitivity_for_uri_type( faw, type ); }
false
false
false
false
false
0
glarea_button_press (GtkWidget* widget, GdkEventButton* event) { int x = event->x; int y = event->y; if (event->button == 1) { /* Mouse button 1 was engaged */ g_print ("Button 1 press (%d, %d)\n", x, y); return TRUE; } if (event->button == 2) { /* Mouse button 2 was engaged */ g_print ("Button 2 press (%d, %d)\n", x, y); return TRUE; } return FALSE; }
false
false
false
false
false
0
fs_rtp_bitrate_adapter_get_suggested_caps (FsRtpBitrateAdapter *self) { GstCaps *allowed_caps; GstCaps *wanted_caps; GstCaps *caps = NULL; GST_OBJECT_LOCK (self); if (self->caps) caps = gst_caps_ref (self->caps); GST_OBJECT_UNLOCK (self); if (!caps) return NULL; allowed_caps = gst_pad_get_allowed_caps (self->sinkpad); if (!allowed_caps) { gst_caps_unref (caps); return NULL; } wanted_caps = gst_caps_intersect_full (caps, allowed_caps, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (allowed_caps); gst_caps_unref (caps); return gst_caps_fixate (wanted_caps); }
false
false
false
false
false
0
gss_context_query_attributes(OM_uint32 *minor_status, gss_const_ctx_id_t context_handle, const gss_OID attribute, void *data, size_t len) { if (minor_status) *minor_status = 0; if (gss_oid_equal(GSS_C_ATTR_STREAM_SIZES, attribute)) { memset(data, 0, len); return GSS_S_COMPLETE; } return GSS_S_FAILURE; }
false
false
false
false
false
0
bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl, u32 line_speed) { struct bnx2x *bp = params->bp; u8 port = params->port; u32 init_crd, crd; u32 count = 1000; /* Disable port */ REG_WR(bp, PBF_REG_DISABLE_NEW_TASK_PROC_P0 + port*4, 0x1); /* Wait for init credit */ init_crd = REG_RD(bp, PBF_REG_P0_INIT_CRD + port*4); crd = REG_RD(bp, PBF_REG_P0_CREDIT + port*8); DP(NETIF_MSG_LINK, "init_crd 0x%x crd 0x%x\n", init_crd, crd); while ((init_crd != crd) && count) { usleep_range(5000, 10000); crd = REG_RD(bp, PBF_REG_P0_CREDIT + port*8); count--; } crd = REG_RD(bp, PBF_REG_P0_CREDIT + port*8); if (init_crd != crd) { DP(NETIF_MSG_LINK, "BUG! init_crd 0x%x != crd 0x%x\n", init_crd, crd); return -EINVAL; } if (flow_ctrl & BNX2X_FLOW_CTRL_RX || line_speed == SPEED_10 || line_speed == SPEED_100 || line_speed == SPEED_1000 || line_speed == SPEED_2500) { REG_WR(bp, PBF_REG_P0_PAUSE_ENABLE + port*4, 1); /* Update threshold */ REG_WR(bp, PBF_REG_P0_ARB_THRSH + port*4, 0); /* Update init credit */ init_crd = 778; /* (800-18-4) */ } else { u32 thresh = (ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD)/16; REG_WR(bp, PBF_REG_P0_PAUSE_ENABLE + port*4, 0); /* Update threshold */ REG_WR(bp, PBF_REG_P0_ARB_THRSH + port*4, thresh); /* Update init credit */ switch (line_speed) { case SPEED_10000: init_crd = thresh + 553 - 22; break; default: DP(NETIF_MSG_LINK, "Invalid line_speed 0x%x\n", line_speed); return -EINVAL; } } REG_WR(bp, PBF_REG_P0_INIT_CRD + port*4, init_crd); DP(NETIF_MSG_LINK, "PBF updated to speed %d credit %d\n", line_speed, init_crd); /* Probe the credit changes */ REG_WR(bp, PBF_REG_INIT_P0 + port*4, 0x1); usleep_range(5000, 10000); REG_WR(bp, PBF_REG_INIT_P0 + port*4, 0x0); /* Enable port */ REG_WR(bp, PBF_REG_DISABLE_NEW_TASK_PROC_P0 + port*4, 0x0); return 0; }
false
false
false
false
false
0
turn_off_all_playing_notes() { int i, chan, pitch; for (i = 0; i < 2048; i++) if (notechan[i] >= 0) { chan = i / 128; pitch = i % 128; copy_noteoff(chan, pitch, 0); } }
false
false
false
false
false
0
FreeExternalsList(Externals *externals, int n) { int i; for (i = 0; i < n; i++) if (externals[i]) FreeExternals(externals[i]); DXFree((Pointer)externals); return OK; }
false
false
false
false
false
0
ndc_2_dc_and_project ( s4DVertex *dest,s4DVertex *source, u32 vIn ) const { u32 g; for ( g = 0; g != vIn; g += 2 ) { if ( (dest[g].flag & VERTEX4D_PROJECTED ) == VERTEX4D_PROJECTED ) continue; dest[g].flag = source[g].flag | VERTEX4D_PROJECTED; const f32 w = source[g].Pos.w; const f32 iw = core::reciprocal ( w ); // to device coordinates dest[g].Pos.x = iw * ( source[g].Pos.x * Transformation [ ETS_CLIPSCALE ][ 0] + w * Transformation [ ETS_CLIPSCALE ][12] ); dest[g].Pos.y = iw * ( source[g].Pos.y * Transformation [ ETS_CLIPSCALE ][ 5] + w * Transformation [ ETS_CLIPSCALE ][13] ); #ifndef SOFTWARE_DRIVER_2_USE_WBUFFER dest[g].Pos.z = iw * source[g].Pos.z; #endif #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR #ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT dest[g].Color[0] = source[g].Color[0] * iw; #else dest[g].Color[0] = source[g].Color[0]; #endif #endif dest[g].Pos.w = iw; } }
false
false
false
false
false
0
cmd_pls_ignore(struct userrec *u, int idx, char *par) { char *who, s[UHOSTLEN]; unsigned long int expire_time = 0; if (!par[0]) { dprintf(idx, "Usage: +ignore <hostmask> [%%<XdXhXm>] [comment]\n"); return; } who = newsplit(&par); if (par[0] == '%') { char *p, *p_expire; unsigned long int expire_foo; p = newsplit(&par); p_expire = p + 1; while (*(++p) != 0) { switch (tolower(*p)) { case 'd': *p = 0; expire_foo = strtol(p_expire, NULL, 10); if (expire_foo > 365) expire_foo = 365; expire_time += 86400 * expire_foo; p_expire = p + 1; break; case 'h': *p = 0; expire_foo = strtol(p_expire, NULL, 10); if (expire_foo > 8760) expire_foo = 8760; expire_time += 3600 * expire_foo; p_expire = p + 1; break; case 'm': *p = 0; expire_foo = strtol(p_expire, NULL, 10); if (expire_foo > 525600) expire_foo = 525600; expire_time += 60 * expire_foo; p_expire = p + 1; } } } if (!par[0]) par = "requested"; else if (strlen(par) > 65) par[65] = 0; if (strlen(who) > UHOSTMAX - 4) who[UHOSTMAX - 4] = 0; /* Fix missing ! or @ BEFORE continuing */ if (!strchr(who, '!')) { if (!strchr(who, '@')) simple_sprintf(s, "%s!*@*", who); else simple_sprintf(s, "*!%s", who); } else if (!strchr(who, '@')) simple_sprintf(s, "%s@*", who); else strcpy(s, who); if (match_ignore(s)) dprintf(idx, "That already matches an existing ignore.\n"); else { dprintf(idx, "Now ignoring: %s (%s)\n", s, par); addignore(s, dcc[idx].nick, par, expire_time ? now + expire_time : 0L); putlog(LOG_CMDS, "*", "#%s# +ignore %s %s", dcc[idx].nick, s, par); } }
true
true
false
false
false
1
skip_node_characters (char *string, int flag) { register int c, i = 0; int paren_seen = 0; int paren = 0; if (!string) return 0; if (flag == PARSE_NODE_VERBATIM) return strlen (string); /* Handle special case. This is when another function has parsed out the filename component of the node name, and we just want to parse out the nodename proper. In that case, a period at the start of the nodename indicates an empty nodename. */ if (*string == '.') return 0; if (*string == '(') { paren++; paren_seen++; i++; } for (; (c = string[i]); i++) { if (paren) { if (c == '(') paren++; else if (c == ')') paren--; continue; } /* If the character following the close paren is a space or period, then this node name has no more characters associated with it. */ if (c == '\t' || c == ',' || c == INFO_TAGSEP || (!(flag == PARSE_NODE_SKIP_NEWLINES) && (c == '\n')) || ((paren_seen && string[i - 1] == ')') && (c == ' ' || c == '.')) || (flag != PARSE_NODE_START && (c == '.' && ( #if 0 /* This test causes a node name ending in a period, like `This.', not to be found. The trailing . is stripped. This occurs in the jargon file (`I see no X here.' is a node name). */ (!string[i + 1]) || #endif (whitespace_or_newline (string[i + 1])) || (string[i + 1] == ')'))))) break; } return i; }
false
false
false
false
false
0
jdns_server_copy(const jdns_server_t *s) { jdns_server_t *c = jdns_server_new(); if(s->name) c->name = _ustrdup(s->name); c->port = s->port; c->priority = s->priority; c->weight = s->weight; return c; }
false
false
false
false
false
0
buildTree(int loc, unsigned versionNum) { // Allocate the current node and set its symbol RepairTreeNode* root = new RepairTreeNode(associations[loc].getSymbol()); // Keep track of which versions we've processed in order to choose a root (see getNextRootLoc) associations[loc].removeFromVersions(versionNum); unsigned left = associations[loc].getLeft(); unsigned right = associations[loc].getRight(); int lLoc = binarySearch(left, associations, 0, loc); int rLoc = binarySearch(right, associations, 0, loc); if (lLoc == -1) root->setLeftChild(new RepairTreeNode(left)); else root->setLeftChild(buildTree(lLoc, versionNum)); if (rLoc == -1) root->setRightChild(new RepairTreeNode(right)); else root->setRightChild(buildTree(rLoc, versionNum)); return root; }
false
false
false
false
false
0
createPidFile() { bool fRet(false); if (pidFile.open(QIODevice::ReadWrite)) { const QByteArray abPid(pidFile.readAll()); pidFile.close(); const int iPid(abPid.count() == 0 ? 0 : abPid.toInt()); if (!iPid || iPid == ::getpid() || ::kill(iPid, 0) != 0) { if (::setsid() >= 0) { if (pidFile.remove()) { if (pidFile.open(QIODevice::WriteOnly)) { pidFile.write((QString::number(::getpid()) + '\n').toLatin1()); pidFile.close(); fRet = true; } else ::syslog(LOG_CRIT|LOG_DAEMON, "Failed to open pid file: %s", pidFile.fileName().toAscii().constData()); } else ::syslog(LOG_CRIT|LOG_DAEMON, "Failed to unlink pid file: %s", pidFile.fileName().toAscii().constData()); } else ::syslog(LOG_CRIT|LOG_DAEMON, "Failed to set SID: %m"); } else ::syslog(LOG_CRIT|LOG_DAEMON, "There's already a %s running", KEY); } else ::syslog(LOG_CRIT|LOG_DAEMON, "Failed to read pid file %s", pidFile.fileName().toAscii().constData()); return(fRet); }
false
false
false
false
false
0
mpg123_plain_strerror(int errcode) { if(errcode >= 0 && errcode < sizeof(mpg123_error)/sizeof(char*)) return mpg123_error[errcode]; else switch(errcode) { case MPG123_ERR: return "A generic mpg123 error."; case MPG123_DONE: return "Message: I am done with this track."; case MPG123_NEED_MORE: return "Message: Feed me more input data!"; case MPG123_NEW_FORMAT: return "Message: Prepare for a changed audio format (query the new one)!"; default: return "I have no idea - an unknown error code!"; } }
false
false
false
false
false
0
flushtrel() { unsigned nbytes; nbytes = trelbufptr - trelbuf; if (write(trelfd, trelbuf, nbytes) != nbytes) outputerror("cannot write"); trelbufptr = trelbuf; }
false
false
false
false
false
0
ast_sockaddr_is_any(const struct ast_sockaddr *addr) { union { struct sockaddr_storage ss; struct sockaddr_in sin; struct sockaddr_in6 sin6; } tmp_addr = { .ss = addr->ss, }; return (ast_sockaddr_is_ipv4(addr) && (tmp_addr.sin.sin_addr.s_addr == INADDR_ANY)) || (ast_sockaddr_is_ipv6(addr) && IN6_IS_ADDR_UNSPECIFIED(&tmp_addr.sin6.sin6_addr)); }
false
false
false
false
false
0
friends_gtk_account_target_bar_account_created (FriendsGtkAccountTargetBar* self, GeeHashMap* accounts_buttons_map, FriendsAccount* account) { GeeHashMap* _tmp0_; FriendsAccount* _tmp1_; guint _tmp2_; guint _tmp3_; gboolean _tmp4_ = FALSE; FriendsAccount* _tmp7_; FriendsGtkAccountToggleButton* _tmp8_ = NULL; FriendsGtkAccountToggleButton* account_button; GeeHashMap* _tmp9_; FriendsAccount* _tmp10_; guint _tmp11_; guint _tmp12_; FriendsGtkAccountToggleButton* _tmp13_; #line 566 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" g_return_if_fail (self != NULL); #line 566 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" g_return_if_fail (accounts_buttons_map != NULL); #line 566 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" g_return_if_fail (account != NULL); #line 568 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp0_ = accounts_buttons_map; #line 568 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp1_ = account; #line 568 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp2_ = friends_account_get_id (_tmp1_); #line 568 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp3_ = _tmp2_; #line 568 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp4_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, (gpointer) ((guintptr) _tmp3_)); #line 568 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" if (_tmp4_) { #line 2780 "entry.c" GeeHashMap* _tmp5_; FriendsAccount* _tmp6_; #line 570 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp5_ = accounts_buttons_map; #line 570 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp6_ = account; #line 570 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" friends_gtk_account_target_bar_account_updated (self, _tmp5_, _tmp6_); #line 571 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" return; #line 2791 "entry.c" } #line 573 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp7_ = account; #line 573 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp8_ = friends_gtk_account_target_bar_create_button (self, _tmp7_); #line 573 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" account_button = _tmp8_; #line 574 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp9_ = accounts_buttons_map; #line 574 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp10_ = account; #line 574 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp11_ = friends_account_get_id (_tmp10_); #line 574 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp12_ = _tmp11_; #line 574 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _tmp13_ = account_button; #line 574 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" gee_abstract_map_set ((GeeAbstractMap*) _tmp9_, (gpointer) ((guintptr) _tmp12_), _tmp13_); #line 566 "/tmp/buildd/libfriends-0.1.2+14.04.20131108.1/gtk/entry.vala" _g_object_unref0 (account_button); #line 2813 "entry.c" }
false
false
false
false
false
0
ath5k_common_padpos(struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; __le16 frame_control = hdr->frame_control; int padpos = 24; if (ieee80211_has_a4(frame_control)) padpos += ETH_ALEN; if (ieee80211_is_data_qos(frame_control)) padpos += IEEE80211_QOS_CTL_LEN; return padpos; }
false
false
false
false
false
0
mostViolated(ConstraintList &l) { double minSlack = DBL_MAX; Constraint* v=NULL; #ifdef RECTANGLE_OVERLAP_LOGGING ofstream f(LOGFILE,ios::app); f<<"Looking for most violated..."<<endl; #endif ConstraintList::iterator end = l.end(); ConstraintList::iterator deletePoint = end; for(ConstraintList::iterator i=l.begin();i!=end;++i) { Constraint *c=*i; double slack = c->slack(); if(c->equality || slack < minSlack) { minSlack=slack; v=c; deletePoint=i; if(c->equality) break; } } // Because the constraint list is not order dependent we just // move the last element over the deletePoint and resize // downwards. There is always at least 1 element in the // vector because of search. if(deletePoint != end && (minSlack<ZERO_UPPERBOUND||v->equality)) { *deletePoint = l[l.size()-1]; l.resize(l.size()-1); } #ifdef RECTANGLE_OVERLAP_LOGGING f<<" most violated is: "<<*v<<endl; #endif return v; }
false
false
false
true
false
1
ForceSet(v8::Handle<Value> key, v8::Handle<Value> value, v8::PropertyAttribute attribs) { ON_BAILOUT("v8::Object::ForceSet()", return false); ENTER_V8; HandleScope scope; i::Handle<i::JSObject> self = Utils::OpenHandle(this); i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); EXCEPTION_PREAMBLE(); i::Handle<i::Object> obj = i::ForceSetProperty( self, key_obj, value_obj, static_cast<PropertyAttributes>(attribs)); has_pending_exception = obj.is_null(); EXCEPTION_BAILOUT_CHECK(false); return true; }
false
false
false
false
false
0
z(home,file,len,uid,gid,mode) char *home; char *file; int len; int uid; int gid; int mode; { if (chdir(home) == -1) strerr_die4sys(111,FATAL,"unable to switch to ",home,": "); perm("",home,"/",file,S_IFREG,uid,gid,mode); }
false
false
false
false
false
0
compareTo(NamedObject* o){ if ( o->getObjectName() != Float::getClassName() ) return -1; Float* other = (Float*)o; if (value == other->value) return 0; // Returns just -1 or 1 on inequality; doing math might overflow. return value > other->value ? 1 : -1; }
false
false
false
false
false
0
main(int argc, char **argv) { int i, j = 0; FILE *f; if(argc > 1) { if(!(f = fopen(argv[1], "r"))) { perror(argv[1]); return 1; } } else { fprintf(stderr, "usage: bin2c file\n"); return 2; } printf("unsigned char %s_data[] = {\n", argv[1]); while((i = fgetc(f)) != EOF) { i = i & 0xff; if(!j++) { printf(" "); } else { printf(",%s", (j & 7) != 1 ? "" : "\n "); } printf(" 0x%02x", i); } printf("\n};\n"); return 0; }
false
false
false
false
true
1
Insert(TickSample* sample) { if (paused_) return; if (Succ(head_) == tail_) { overflow_ = true; } else { buffer_[head_] = *sample; head_ = Succ(head_); buffer_semaphore_->Signal(); // Tell we have an element. } }
false
false
false
false
false
0
wrapped_length_dervied (krb5_context context, krb5_crypto crypto, size_t data_len) { struct _krb5_encryption_type *et = crypto->et; size_t padsize = et->padsize; size_t res; res = et->confoundersize + data_len; res = (res + padsize - 1) / padsize * padsize; if (et->keyed_checksum) res += et->keyed_checksum->checksumsize; else res += et->checksum->checksumsize; return res; }
false
false
false
false
false
0
get_buffer_lines(buf, start, end, retlist, rettv) buf_T *buf; linenr_T start; linenr_T end; int retlist; typval_T *rettv; { char_u *p; if (retlist && rettv_list_alloc(rettv) == FAIL) return; if (buf == NULL || buf->b_ml.ml_mfp == NULL || start < 0) return; if (!retlist) { if (start >= 1 && start <= buf->b_ml.ml_line_count) p = ml_get_buf(buf, start, FALSE); else p = (char_u *)""; rettv->v_type = VAR_STRING; rettv->vval.v_string = vim_strsave(p); } else { if (end < start) return; if (start < 1) start = 1; if (end > buf->b_ml.ml_line_count) end = buf->b_ml.ml_line_count; while (start <= end) if (list_append_string(rettv->vval.v_list, ml_get_buf(buf, start++, FALSE), -1) == FAIL) break; } }
false
false
false
false
false
0
expand_group(STRLIST input) { STRLIST sl,output=NULL,rover; for(rover=input;rover;rover=rover->next) if(expand_id(rover->d,&output,rover->flags)==0) { /* Didn't find any groups, so use the existing string */ sl=add_to_strlist(&output,rover->d); sl->flags=rover->flags; } return output; }
false
false
false
false
false
0
cpl_table_multiply_columns(cpl_table *table, const char *to_name, const char *from_name) { cpl_column *to_column = cpl_table_find_column_(table, to_name); /* FIXME: Should be const */ cpl_column *from_column = cpl_table_find_column_(table, from_name); return !to_column || !from_column || cpl_column_multiply(to_column, from_column) ? cpl_error_set_where_() : CPL_ERROR_NONE; }
false
false
false
false
false
0
ac_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { struct pcf50633_mbc *mbc = power_supply_get_drvdata(psy); int ret = 0; u8 usblim = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC7) & PCF50633_MBCC7_USB_MASK; switch (psp) { case POWER_SUPPLY_PROP_ONLINE: val->intval = mbc->usb_online && (usblim == PCF50633_MBCC7_USB_1000mA); break; default: ret = -EINVAL; break; } return ret; }
false
false
false
false
false
0
check_loaded_state (GVariant *state) { gboolean loaded, scanned; g_variant_get (state, "(bb)", &loaded, &scanned); if (loaded && scanned) { /* give it a tiny bit longer to populate sources etc. */ g_timeout_add (1500, (GSourceFunc) g_main_loop_quit, mainloop); } }
false
false
false
false
false
0
amitk_objects_count(GList * objects) { gint count; if (objects == NULL) return 0; if (AMITK_IS_OBJECT(objects->data)) count = 1; else count = 0; /* count data sets that are children */ count += amitk_objects_count(AMITK_OBJECT_CHILDREN(objects->data)); /* add this count too the counts from the rest of the objects */ return count+amitk_objects_count(objects->next); }
false
false
false
false
false
0
find_bigpair(BUFHEAD *bufp, int ndx, char *key, int size) { uint16_t *bp; char *p; int ksize; uint16_t bytes; char *kkey; bp = (uint16_t *)bufp->page; p = bufp->page; ksize = size; kkey = key; for (bytes = this->BSIZE - bp[ndx]; bytes <= size && bp[ndx + 1] == PARTIAL_KEY; bytes = this->BSIZE - bp[ndx]) { if (memcmp(p + bp[ndx], kkey, bytes)) return (-2); kkey += bytes; ksize -= bytes; bufp = this->get_buf(bp[ndx + 2], bufp, 0); if (!bufp) return (-3); p = bufp->page; bp = (uint16_t *)p; ndx = 1; } if (bytes != ksize || memcmp(p + bp[ndx], kkey, bytes)) { ++hash_collisions; return (-2); } else return (ndx); }
false
false
false
false
false
0
char_val (gunichar c, gint number_base) { gint result = 0; gunichar _tmp0_ = 0U; gboolean _tmp1_ = FALSE; gint value = 0; gunichar _tmp2_ = 0U; gint _tmp3_ = 0; gint _tmp4_ = 0; gint _tmp5_ = 0; _tmp0_ = c; _tmp1_ = g_unichar_isxdigit (_tmp0_); if (!_tmp1_) { result = -1; return result; } _tmp2_ = c; _tmp3_ = g_unichar_xdigit_value (_tmp2_); value = _tmp3_; _tmp4_ = value; _tmp5_ = number_base; if (_tmp4_ >= _tmp5_) { result = -1; return result; } result = value; return result; }
false
false
false
false
false
0
wield(Entity * entity) { if(entity->getLocation() != m_entity) { error() << "Can't wield an Entity which is not located in the avatar."; return; } Anonymous arguments; arguments->setId(entity->getId()); Wield wield; wield->setFrom(m_entityId); wield->setArgs1(arguments); getConnection()->send(wield); }
false
false
false
false
false
0
THX_upgrade_sv(pTHX_ SV *input) { U8 *p, *end; STRLEN len; if(SvUTF8(input)) return input; p = (U8*)SvPV(input, len); for(end = p + len; p != end; p++) { if(*p & 0x80) { SV *output = sv_mortalcopy(input); sv_utf8_upgrade(output); return output; } } return input; }
false
false
false
false
false
0
pump_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t off, dict_t *dict) { afr_private_t *priv = NULL; priv = this->private; if (!priv->use_afr_in_pump) { STACK_WIND (frame, default_readdirp_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp, fd, size, off, dict); return 0; } afr_readdirp (frame, this, fd, size, off, dict); return 0; }
false
false
false
false
false
0
cciss_getluninfo(ctlr_info_t *h, struct gendisk *disk, void __user *argp) { LogvolInfo_struct luninfo; drive_info_struct *drv = get_drv(disk); if (!argp) return -EINVAL; memcpy(&luninfo.LunID, drv->LunID, sizeof(luninfo.LunID)); luninfo.num_opens = drv->usage_count; luninfo.num_parts = 0; if (copy_to_user(argp, &luninfo, sizeof(LogvolInfo_struct))) return -EFAULT; return 0; }
false
true
false
false
false
1
activateMenuOption (void) { System::getInstance ().removeActiveState (false); System::getInstance ().setActiveState ( new TournamentSetupState (*m_SelectedOption)); }
false
false
false
false
false
0
compress( void *inData, size_t inDataSize, std::vector<unsigned char> &outData) { int ret=0; MRPT_START unsigned long resSize; outData.resize(inDataSize+inDataSize/1000+50); resSize = (unsigned long)outData.size(); ret = ::compress( &outData[0], &resSize, (unsigned char*)inData, (unsigned long)inDataSize ); ASSERT_(ret==Z_OK); outData.resize(resSize); MRPT_END_WITH_CLEAN_UP( \ printf("[zlib] Error code=%i\n",ret);\ ); }
false
false
false
false
false
0
ibus_input_pad_config_get_str (IBusInputPadConfig *config, const gchar *section, const gchar *name, gchar **value_strp) { IBusConfig *ibus_config; GVariant *value = NULL; g_return_val_if_fail (IBUS_IS_INPUT_PAD_CONFIG (config), FALSE); g_return_val_if_fail (config->priv != NULL, FALSE); ibus_config = config->priv->config; if ((value = ibus_config_get_value (ibus_config, section, name)) != NULL) { if (value_strp) { *value_strp = g_variant_dup_string (value, NULL); } g_variant_unref (value); return TRUE; } if (!g_strcmp0 (name, "keyboard_theme")) { if (value_strp) { *value_strp = g_strdup (KEYBOARD_THEME_DEFAULT); } return TRUE; } return FALSE; }
false
false
false
false
false
0
readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) { int inval; int rdcount = 0; /* counts bytes read */ unsigned char *temp = msg->buf; int count = msg->len; const unsigned flags = msg->flags; while (count > 0) { inval = i2c_inb(i2c_adap); if (inval >= 0) { *temp = inval; rdcount++; } else { /* read timed out */ break; } temp++; count--; /* Some SMBus transactions require that we receive the transaction length as the first read byte. */ if (rdcount == 1 && (flags & I2C_M_RECV_LEN)) { if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) { if (!(flags & I2C_M_NO_RD_ACK)) acknak(i2c_adap, 0); dev_err(&i2c_adap->dev, "readbytes: invalid " "block length (%d)\n", inval); return -EPROTO; } /* The original count value accounts for the extra bytes, that is, either 1 for a regular transaction, or 2 for a PEC transaction. */ count += inval; msg->len += inval; } bit_dbg(2, &i2c_adap->dev, "readbytes: 0x%02x %s\n", inval, (flags & I2C_M_NO_RD_ACK) ? "(no ack/nak)" : (count ? "A" : "NA")); if (!(flags & I2C_M_NO_RD_ACK)) { inval = acknak(i2c_adap, count); if (inval < 0) return inval; } } return rdcount; }
false
false
false
false
false
0
force_better_solution(struct isl_tab *tab, __isl_keep isl_vec *sol, int n_op) { int i; isl_ctx *ctx; isl_vec *v = NULL; if (!sol) return -1; for (i = 0; i < n_op; ++i) if (!isl_int_is_zero(sol->el[1 + i])) break; if (i == n_op) { if (isl_tab_mark_empty(tab) < 0) return -1; return 0; } ctx = isl_vec_get_ctx(sol); v = isl_vec_alloc(ctx, 1 + tab->n_var); if (!v) return -1; for (; i >= 0; --i) { v = isl_vec_clr(v); isl_int_set_si(v->el[1 + i], -1); if (add_lexmin_eq(tab, v->el) < 0) goto error; } isl_vec_free(v); return 0; error: isl_vec_free(v); return -1; }
false
false
false
false
false
0
CollectStaticSystemInfo(void) { const char * cp; int fd; int cc; char buf[256]; /* * Get the number of ticks per second. */ ticksPerSecond = sysconf(_SC_CLK_TCK); if (ticksPerSecond <= 0) ticksPerSecond = 100; /* * Get the page size. */ pageSize = sysconf(_SC_PAGESIZE); if (pageSize <= 0) pageSize = 4096; /* * Collect the amount of memory on the system. */ fd = open(PROCDIR "/meminfo", O_RDONLY); if (fd < 0) return; cc = read(fd, buf, sizeof(buf) - 1); (void) close(fd); if (cc <= 0) return; buf[cc] = '\0'; cp = strstr(buf, "MemTotal:"); if (cp == NULL) return; cp += 9; totalMemoryClicks = GetDecimalNumber(&cp) / (pageSize / 1024); /* * Get the starting uptime and time of day. * This will be used to determine the age of processes. */ startUptime = GetUptime(); startTime = time(NULL); }
false
false
false
false
false
0
Map_Task(Pointer taskPtr) { MapTask *task; Object map; task = (MapTask *)taskPtr; if (DXGetObjectClass(task->map) == CLASS_INTERPOLATOR) { if (! (map = DXCopy(task->map, COPY_STRUCTURE))) return ERROR; } else map = task->map; DXReference(map); if (ERROR == DXMap(task->target, map, task->srcComponent, task->dstComponent)) { DXDelete(map); return ERROR; } DXDelete(map); return OK; }
false
false
false
false
false
0
coerce_to_uvec (int type, SCM obj) { if (is_uvec (type, obj)) return obj; else if (scm_is_pair (obj)) return list_to_uvec (type, obj); else if (scm_is_generalized_vector (obj)) { scm_t_array_handle handle; size_t len = scm_c_generalized_vector_length (obj), i; SCM uvec = alloc_uvec (type, len); scm_array_get_handle (uvec, &handle); for (i = 0; i < len; i++) scm_array_handle_set (&handle, i, scm_c_generalized_vector_ref (obj, i)); scm_array_handle_release (&handle); return uvec; } else scm_wrong_type_arg_msg (NULL, 0, obj, "list or generalized vector"); }
false
false
false
false
false
0
SetMaskEditAtts(PG_MaskEdit *Widget, const char **atts, ParseUserData_t *XMLParser) { char *c; Widget->SetMask(PG_Layout::GetParamStr(atts, "mask")); c = PG_Layout::GetParamStr(atts, "spacer"); if (c[0] != 0) Widget->SetSpacer(c[0]); return(SetLineEditAtts(Widget, atts, XMLParser)); }
false
false
false
false
false
0
tps80031_power_req_config(struct device *parent, struct tps80031_regulator *ri, struct tps80031_regulator_platform_data *tps80031_pdata) { int ret = 0; if (ri->rinfo->preq_bit < 0) goto skip_pwr_req_config; ret = tps80031_ext_power_req_config(parent, ri->ext_ctrl_flag, ri->rinfo->preq_bit, ri->rinfo->state_reg, ri->rinfo->trans_reg); if (ret < 0) { dev_err(ri->dev, "ext powerreq config failed, err = %d\n", ret); return ret; } skip_pwr_req_config: if (tps80031_pdata->ext_ctrl_flag & TPS80031_PWR_ON_ON_SLEEP) { ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->trans_reg, TPS80031_TRANS_SLEEP_ON, TPS80031_TRANS_SLEEP_MASK); if (ret < 0) { dev_err(ri->dev, "Reg 0x%02x update failed, e %d\n", ri->rinfo->trans_reg, ret); return ret; } } return ret; }
false
false
false
false
false
0
invalid_cmdline(const fr_args & args, int err, const char * fmt, ...) { va_list vargs; va_start(vargs, fmt); err = ff_vlog(FC_ERROR, err, fmt, vargs); va_end(vargs); ff_log(FC_NOTICE, 0, "Try `%s --help' for more information", args.program_name); /* mark error as reported */ return err ? err : -EINVAL; }
false
false
false
false
false
0
parse_merge_opt(struct merge_options *o, const char *s) { if (!s || !*s) return -1; if (!strcmp(s, "ours")) o->recursive_variant = MERGE_RECURSIVE_OURS; else if (!strcmp(s, "theirs")) o->recursive_variant = MERGE_RECURSIVE_THEIRS; else if (!strcmp(s, "subtree")) o->subtree_shift = ""; else if (!prefixcmp(s, "subtree=")) o->subtree_shift = s + strlen("subtree="); else if (!strcmp(s, "patience")) o->xdl_opts |= XDF_PATIENCE_DIFF; else if (!strcmp(s, "ignore-space-change")) o->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE; else if (!strcmp(s, "ignore-all-space")) o->xdl_opts |= XDF_IGNORE_WHITESPACE; else if (!strcmp(s, "ignore-space-at-eol")) o->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL; else if (!strcmp(s, "renormalize")) o->renormalize = 1; else if (!strcmp(s, "no-renormalize")) o->renormalize = 0; else if (!prefixcmp(s, "rename-threshold=")) { const char *score = s + strlen("rename-threshold="); if ((o->rename_score = parse_rename_score(&score)) == -1 || *score != 0) return -1; } else return -1; return 0; }
false
false
false
false
false
0
GetMsg( short id ) const { if ( (id >= 0) && ((short)cat.size() > id) ) return cat[id].c_str(); return 0; }
false
false
false
false
false
0
handleNewgen (action, arg) char *action, *arg; { int i=0; while (i < actionCount) { if (actionList[i++] == VADM_NEWGEN) { sprintf (stMessage, "You already requested the new generation -- '%s' ignored.", action); stLog (stMessage, ST_LOG_WARNING); return (0); } } return (addToActionList (action, VADM_NEWGEN)); }
false
false
false
false
false
0
goa_editable_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GoaEditableLabel *e = GOA_EDITABLE_LABEL (object); switch (prop_id) { case PROP_TEXT: goa_editable_label_set_text (e, g_value_get_string (value)); break; case PROP_EDITABLE: goa_editable_label_set_editable (e, g_value_get_boolean (value)); break; case PROP_WEIGHT: goa_editable_label_set_weight (e, g_value_get_int (value)); break; case PROP_WEIGHT_SET: e->priv->weight_set = g_value_get_boolean (value); break; case PROP_SCALE: goa_editable_label_set_scale (e, g_value_get_double (value)); break; case PROP_SCALE_SET: e->priv->scale_set = g_value_get_boolean (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
false
false
false
false
false
0
il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout) { const int interval = 10; /* microseconds */ int t = 0; do { if ((il_rd(il, addr) & mask) == mask) return t; udelay(interval); t += interval; } while (t < timeout); return -ETIMEDOUT; }
false
false
false
false
false
0
sample_discrete() { const long int BLOCK_SIZE = 16384; long int samples[BLOCK_SIZE]; double* probs; size_t num_probs; plfit_walker_alias_sampler_t sampler; long int i, n; double u; if (opts.num_samples <= 0) return 0; if (opts.kappa > 0) { /* Power law with exponential cutoff. We use Walker's algorithm here. */ /* Construct probability array */ num_probs = 100000; probs = (double*)calloc(num_probs, sizeof(double)); if (probs == 0) { fprintf(stderr, "Not enough memory\n"); return 7; } #ifdef _OPENMP #pragma omp parallel for private(i) #endif for (i = 0; i < num_probs; i++) { probs[i] = exp(-i / opts.kappa) * pow((i + opts.xmin) / opts.xmin, -opts.gamma); } /* Initialize sampler */ if (plfit_walker_alias_sampler_init(&sampler, probs, num_probs)) { fprintf(stderr, "Error while initializing sampler\n"); free(probs); return 9; } /* Free "probs" array */ free(probs); /* Sampling */ while (opts.num_samples > 0) { n = opts.num_samples > BLOCK_SIZE ? BLOCK_SIZE : opts.num_samples; plfit_walker_alias_sampler_sample(&sampler, samples, n, &rng); for (i = 0; i < n; i++) { printf("%ld\n", (long int)(samples[i] + opts.offset + opts.xmin)); } opts.num_samples -= n; } /* Destroy sampler */ plfit_walker_alias_sampler_destroy(&sampler); } else { /* Pure power law */ for (i = 0; i < opts.num_samples; i++) { u = plfit_rzeta(opts.xmin, opts.gamma, &rng) + opts.offset; printf("%.8f\n", u); } } return 0; }
false
false
false
false
false
0
compat_radeon_mem_alloc(struct file *file, unsigned int cmd, unsigned long arg) { drm_radeon_mem_alloc32_t req32; drm_radeon_mem_alloc_t __user *request; if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; request = compat_alloc_user_space(sizeof(*request)); if (!access_ok(VERIFY_WRITE, request, sizeof(*request)) || __put_user(req32.region, &request->region) || __put_user(req32.alignment, &request->alignment) || __put_user(req32.size, &request->size) || __put_user((int __user *)(unsigned long)req32.region_offset, &request->region_offset)) return -EFAULT; return drm_ioctl(file, DRM_IOCTL_RADEON_ALLOC, (unsigned long)request); }
false
false
false
false
false
0
innconf_parse(struct config_group *group) { unsigned int i, j; bool *bool_ptr; long *signed_number_ptr; unsigned long *unsigned_number_ptr; const char *char_ptr; char **string; const struct vector *vector_ptr; struct vector **list; struct innconf *config; config = xmalloc(sizeof(struct innconf)); for (i = 0; i < ARRAY_SIZE(config_table); i++) switch (config_table[i].type) { case TYPE_BOOLEAN: bool_ptr = CONF_BOOL(config, config_table[i].location); if (!config_param_boolean(group, config_table[i].name, bool_ptr)) *bool_ptr = config_table[i].defaults.boolean; break; case TYPE_NUMBER: signed_number_ptr = CONF_NUMBER(config, config_table[i].location); if (!config_param_signed_number(group, config_table[i].name, signed_number_ptr)) *signed_number_ptr = config_table[i].defaults.signed_number; break; case TYPE_UNUMBER: unsigned_number_ptr = CONF_UNUMBER(config, config_table[i].location); if (!config_param_unsigned_number(group, config_table[i].name, unsigned_number_ptr)) *unsigned_number_ptr = config_table[i].defaults.unsigned_number; break; case TYPE_STRING: if (!config_param_string(group, config_table[i].name, &char_ptr)) char_ptr = config_table[i].defaults.string; string = CONF_STRING(config, config_table[i].location); *string = (char_ptr == NULL) ? NULL : xstrdup(char_ptr); break; case TYPE_LIST: /* vector_ptr contains the value taken from inn.conf or the * default value from config_table; *list points to the inn.conf * structure in memory for this parameter. * We have to do a deep copy of vector_ptr because, like char_ptr, * it is freed by config_free() called by other parts of INN. */ if (!config_param_list(group, config_table[i].name, &vector_ptr)) vector_ptr = config_table[i].defaults.list; list = CONF_LIST(config, config_table[i].location); *list = vector_new(); if (vector_ptr != NULL && vector_ptr->strings != NULL) { vector_resize(*list, vector_ptr->count); for (j = 0; j < vector_ptr->count; j++) { if (vector_ptr->strings[j] != NULL) { vector_add(*list, vector_ptr->strings[j]); } } } break; default: die("internal error: invalid type in row %u of config table", i); break; } return config; }
false
false
false
false
false
0
getUserAny(const String& key) const { // Allocate attributes on demand. if (mAttributes == NULL) mAttributes = OGRE_NEW UserObjectBindings::Attributes; // Case map doesn't exists. if (mAttributes->mUserObjectsMap == NULL) return msEmptyAny; UserObjectsMapConstIterator it = mAttributes->mUserObjectsMap->find(key); // Case user data found. if (it != mAttributes->mUserObjectsMap->end()) { return it->second; } return msEmptyAny; }
false
false
false
false
false
0
parse_next_regex(char *ptr) { assert(ptr != NULL); /* Continue until the end of the line, or a " followed by a space, a * blank character, or \0. */ while ((*ptr != '"' || (!isblank(*(ptr + 1)) && *(ptr + 1) != '\0')) && *ptr != '\0') ptr++; assert(*ptr == '"' || *ptr == '\0'); if (*ptr == '\0') { rcfile_error( N_("Regex strings must begin and end with a \" character")); return NULL; } /* Null-terminate and advance ptr. */ *ptr++ = '\0'; while (isblank(*ptr)) ptr++; return ptr; }
false
false
false
false
false
0
to_fn(XtPointer closure, XtIntervalId *id) { torec_t *torec; torec_t *prev = NULL; voidfn *fn = NULL; for (torec = torecs; torec != NULL; torec = torec->next) { if (torec->id == *id) { break; } prev = torec; } if (torec != NULL) { /* Remember the record. */ fn = torec->fn; /* Free the record. */ if (prev != NULL) prev->next = torec->next; else torecs = torec->next; XtFree((XtPointer)torec); /* Call the function. */ (*fn)(); } }
false
false
false
false
false
0
gst_rtp_mux_change_state (GstElement * element, GstStateChange transition) { GstRTPMux *rtp_mux; rtp_mux = GST_RTP_MUX (element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: break; case GST_STATE_CHANGE_READY_TO_PAUSED: gst_rtp_mux_ready_to_paused (rtp_mux); break; case GST_STATE_CHANGE_PAUSED_TO_READY: break; default: break; } return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); }
false
false
false
false
false
0
VSsetexternalfile(int32 vkey, const char *filename, int32 offset) { CONSTR(FUNC, "VSsetexternalfile"); int32 ret_value = SUCCEED; vsinstance_t *w; VDATA *vs; intn status; if(!filename || offset < 0) HGOTO_ERROR(DFE_ARGS, FAIL); if (HAatom_group(vkey)!=VSIDGROUP) HGOTO_ERROR(DFE_ARGS, FAIL); /* locate vs's index in vstab */ if (NULL == (w = (vsinstance_t *) HAatom_object(vkey))) HGOTO_ERROR(DFE_NOVS, FAIL); vs = w->vs; if (vs->access != 'w') HGOTO_ERROR(DFE_BADACC, FAIL); if (FAIL == vexistvs(vs->f, vs->oref)) HGOTO_ERROR(DFE_NOVS, FAIL); if(!w->ref) HGOTO_ERROR(DFE_NOVS, FAIL); /* no need to give a length since the element already exists */ /* The Data portion of a Vdata is always stored in linked blocks. */ /* So, use the special tag */ status = (intn)HXcreate(vs->f, (uint16)VSDATATAG, (uint16) w->ref, filename, offset, (int32)0); if(status != FAIL) { if((vs->aid != 0) && (vs->aid != FAIL)) Hendaccess(vs->aid); vs->aid = status; } else ret_value = FAIL; done: if(ret_value == FAIL) { /* Error condition cleanup */ } /* end if */ /* Normal function cleanup */ return ret_value; }
false
false
false
false
false
0
icx_add_audience(Icx_ctx *ctx, char *audience) { if (ctx->audience == NULL) ctx->audience = dsvec_init(NULL, sizeof(char *)); /* XXX should check syntax here instead of in icx_is_in_audience() */ dsvec_add_ptr(ctx->audience, strdup(audience)); return(0); }
false
false
false
false
false
0
GetFileNames(const std::string & seriesUID, bool recursive) { if ( m_Directory == "" ) { itkExceptionMacro (<< "No directory defined!"); } // Make sure the SeriesUIDs are up to date. This may require the // directory to be scanned. this->GetSeriesUIDs(recursive); // Get the filenames, sorted by user selection. m_FileNames.clear(); if ( m_SeriesUIDs.size() > 0 ) { switch ( m_FileNameSortingOrder ) { case SortByImageNumber: { std::vector< std::pair< int, std::string > > iSortedFileNames; m_AppHelper.GetSliceNumberFilenamePairs(seriesUID, iSortedFileNames, m_Ascending); for ( std::vector< std::pair< int, std::string > >::iterator it = iSortedFileNames.begin(); it != iSortedFileNames.end(); ++it ) { m_FileNames.push_back( ( *it ).second ); } } break; case SortBySliceLocation: { std::vector< std::pair< float, std::string > > fSortedFileNames; m_AppHelper.GetSliceLocationFilenamePairs(seriesUID, fSortedFileNames, m_Ascending); for ( std::vector< std::pair< float, std::string > >::iterator it = fSortedFileNames.begin(); it != fSortedFileNames.end(); ++it ) { m_FileNames.push_back( ( *it ).second ); } } break; case SortByImagePositionPatient: { std::vector< std::pair< float, std::string > > fSortedFileNames; m_AppHelper.GetImagePositionPatientFilenamePairs(seriesUID, fSortedFileNames, m_Ascending); for ( std::vector< std::pair< float, std::string > >::iterator it = fSortedFileNames.begin(); it != fSortedFileNames.end(); ++it ) { m_FileNames.push_back( ( *it ).second ); } } break; } } return m_FileNames; }
false
false
false
false
false
0
Skip_transparent ( unsigned char *& pixels, // 8-bit pixel scan line. int x, // X-coord. of pixel to start with. int w // Remaining width of pixels. ) { while (x < w && *pixels == 255) { x++; pixels++; } return (x); }
false
false
false
false
false
0
AacEncEncode(AAC_ENCODER *aacEnc, /*!< an encoder handle */ Word16 *timeSignal, /*!< BLOCKSIZE*nChannels audio samples, interleaved */ const UWord8 *ancBytes, /*!< pointer to ancillary data bytes */ Word16 *numAncBytes, /*!< number of ancillary Data Bytes */ UWord8 *outBytes, /*!< pointer to output buffer (must be large MINBITS_COEF/8*MAX_CHANNELS bytes) */ VO_U32 *numOutBytes /*!< number of bytes in output buffer after processing */ ) { ELEMENT_INFO *elInfo = &aacEnc->elInfo; Word16 globUsedBits; Word16 ancDataBytes, ancDataBytesLeft; ancDataBytes = ancDataBytesLeft = *numAncBytes; /* init output aac data buffer and length */ aacEnc->hBitStream = CreateBitBuffer(&aacEnc->bitStream, outBytes, *numOutBytes); /* psychoacoustic process */ psyMain(aacEnc->config.nChannelsOut, elInfo, timeSignal, &aacEnc->psyKernel.psyData[elInfo->ChannelIndex[0]], &aacEnc->psyKernel.tnsData[elInfo->ChannelIndex[0]], &aacEnc->psyKernel.psyConfLong, &aacEnc->psyKernel.psyConfShort, &aacEnc->psyOut.psyOutChannel[elInfo->ChannelIndex[0]], &aacEnc->psyOut.psyOutElement, aacEnc->psyKernel.pScratchTns, aacEnc->config.sampleRate); /* adjust bitrate and frame length */ AdjustBitrate(&aacEnc->qcKernel, aacEnc->config.bitRate, aacEnc->config.sampleRate); /* quantization and coding process */ QCMain(&aacEnc->qcKernel, &aacEnc->qcKernel.elementBits, &aacEnc->qcKernel.adjThr.adjThrStateElem, &aacEnc->psyOut.psyOutChannel[elInfo->ChannelIndex[0]], &aacEnc->psyOut.psyOutElement, &aacEnc->qcOut.qcChannel[elInfo->ChannelIndex[0]], &aacEnc->qcOut.qcElement, elInfo->nChannelsInEl, min(ancDataBytesLeft,ancDataBytes)); ancDataBytesLeft = ancDataBytesLeft - ancDataBytes; globUsedBits = FinalizeBitConsumption(&aacEnc->qcKernel, &aacEnc->qcOut); /* write bitstream process */ WriteBitstream(aacEnc->hBitStream, *elInfo, &aacEnc->qcOut, &aacEnc->psyOut, &globUsedBits, ancBytes, aacEnc->psyKernel.sampleRateIdx); updateBitres(&aacEnc->qcKernel, &aacEnc->qcOut); /* write out the bitstream */ *numOutBytes = GetBitsAvail(aacEnc->hBitStream) >> 3; return 0; }
false
false
false
false
false
0
channel_request_xon(PLCI *plci, byte ch) { DIVA_CAPI_ADAPTER *a = plci->adapter; if (a->ch_flow_control[ch] & N_CH_XOFF) { a->ch_flow_control[ch] |= N_XON_REQ; a->ch_flow_control[ch] &= ~N_CH_XOFF; a->ch_flow_control[ch] &= ~N_XON_CONNECT_IND; } }
false
false
false
false
false
0
clock (void) { struct timespec ts; /* clock_gettime shouldn't fail here since CLOCK_PROCESS_CPUTIME_ID is supported since 2.6.12. Check the return value anyway in case the kernel barfs on us for some reason. */ if (__glibc_unlikely (__clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &ts) != 0)) return (clock_t) -1; return (ts.tv_sec * CLOCKS_PER_SEC + ts.tv_nsec / (1000000000 / CLOCKS_PER_SEC)); }
false
false
false
false
false
0
panasonic_prop(struct exifprop *prop, struct exiftags *t) { switch (prop->tag) { /* White balance. */ case 0x0003: prop->override = EXIF_T_WHITEBAL; break; /* White balance adjust (unknown). */ case 0x0023: exifstralloc(&prop->str, 10); snprintf(prop->str, 9, "%d", (int16_t)prop->value); break; /* Flash bias. */ case 0x0024: exifstralloc(&prop->str, 10); snprintf(prop->str, 9, "%.2f EV", (int16_t)prop->value / 3.0); break; /* Contrast. */ case 0x002c: prop->override = EXIF_T_CONTRAST; break; } }
false
false
false
false
false
0
run(const gchar *name , gint n_params , const GimpParam *param , gint *nreturn_vals , GimpParam **return_vals) { static GimpParam values[1]; GimpRunMode run_mode; GimpPDBStatusType status = GIMP_PDB_SUCCESS; gint32 image_id; gint32 drawable_id; char *filtermacro_file; gint32 l_rc; const char *l_env; *nreturn_vals = 1; *return_vals = values; l_rc = 0; l_env = g_getenv("GAP_DEBUG"); if(l_env != NULL) { if((*l_env != 'n') && (*l_env != 'N')) gap_debug = 1; } run_mode = param[0].data.d_int32; image_id = param[1].data.d_image; drawable_id = param[2].data.d_drawable; filtermacro_file = NULL; INIT_I18N (); if(gap_debug) fprintf(stderr, "\n\ngap_filter_main: debug name = %s\n", name); if (strcmp (name, GAP_FMACNAME_PLUG_IN_NAME_FMAC) == 0) { if (run_mode == GIMP_RUN_INTERACTIVE) { l_rc = gap_fmac_dialog(run_mode, image_id, drawable_id); } else { if (run_mode == GIMP_RUN_NONINTERACTIVE) { if(n_params == 4) { filtermacro_file = param[3].data.d_string; if(filtermacro_file == NULL) { status = GIMP_PDB_CALLING_ERROR; } } else { status = GIMP_PDB_CALLING_ERROR; } } else { gint l_len; l_len = gimp_get_data_size(GAP_FMACNAME_PLUG_IN_NAME_FMAC); if(l_len > 0) { filtermacro_file = g_malloc0(l_len); gimp_get_data(GAP_FMACNAME_PLUG_IN_NAME_FMAC, filtermacro_file); } else { filtermacro_file = g_strdup("\0"); } } if(status == GIMP_PDB_SUCCESS) { l_rc = gap_fmac_execute(run_mode, image_id, drawable_id , filtermacro_file , NULL /* filtermacro_file2 */ , 1.0 /* current_step */ , 1 /* total_steps */ ); } } } else { status = GIMP_PDB_CALLING_ERROR; } if(l_rc < 0) { status = GIMP_PDB_EXECUTION_ERROR; } if (run_mode != GIMP_RUN_NONINTERACTIVE) gimp_displays_flush(); values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; }
false
false
false
false
false
0
get(MSAttrValueList& avList_) { //This is replacement to the get method in MSTypeEntryField as //code there is too generic and resulting code is incorrect MSString buf; MSFloat value; value=(double)_incrementValue; value.format(buf,MSFloat::Decimal4); avList_<<MSAttrValue("incrementValue",buf); if (_minimumValue.isSet()==MSTrue) { value=(double)_minimumValue; value.format(buf,MSFloat::Decimal4); avList_<<MSAttrValue("minimumValue",buf); } else avList_<<MSAttrValue("minimumValue",""); if (_maximumValue.isSet()==MSTrue) { value=(double)_maximumValue; value.format(buf,MSFloat::Decimal4); avList_<<MSAttrValue("maximumValue",buf); } else avList_<<MSAttrValue("maximumValue",""); return MSEntryFieldPlus::get(avList_); }
false
false
false
false
false
0
check_function_arguments (const_tree fntype, int nargs, tree *argarray) { /* Check for null being passed in a pointer argument that must be non-null. We also need to do this if format checking is enabled. */ if (warn_nonnull) check_function_nonnull (TYPE_ATTRIBUTES (fntype), nargs, argarray); /* Check for errors in format strings. */ if (warn_format || warn_suggest_attribute_format) check_function_format (TYPE_ATTRIBUTES (fntype), nargs, argarray); if (warn_format) check_function_sentinel (fntype, nargs, argarray); }
false
false
false
false
false
0
StoreRsaKey(DecodedCert* cert) { int length; word32 read = cert->srcIdx; if (GetSequence(cert->source, &cert->srcIdx, &length) < 0) return ASN_PARSE_E; read = cert->srcIdx - read; length += read; while (read--) cert->srcIdx--; cert->pubKeySize = length; cert->publicKey = cert->source + cert->srcIdx; cert->srcIdx += length; return 0; }
false
true
false
false
true
1
apol_mls_range_create_from_mls_range(const apol_mls_range_t * range) { apol_mls_range_t *r; if ((r = apol_mls_range_create()) == NULL) { return NULL; } if (range != NULL && ((r->low = apol_mls_level_create_from_mls_level(range->low)) == NULL || (r->high = apol_mls_level_create_from_mls_level(range->high)) == NULL)) { apol_mls_range_destroy(&r); return NULL; } return r; }
false
false
false
false
false
0
EmitInstruction(const MachineInstr *MI) { MipsTargetStreamer &TS = getTargetStreamer(); TS.forbidModuleDirective(); if (MI->isDebugValue()) { SmallString<128> Str; raw_svector_ostream OS(Str); PrintDebugValueComment(MI, OS); return; } // If we just ended a constant pool, mark it as such. if (InConstantPool && MI->getOpcode() != Mips::CONSTPOOL_ENTRY) { OutStreamer->EmitDataRegion(MCDR_DataRegionEnd); InConstantPool = false; } if (MI->getOpcode() == Mips::CONSTPOOL_ENTRY) { // CONSTPOOL_ENTRY - This instruction represents a floating //constant pool in the function. The first operand is the ID# // for this instruction, the second is the index into the // MachineConstantPool that this is, the third is the size in // bytes of this constant pool entry. // The required alignment is specified on the basic block holding this MI. // unsigned LabelId = (unsigned)MI->getOperand(0).getImm(); unsigned CPIdx = (unsigned)MI->getOperand(1).getIndex(); // If this is the first entry of the pool, mark it. if (!InConstantPool) { OutStreamer->EmitDataRegion(MCDR_DataRegion); InConstantPool = true; } OutStreamer->EmitLabel(GetCPISymbol(LabelId)); const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPIdx]; if (MCPE.isMachineConstantPoolEntry()) EmitMachineConstantPoolValue(MCPE.Val.MachineCPVal); else EmitGlobalConstant(MF->getDataLayout(), MCPE.Val.ConstVal); return; } MachineBasicBlock::const_instr_iterator I = MI->getIterator(); MachineBasicBlock::const_instr_iterator E = MI->getParent()->instr_end(); do { // Do any auto-generated pseudo lowerings. if (emitPseudoExpansionLowering(*OutStreamer, &*I)) continue; if (I->getOpcode() == Mips::PseudoReturn || I->getOpcode() == Mips::PseudoReturn64 || I->getOpcode() == Mips::PseudoIndirectBranch || I->getOpcode() == Mips::PseudoIndirectBranch64) { emitPseudoIndirectBranch(*OutStreamer, &*I); continue; } // The inMips16Mode() test is not permanent. // Some instructions are marked as pseudo right now which // would make the test fail for the wrong reason but // that will be fixed soon. We need this here because we are // removing another test for this situation downstream in the // callchain. // if (I->isPseudo() && !Subtarget->inMips16Mode() && !isLongBranchPseudo(I->getOpcode())) llvm_unreachable("Pseudo opcode found in EmitInstruction()"); MCInst TmpInst0; MCInstLowering.Lower(&*I, TmpInst0); EmitToStreamer(*OutStreamer, TmpInst0); } while ((++I != E) && I->isInsideBundle()); // Delay slot check }
false
false
false
false
false
0
hw_rule_rate(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { struct snd_bebob_stream_formation *formations = rule->private; struct snd_interval *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); const struct snd_interval *c = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS); struct snd_interval t = { .min = UINT_MAX, .max = 0, .integer = 1 }; unsigned int i; for (i = 0; i < SND_BEBOB_STRM_FMT_ENTRIES; i++) { /* entry is invalid */ if (formations[i].pcm == 0) continue; if (!snd_interval_test(c, formations[i].pcm)) continue; t.min = min(t.min, snd_bebob_rate_table[i]); t.max = max(t.max, snd_bebob_rate_table[i]); } return snd_interval_refine(r, &t); }
false
false
false
false
false
0
GetNextPtr(void *NextInBucketPtr) { // The low bit is set if this is the pointer back to the bucket. if (reinterpret_cast<intptr_t>(NextInBucketPtr) & 1) return 0; return static_cast<FoldingSetImpl::Node*>(NextInBucketPtr); }
false
false
false
false
false
0
ab_port_leave(struct team *team, struct team_port *port) { if (ab_priv(team)->active_port == port) { RCU_INIT_POINTER(ab_priv(team)->active_port, NULL); team_option_inst_set_change(ab_priv(team)->ap_opt_inst_info); } }
false
false
false
false
false
0
testing_util_pop_log_hooks (void) { guint i; LogHook *hook; GPtrArray *unhit_hooks; g_return_if_fail (log_hooks != NULL); if (log_hooks->len == 0) return; unhit_hooks = g_ptr_array_new (); for (i = 0; i < log_hooks->len; ++i) { hook = g_ptr_array_index (log_hooks, i); if (!hook->hit) g_ptr_array_add (unhit_hooks, hook); } if (unhit_hooks->len == 1) { gchar *msg; hook = g_ptr_array_index (unhit_hooks, 0); msg = g_strdup_printf ("Log hook was not triggered: '%s'", hook->pattern); /* Use the default log handler directly to avoid recurse complaints */ g_log_default_handler (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, msg, NULL); abort (); } else if (unhit_hooks->len > 1) { /* Use the default log handler directly to avoid recurse complaints */ g_log_default_handler (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "Log hooks were not triggered:\n", NULL); for (i = 0; i < unhit_hooks->len; ++i) { hook = g_ptr_array_index (unhit_hooks, i); g_print ("\t'%s'\n", hook->pattern); } abort (); } g_ptr_array_unref (unhit_hooks); g_ptr_array_set_size (log_hooks, 0); }
false
false
false
false
false
0
lu(int count) { Polynomial *buf=this->dup(0,0,count); Polynomial *ret=buf->_lu(buf); if(!ret) delete buf; return(ret); }
false
false
false
false
false
0
getpix (image, bitpix, w, h, bzero, bscale, x, y) char *image; /* Image array as 1-D vector */ int bitpix; /* FITS bits per pixel */ /* 16 = short, -16 = unsigned short, 32 = int */ /* -32 = float, -64 = double */ int w; /* Image width in pixels */ int h; /* Image height in pixels */ double bzero; /* Zero point for pixel scaling */ double bscale; /* Scale factor for pixel scaling */ int x; /* Zero-based horizontal pixel number */ int y; /* Zero-based vertical pixel number */ { short *im2; int *im4; unsigned short *imu; float *imr; double *imd; double dpix; /* Return 0 if coordinates are not inside image */ if (x < 0 || x >= w) return (0.0); if (y < 0 || y >= h) return (0.0); /* Extract pixel from appropriate type of array */ switch (bitpix) { case 8: dpix = (double) image[(y*w) + x]; break; case 16: im2 = (short *)image; dpix = (double) im2[(y*w) + x]; break; case 32: im4 = (int *)image; dpix = (double) im4[(y*w) + x]; break; case -16: imu = (unsigned short *)image; dpix = (double) imu[(y*w) + x]; break; case -32: imr = (float *)image; dpix = (double) imr[(y*w) + x]; break; case -64: imd = (double *)image; dpix = imd[(y*w) + x]; break; default: dpix = 0.0; } return (bzero + (bscale * dpix)); }
false
false
false
false
false
0
rtl8169_set_speed_xmii(struct net_device *dev, u8 autoneg, u16 speed, u8 duplex) { struct rtl8169_private *tp = netdev_priv(dev); void *ioaddr = tp->mmio_addr; int auto_nego, giga_ctrl; DBGP ( "rtl8169_set_speed_xmii\n" ); auto_nego = mdio_read(ioaddr, MII_ADVERTISE); auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_100FULL); giga_ctrl = mdio_read(ioaddr, MII_CTRL1000); giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF); if (autoneg == AUTONEG_ENABLE) { auto_nego |= (ADVERTISE_10HALF | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_100FULL); giga_ctrl |= ADVERTISE_1000FULL | ADVERTISE_1000HALF; } else { if (speed == SPEED_10) auto_nego |= ADVERTISE_10HALF | ADVERTISE_10FULL; else if (speed == SPEED_100) auto_nego |= ADVERTISE_100HALF | ADVERTISE_100FULL; else if (speed == SPEED_1000) giga_ctrl |= ADVERTISE_1000FULL | ADVERTISE_1000HALF; if (duplex == DUPLEX_HALF) auto_nego &= ~(ADVERTISE_10FULL | ADVERTISE_100FULL); if (duplex == DUPLEX_FULL) auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_100HALF); /* This tweak comes straight from Realtek's driver. */ if ((speed == SPEED_100) && (duplex == DUPLEX_HALF) && ((tp->mac_version == RTL_GIGA_MAC_VER_13) || (tp->mac_version == RTL_GIGA_MAC_VER_16))) { auto_nego = ADVERTISE_100HALF | ADVERTISE_CSMA; } } /* The 8100e/8101e/8102e do Fast Ethernet only. */ if ((tp->mac_version == RTL_GIGA_MAC_VER_07) || (tp->mac_version == RTL_GIGA_MAC_VER_08) || (tp->mac_version == RTL_GIGA_MAC_VER_09) || (tp->mac_version == RTL_GIGA_MAC_VER_10) || (tp->mac_version == RTL_GIGA_MAC_VER_13) || (tp->mac_version == RTL_GIGA_MAC_VER_14) || (tp->mac_version == RTL_GIGA_MAC_VER_15) || (tp->mac_version == RTL_GIGA_MAC_VER_16)) { if ((giga_ctrl & (ADVERTISE_1000FULL | ADVERTISE_1000HALF))) { DBG ( "PHY does not support 1000Mbps.\n" ); } giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF); } auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; if ((tp->mac_version == RTL_GIGA_MAC_VER_11) || (tp->mac_version == RTL_GIGA_MAC_VER_12) || (tp->mac_version >= RTL_GIGA_MAC_VER_17)) { /* * Wake up the PHY. * Vendor specific (0x1f) and reserved (0x0e) MII registers. */ mdio_write(ioaddr, 0x1f, 0x0000); mdio_write(ioaddr, 0x0e, 0x0000); } tp->phy_auto_nego_reg = auto_nego; tp->phy_1000_ctrl_reg = giga_ctrl; mdio_write(ioaddr, MII_ADVERTISE, auto_nego); mdio_write(ioaddr, MII_CTRL1000, giga_ctrl); mdio_write(ioaddr, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); return 0; }
false
false
false
false
false
0
initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * cblk, struct scsi_cmnd * cmnd) { /* Create corresponding SCB */ struct scatterlist *sglist; struct sg_entry *sg; /* Pointer to SG list */ int i, nseg; long total_len; dma_addr_t dma_addr; /* Fill in the command headers */ cblk->post = i91uSCBPost; /* i91u's callback routine */ cblk->srb = cmnd; cblk->opcode = ExecSCSI; cblk->flags = SCF_POST; /* After SCSI done, call post routine */ cblk->target = cmnd->device->id; cblk->lun = cmnd->device->lun; cblk->ident = cmnd->device->lun | DISC_ALLOW; cblk->flags |= SCF_SENSE; /* Turn on auto request sense */ /* Map the sense buffer into bus memory */ dma_addr = dma_map_single(&host->pci_dev->dev, cmnd->sense_buffer, SENSE_SIZE, DMA_FROM_DEVICE); cblk->senseptr = (u32)dma_addr; cblk->senselen = SENSE_SIZE; cmnd->SCp.ptr = (char *)(unsigned long)dma_addr; cblk->cdblen = cmnd->cmd_len; /* Clear the returned status */ cblk->hastat = 0; cblk->tastat = 0; /* Command the command */ memcpy(cblk->cdb, cmnd->cmnd, cmnd->cmd_len); /* Set up tags */ if (cmnd->device->tagged_supported) { /* Tag Support */ cblk->tagmsg = SIMPLE_QUEUE_TAG; /* Do simple tag only */ } else { cblk->tagmsg = 0; /* No tag support */ } /* todo handle map_sg error */ nseg = scsi_dma_map(cmnd); BUG_ON(nseg < 0); if (nseg) { dma_addr = dma_map_single(&host->pci_dev->dev, &cblk->sglist[0], sizeof(struct sg_entry) * TOTAL_SG_ENTRY, DMA_BIDIRECTIONAL); cblk->bufptr = (u32)dma_addr; cmnd->SCp.dma_handle = dma_addr; cblk->sglen = nseg; cblk->flags |= SCF_SG; /* Turn on SG list flag */ total_len = 0; sg = &cblk->sglist[0]; scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) { sg->data = cpu_to_le32((u32)sg_dma_address(sglist)); sg->len = cpu_to_le32((u32)sg_dma_len(sglist)); total_len += sg_dma_len(sglist); ++sg; } cblk->buflen = (scsi_bufflen(cmnd) > total_len) ? total_len : scsi_bufflen(cmnd); } else { /* No data transfer required */ cblk->buflen = 0; cblk->sglen = 0; } }
false
true
false
false
false
1
slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer) { int i; buf->base_buffer = base_buffer; buf->line_count = line_count; buf->line_width = line_width; buf->data_count = max_allocated_lines; buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count); buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines); for(i = 0; i < max_allocated_lines; i++){ buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width); } buf->data_stack_top = max_allocated_lines - 1; }
false
false
false
false
false
0
add_time_slot(struct work_queue *q, timestamp_t start, timestamp_t duration, int type, timestamp_t * accumulated_time, struct list *time_list) { struct time_slot *ts; int count, effective_workers; if(!time_list) return; ts = (struct time_slot *) malloc(sizeof(struct time_slot)); if(ts) { ts->start = start; ts->duration = duration; ts->type = type; *accumulated_time += ts->duration; list_push_tail(time_list, ts); } else { debug(D_WQ, "Failed to record time slot of type %d.", type); } // trim time list effective_workers = get_num_of_effective_workers(q); count = MAX(MIN_TIME_LIST_SIZE, effective_workers); while(list_size(time_list) > count) { ts = list_pop_head(time_list); *accumulated_time -= ts->duration; free(ts); } }
false
false
false
false
false
0
Is(uchar c) { int chunk_index = c >> 13; switch (chunk_index) { case 0: return LookupPredicate(kConnectorPunctuationTable0, kConnectorPunctuationTable0Size, c); case 1: return LookupPredicate(kConnectorPunctuationTable1, kConnectorPunctuationTable1Size, c); case 7: return LookupPredicate(kConnectorPunctuationTable7, kConnectorPunctuationTable7Size, c); default: return false; } }
false
false
false
false
false
0
FunctionGetLength(Object* object, void*) { bool found_it = false; JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); if (!found_it) return Smi::FromInt(0); // Check if already compiled. if (!function->is_compiled()) { // If the function isn't compiled yet, the length is not computed // correctly yet. Compile it now and return the right length. HandleScope scope; Handle<SharedFunctionInfo> shared(function->shared()); if (!CompileLazyShared(shared, KEEP_EXCEPTION)) { return Failure::Exception(); } return Smi::FromInt(shared->length()); } else { return Smi::FromInt(function->shared()->length()); } }
false
false
false
false
false
0
ipmi_fru_parse_dump_obj (ipmi_fru_parse_ctx_t ctx, fiid_obj_t obj, const char *debug_hdr) { assert (ctx); assert (ctx->magic == IPMI_FRU_PARSE_CTX_MAGIC); assert (obj); assert (debug_hdr); if (ctx->flags & IPMI_FRU_PARSE_FLAGS_DEBUG_DUMP) { char hdrbuf[DEBUG_UTIL_HDR_BUFLEN]; debug_hdr_str (DEBUG_UTIL_TYPE_NONE, DEBUG_UTIL_DIRECTION_NONE, DEBUG_UTIL_FLAGS_DEFAULT, debug_hdr, hdrbuf, DEBUG_UTIL_HDR_BUFLEN); if (ipmi_obj_dump (STDERR_FILENO, ctx->debug_prefix, hdrbuf, NULL, obj) < 0) { FRU_PARSE_ERRNO_TO_FRU_PARSE_ERRNUM (ctx, errno); return (-1); } } return (0); }
true
true
false
false
false
1
ldl_getfields( char *statementp, char *firstfieldp, char *secondfieldp, char *thirdfieldp ) { int delim=g_delim; char *tempfirst; char *tempsecond; char *tempthird; char *bufp=statementp; /* get pointers to individual fields from file */ tempfirst=mystrsep(&bufp, delim); tempsecond=mystrsep(&bufp, delim); tempthird=mystrsep(&bufp, delim); /* fix NULL pointers */ if (tempfirst == NULL) tempfirst=""; if (tempsecond == NULL) tempsecond=""; if (tempthird == NULL) tempthird=""; /* copy strings */ strcpy(firstfieldp, tempfirst); strcpy(secondfieldp, tempsecond); strcpy(thirdfieldp, tempthird); }
false
true
false
false
false
1
realtime_ldap_entry_to_var(struct ldap_table_config *table_config, LDAPMessage *ldap_entry) { BerElement *ber = NULL; struct ast_variable *var = NULL; struct ast_variable *prev = NULL; int is_delimited = 0; int i = 0; char *ldap_attribute_name; struct berval *value; int pos = 0; ldap_attribute_name = ldap_first_attribute(ldapConn, ldap_entry, &ber); while (ldap_attribute_name) { struct berval **values = NULL; const char *attribute_name = convert_attribute_name_from_ldap(table_config, ldap_attribute_name); int is_realmed_password_attribute = strcasecmp(attribute_name, "md5secret") == 0; values = ldap_get_values_len(ldapConn, ldap_entry, ldap_attribute_name); /* these are freed at the end */ if (values) { struct berval **v; char *valptr; for (v = values; *v; v++) { value = *v; valptr = value->bv_val; ast_debug(2, "LINE(%d) attribute_name: %s LDAP value: %s\n", __LINE__, attribute_name, valptr); if (is_realmed_password_attribute) { if (!strncasecmp(valptr, "{md5}", 5)) { valptr += 5; } ast_debug(2, "md5: %s\n", valptr); } if (valptr) { /* ok, so looping through all delimited values except the last one (not, last character is not delimited...) */ if (is_delimited) { i = 0; pos = 0; while (!ast_strlen_zero(valptr + i)) { if (valptr[i] == ';') { valptr[i] = '\0'; if (prev) { prev->next = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name); if (prev->next) { prev = prev->next; } } else { prev = var = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name); } pos = i + 1; } i++; } } /* for the last delimited value or if the value is not delimited: */ if (prev) { prev->next = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name); if (prev->next) { prev = prev->next; } } else { prev = var = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name); } } } ldap_value_free_len(values); } ldap_memfree(ldap_attribute_name); ldap_attribute_name = ldap_next_attribute(ldapConn, ldap_entry, ber); } ber_free(ber, 0); return var; }
false
false
false
false
false
0
operator<<(std::ostream& os, const path_t& apath) { const unsigned as(apath.size()); for (unsigned i(0); i<as; ++i) { os << apath[i].length << segment_type_to_cigar_code(apath[i].type); } return os; }
false
false
false
false
false
0
usb3503_reset(struct usb3503 *hub, int state) { if (!state && gpio_is_valid(hub->gpio_connect)) gpio_set_value_cansleep(hub->gpio_connect, 0); if (gpio_is_valid(hub->gpio_reset)) gpio_set_value_cansleep(hub->gpio_reset, state); /* Wait T_HUBINIT == 4ms for hub logic to stabilize */ if (state) usleep_range(4000, 10000); return 0; }
false
false
false
false
false
0
cs5535_mfd_probe(struct pci_dev *pdev, const struct pci_device_id *id) { int err, i; err = pci_enable_device(pdev); if (err) return err; /* fill in IO range for each cell; subdrivers handle the region */ for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) { int bar = cs5535_mfd_cells[i].id; struct resource *r = &cs5535_mfd_resources[bar]; r->flags = IORESOURCE_IO; r->start = pci_resource_start(pdev, bar); r->end = pci_resource_end(pdev, bar); /* id is used for temporarily storing BAR; unset it now */ cs5535_mfd_cells[i].id = 0; } err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells, ARRAY_SIZE(cs5535_mfd_cells), NULL, 0, NULL); if (err) { dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); goto err_disable; } cs5535_clone_olpc_cells(); dev_info(&pdev->dev, "%zu devices registered.\n", ARRAY_SIZE(cs5535_mfd_cells)); return 0; err_disable: pci_disable_device(pdev); return err; }
false
false
false
false
false
0