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
PyMemoTable_Get(PyMemoTable *self, PyObject *key) { PyMemoEntry *entry = _PyMemoTable_Lookup(self, key); if (entry->me_key == NULL) return NULL; return &entry->me_value; }
false
false
false
false
false
0
pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len) { PgStat_StatDBEntry *dbentry; PgStat_StatTabEntry *tabentry; /* * Store the data in the table's hashtable entry. */ dbentry = pgstat_get_db_entry(msg->m_databaseid, true); tabentry = pgstat_get_tab_entry(dbentry, msg->m_tableoid, true); tabentry->n_live_tuples = msg->m_tuples; /* Resetting dead_tuples to 0 is an approximation ... */ tabentry->n_dead_tuples = 0; if (msg->m_autovacuum) { tabentry->autovac_vacuum_timestamp = msg->m_vacuumtime; tabentry->autovac_vacuum_count++; } else { tabentry->vacuum_timestamp = msg->m_vacuumtime; tabentry->vacuum_count++; } }
false
false
false
false
false
0
history_set_history_state (state) HISTORY_STATE *state; { the_history = state->entries; history_offset = state->offset; history_length = state->length; history_size = state->size; if (state->flags & HS_STIFLED) history_stifled = 1; }
false
false
false
false
false
0
libpdrecanything(t_libpdrec *x, t_symbol *s, int argc, t_atom *argv) { if (libpd_messagehook) (*libpd_messagehook)(x->x_sym->s_name, s->s_name, argc, argv); }
false
false
false
false
false
0
rhash_final(rhash ctx, unsigned char* first_result) { unsigned i = 0; unsigned char buffer[130]; unsigned char* out = (first_result ? first_result : buffer); assert(ctx->hash_vector_size <= RHASH_HASH_COUNT); /* call final method for every algorithm */ for(i = 0; i < ctx->hash_vector_size; i++) { struct rhash_hash_info* info = ctx->vector[i].hash_info; assert(info->final != 0); assert(info->info.digest_size < sizeof(buffer)); info->final(ctx->vector[i].context, out); out = buffer; } return 0; /* no error processing at the moment */ }
false
false
false
false
false
0
GetOffsetFromIndex(const GEPOperator *GEP, unsigned Idx, bool &VariableIdxFound, const DataLayout &DL) { // Skip over the first indices. gep_type_iterator GTI = gep_type_begin(GEP); for (unsigned i = 1; i != Idx; ++i, ++GTI) /*skip along*/; // Compute the offset implied by the rest of the indices. int64_t Offset = 0; for (unsigned i = Idx, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { ConstantInt *OpC = dyn_cast<ConstantInt>(GEP->getOperand(i)); if (!OpC) return VariableIdxFound = true; if (OpC->isZero()) continue; // No offset. // Handle struct indices, which add their field offset to the pointer. if (StructType *STy = dyn_cast<StructType>(*GTI)) { Offset += DL.getStructLayout(STy)->getElementOffset(OpC->getZExtValue()); continue; } // Otherwise, we have a sequential type like an array or vector. Multiply // the index by the ElementSize. uint64_t Size = DL.getTypeAllocSize(GTI.getIndexedType()); Offset += Size*OpC->getSExtValue(); } return Offset; }
false
false
false
false
false
0
print_range(const struct nf_nat_ipv4_range *r) { if (r->flags & NF_NAT_RANGE_MAP_IPS) { struct in_addr a; a.s_addr = r->min_ip; printf("%s", xtables_ipaddr_to_numeric(&a)); if (r->max_ip != r->min_ip) { a.s_addr = r->max_ip; printf("-%s", xtables_ipaddr_to_numeric(&a)); } } if (r->flags & NF_NAT_RANGE_PROTO_SPECIFIED) { printf(":"); printf("%hu", ntohs(r->min.tcp.port)); if (r->max.tcp.port != r->min.tcp.port) printf("-%hu", ntohs(r->max.tcp.port)); } }
false
false
false
false
false
0
cliMatch_destroyChain(CliMatch *match, const char *oppName, int *hcap, float *komi, bool *free) { bool result = FALSE; /* * This code wouldn't work if things were done right in the but library * and the windows were destroyed as soon as I asked for it. But since * the library is too broken for me to fix right now I'll have to do it * this way. The second assert in the loop will fail when the but library * is rewritten to do things right. */ while (match != NULL) { assert(MAGIC(match)); if (oppName != NULL) { if (!strcmp(oppName, str_chars(&match->wName)) || !strcmp(oppName, str_chars(&match->bName))) { result = TRUE; *hcap = match->hcap; *komi = match->komi; *free = butCb_get(match->freeGame); match->state = cliMatch_nil; } } cliMatch_destroy(match); assert(MAGIC(match)); match = match->next; } return(result); }
false
false
false
false
false
0
removeMap(const QString & name) { for (int i = 0; i < _maps.size(); i++) { if(_maps.at(i).name() == name) { _maps.removeAt(i); return TRUE; } } return FALSE; }
false
false
false
false
false
0
pio2_set_led(struct pio2_card *card, int state) { u8 reg; int retval; reg = card->irq_level; /* Register state inverse of led state */ if (!state) reg |= PIO2_LED; if (loopback) reg |= PIO2_LOOP; retval = vme_master_write(card->window, &reg, 1, PIO2_REGS_CTRL); if (retval < 0) return retval; card->led = state ? 1 : 0; return 0; }
false
false
false
false
false
0
register_one_unit(xlnk_script *s, xlnk_script_command *c, void *arg) { const char *file; int *i; xunit *xu; require_arg(s, c, "file", file); /* arg is pointer to unit index */ i = (int *)arg; /* Get pointer to xunit to fill in */ xu = &units[*i]; /* Read basic unit from file */ if (xasm_unit_read(file, &xu->_unit_) == 0) { scripterr(s, c, "failed to load unit `%s'", file); xu->loaded = 0; return; } xu->loaded = 1; verbose(1, " unit `%s' loaded", file); verbose(1, " registering local symbols..."); register_locals(xu->_unit_.dataseg.bytes, &xu->data_locals, xu); register_locals(xu->_unit_.codeseg.bytes, &xu->code_locals, xu); verbose(1, " registering public symbols..."); enter_exported_constants(&xu->_unit_); enter_exported_locals(&xu->data_locals, &xu->_unit_); enter_exported_locals(&xu->code_locals, &xu->_unit_); hashtab_put(unit_hash, (void*)file, xu); /* Increment unit index */ (*i)++; }
false
false
false
false
false
0
squashfs_cache_delete(struct squashfs_cache *cache) { int i, j; if (cache == NULL) return; for (i = 0; i < cache->entries; i++) { if (cache->entry[i].data) { for (j = 0; j < cache->pages; j++) kfree(cache->entry[i].data[j]); kfree(cache->entry[i].data); } kfree(cache->entry[i].actor); } kfree(cache->entry); kfree(cache); }
false
false
false
false
false
0
torch_Timer_time(lua_State *L) { Timer *timer = luaT_checkudata(L, 1, torch_Timer_id); double returnTime = (timer->isRunning ? (timer->totalTime + torch_Timer_runTime() - timer->startTime) : timer->totalTime); lua_pushnumber(L, returnTime); return 1; }
false
false
false
false
false
0
shiftAttribute(QDomElement & element, const char * attributeName, double d) { double n = element.attribute(attributeName).toDouble() + d; element.setAttribute(attributeName, QString::number(n)); return true; }
false
false
false
false
false
0
gamgi_gtk_plane_measure_press (gamgi_window *window_mouse, GdkEventButton *event, int x, int y, gamgi_window *window_dialog) { /****************************** * local mouse selection only * ******************************/ if (window_dialog != window_mouse) return; gamgi_mesa_select_object (window_mouse, x, y, static_class (window_dialog), FALSE, static_press); }
false
false
false
false
false
0
SelectDouble(ListTreeWidget w) #else static void SelectDouble(w) ListTreeWidget w; #endif { ListTreeActivateStruct ret; TreeCheck(w, "in SelectDouble"); if (w->list.timer_item) { w->list.timer_type = TIMER_DOUBLE; w->list.timer_item->open = !w->list.timer_item->open; w->list.highlighted = w->list.timer_item; HighlightAll(w, False, True); MakeActivateCallbackStruct(w, w->list.timer_item, &ret); /* Highlight the path if we need to */ if (w->list.HighlightPath) { Boolean save; save=w->list.Refresh; w->list.Refresh=False; ListTreeSetHighlighted((Widget)w,ret.path,ret.count,True); w->list.Refresh=save; /* ListTreeGetHighlighted((Widget)w,&ret2); */ /* ListTreeSetHighlighted((Widget)w,ret2.items,ret2.count,True); */ } if (w->list.ActivateCallback) { XtCallCallbacks((Widget) w, XtNactivateCallback, (XtPointer) & ret); } w->list.timer_item->highlighted = True; w->list.recount = True; DrawChanged(w); } TreeCheck(w, "exiting SelectDouble"); }
false
false
false
false
false
0
squaredResidual(VectorArray<double> const& e) { int const N = e.count(); int const M = e.size(); double res = 0.0; for (int n = 0; n < N; ++n) for (int m = 0; m < M; ++m) res += e[n][m] * e[n][m]; return res; }
false
false
false
false
false
0
paint_setup_UYVP (paintinfo * p, unsigned char *dest) { p->ap = dest; p->yp = dest + 0; p->up = dest + 0; p->vp = dest + 0; p->ystride = GST_ROUND_UP_4 ((p->width * 2 * 5 + 3) / 4); GST_ERROR ("stride %d", p->ystride); p->endptr = dest + p->ystride * p->height; }
false
false
false
false
false
0
Buffer_copy(Buffer *buffer, unsigned char *data, size_t size) { if (!buffer || !data) { return 0; } if (size > buffer->size) { return 0; } size_t i, to_copy, copied = 0; BufferCell *buffer_cell; unsigned char *offset = data; unsigned char *result = data; for (i = 0; i < buffer->cell_count; i++) { buffer_cell = buffer->cells[i]; to_copy = (size - copied) < buffer_cell->size ? (size - copied) : buffer_cell->size; if (to_copy <= 0) { break; } memcpy(offset, buffer_cell->data, to_copy); copied += to_copy; offset += buffer_cell->size; } return result; }
false
false
false
false
false
0
marker_inode_loc_fill (inode_t *inode, loc_t *loc) { char *resolvedpath = NULL; inode_t *parent = NULL; int ret = -1; if ((!inode) || (!loc)) return ret; if ((inode) && __is_root_gfid (inode->gfid)) { loc->parent = NULL; goto ignore_parent; } parent = inode_parent (inode, 0, NULL); if (!parent) { goto err; } ignore_parent: ret = inode_path (inode, NULL, &resolvedpath); if (ret < 0) goto err; ret = marker_loc_fill (loc, inode, parent, resolvedpath); if (ret < 0) goto err; err: if (parent) inode_unref (parent); if (resolvedpath) GF_FREE (resolvedpath); return ret; }
false
false
false
false
false
0
appendChart(GcWinID id) { // GcWindowDialog is delete on close, so no need to delete GcWindowDialog *f = new GcWindowDialog(id, mainWindow); GcWindow *newone = f->exec(); // returns null if cancelled or closed if (newone) { addChart(newone); newone->show(); } // now wipe it delete f; // before we return lets turn the cursor off chartCursor = -2; winWidget->repaint(); }
false
false
false
false
false
0
clock_map_render_shadow_pixbuf (GdkPixbuf *pixbuf) { int x, y; int height, width; int n_channels, rowstride; guchar *pixels, *p; gdouble sun_lat, sun_lon; time_t now = time (NULL); n_channels = gdk_pixbuf_get_n_channels (pixbuf); rowstride = gdk_pixbuf_get_rowstride (pixbuf); pixels = gdk_pixbuf_get_pixels (pixbuf); width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); sun_position (now, &sun_lat, &sun_lon); for (y = 0; y < height; y++) { gdouble lat = (height / 2.0 - y) / (height / 2.0) * 90.0; for (x = 0; x < width; x++) { guchar shade; gdouble lon = (x - width / 2.0) / (width / 2.0) * 180.0; shade = clock_map_is_sunlit (lat, lon, sun_lat, sun_lon); p = pixels + y * rowstride + x * n_channels; p[3] = shade; } } }
false
false
false
false
false
0
authenticateTryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData * conn, struct in_addr src_addr) { /* If we have already been called, return the cached value */ auth_user_request_t *t = authTryGetUser(auth_user_request, conn, request); auth_acl_t result; if (t && t->lastReply != AUTH_ACL_CANNOT_AUTHENTICATE && t->lastReply != AUTH_ACL_HELPER) { if (!*auth_user_request) { *auth_user_request = t; authenticateAuthUserRequestLock(*auth_user_request); } if (!request->auth_user_request && t->lastReply == AUTH_AUTHENTICATED) { request->auth_user_request = t; authenticateAuthUserRequestLock(request->auth_user_request); } return t->lastReply; } /* ok, call the actual authenticator routine. */ result = authenticateAuthenticate(auth_user_request, headertype, request, conn, src_addr); t = authTryGetUser(auth_user_request, conn, request); if (t && result != AUTH_ACL_CANNOT_AUTHENTICATE && result != AUTH_ACL_HELPER) { t->lastReply = result; } return result; }
false
false
false
false
false
0
load_config_from_file(const gchar *utf8_path, gboolean startup) { gsize size; gchar *buf; gboolean ret = TRUE; if (g_file_get_contents(utf8_path, &buf, &size, NULL) == FALSE) { return FALSE; } ret = load_config_from_buf(buf, size, startup); g_free(buf); return ret; }
false
false
false
false
false
0
insert_extra_modulo_guards( CloogConstraintSet *constraints, int level, struct clast_stmt ***next, CloogInfos *infos) { int i; int nb_iter; int total_dim; CloogConstraint *upper, *lower; total_dim = cloog_constraint_set_total_dimension(constraints); nb_iter = cloog_constraint_set_n_iterators(constraints, infos->names->nb_parameters); for (i = total_dim - infos->names->nb_parameters; i >= nb_iter + 1; i--) { if (cloog_constraint_is_valid(upper = cloog_constraint_set_defining_equality(constraints, i))) { if (!level || (nb_iter < level) || !cloog_constraint_involves(upper, level-1)) { insert_modulo_guard(upper, cloog_constraint_invalid(), i, next, infos); constraints = cloog_constraint_set_drop_constraint(constraints, upper); } cloog_constraint_release(upper); } else if (cloog_constraint_is_valid(upper = cloog_constraint_set_defining_inequalities(constraints, i, &lower, infos->names->nb_parameters))) { if (!level || (nb_iter < level) || !cloog_constraint_involves(upper, level-1)) { insert_modulo_guard(upper, lower, i, next, infos); constraints = cloog_constraint_set_drop_constraint(constraints, upper); constraints = cloog_constraint_set_drop_constraint(constraints, lower); } cloog_constraint_release(upper); cloog_constraint_release(lower); } } return constraints; }
false
false
false
false
false
0
Cns_get_usrinfo_by_uid(dbfd, uid, user_entry, lock, rec_addr) struct Cns_dbfd *dbfd; uid_t uid; struct Cns_userinfo *user_entry; int lock; Cns_dbrec_addr *rec_addr; { char func[23]; int i = 0; static char query[] = "SELECT USERID, USERNAME, USER_CA, BANNED FROM Cns_userinfo \ WHERE userid = %d"; static char query4upd[] = "SELECT ROWID, USERID, USERNAME, USER_CA, BANNED FROM Cns_userinfo \ WHERE userid = %d FOR UPDATE"; PGresult *res; char sql_stmt[1024]; strcpy (func, "Cns_get_usrinfo_by_uid"); sprintf (sql_stmt, lock ? query4upd : query, uid); res = PQexec (dbfd->Pconn, sql_stmt); if (PQresultStatus (res) != PGRES_TUPLES_OK) { Cns_libpq_error (func, "SELECT", res, dbfd); return (-1); } if (PQntuples (res) == 0) { PQclear (res); serrno = ENOENT; return (-1); } if (lock) strcpy (*rec_addr, PQgetvalue (res, 0, i++)); user_entry->userid = atoi (PQgetvalue (res, 0, i++)); strcpy (user_entry->username, PQgetvalue (res, 0, i++)); strcpy (user_entry->user_ca, PQgetvalue (res, 0, i++)); user_entry->banned = atoi (PQgetvalue (res, 0, i)); PQclear (res); return (0); }
false
false
false
false
false
0
get_all_column_privs(dbTable * table, int (*get_column_priv) ()) { int priv, col, ncols; dbColumn *column; ncols = db_get_table_number_of_columns(table); for (col = 0; col < ncols; col++) { column = db_get_table_column(table, col); priv = get_column_priv(column); if (priv != DB_GRANTED) return priv; } return DB_GRANTED; }
false
false
false
false
false
0
Validate(FreeImageIO *io, fi_handle handle) { char buf[6]; if( io->read_proc(buf, 6, 1, handle) < 1 ) { return FALSE; } BOOL bResult = FALSE; if( !strncmp(buf, "GIF", 3) ) { if( buf[3] >= '0' && buf[3] <= '9' && buf[4] >= '0' && buf[4] <= '9' && buf[5] >= 'a' && buf[5] <= 'z' ) { bResult = TRUE; } } io->seek_proc(handle, -6, SEEK_CUR); return bResult; }
false
false
false
false
false
0
getMatch(int n, int flags) { // This method used to be implemented in terms of // pcre_get_substring, but that function gives you an empty string // for an unmatched backreference that is in range. int offset; int length; try { getOffsetLength(n, offset, length); } catch (NoBackref&) { if (flags & gm_no_substring_returns_empty) { return ""; } else { throw; } } return std::string(this->subject).substr(offset, length); }
false
false
false
false
false
0
driver_set_config_work(struct work_struct *work) { struct set_config_request *req = container_of(work, struct set_config_request, work); struct usb_device *udev = req->udev; usb_lock_device(udev); spin_lock(&set_config_lock); list_del(&req->node); spin_unlock(&set_config_lock); if (req->config >= -1) /* Is req still valid? */ usb_set_configuration(udev, req->config); usb_unlock_device(udev); usb_put_dev(udev); kfree(req); }
false
false
false
false
false
0
verify_region (const CoglGLES2Vtable *gles2, int x, int y, int width, int height, uint32_t expected_pixel) { uint8_t *buf, *p; buf = g_malloc (width * height * 4); gles2->glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf); for (p = buf + width * height * 4; p > buf; p -= 4) test_utils_compare_pixel (p - 4, expected_pixel); g_free (buf); }
false
false
false
false
false
0
render_cursor (GstVMncDec * dec, guint8 * data) { /* First, figure out the portion of the cursor that's on-screen */ /* X,Y of top-left of cursor */ int x = dec->cursor.x - dec->cursor.hot_x; int y = dec->cursor.y - dec->cursor.hot_y; /* Width, height of rendered portion of cursor */ int width = dec->cursor.width; int height = dec->cursor.height; /* X,Y offset of rendered portion of cursor */ int off_x = 0; int off_y = 0; if (x < 0) { off_x = -x; width += x; x = 0; } if (x + width > dec->format.width) width = dec->format.width - x; if (y < 0) { off_y = -y; height += y; y = 0; } if (y + height > dec->format.height) height = dec->format.height - y; if (dec->cursor.type == CURSOR_COLOUR) { render_colour_cursor (dec, data, x, y, off_x, off_y, width, height); } else { /* Alpha cursor. */ /* TODO: Implement me! */ GST_WARNING_OBJECT (dec, "Alpha composited cursors not yet implemented"); } }
false
false
false
false
false
0
SuiteSparseQR_C // returns rank(A) estimate, (-1) if failure ( // inputs: int ordering, // all, except 3:given treated as 0:fixed double tol, // columns with 2-norm <= tol are treated as 0 Long econ, // e = max(min(m,econ),rank(A)) int getCTX, // 0: Z=C (e-by-k), 1: Z=C', 2: Z=X (e-by-k) cholmod_sparse *A, // m-by-n sparse matrix to factorize cholmod_sparse *Bsparse,// sparse m-by-k B cholmod_dense *Bdense, // dense m-by-k B // outputs: cholmod_sparse **Zsparse, // sparse Z cholmod_dense **Zdense, // dense Z cholmod_sparse **R, // R factor, e-by-n Long **E, // size n column permutation, NULL if identity cholmod_sparse **H, // m-by-nh Householder vectors Long **HPinv, // size m row permutation cholmod_dense **HTau, // 1-by-nh Householder coefficients cholmod_common *cc // workspace and parameters ) { RETURN_IF_NULL_COMMON (EMPTY) ; RETURN_IF_NULL (A, EMPTY) ; cc->status = CHOLMOD_OK ; return ((A->xtype == CHOLMOD_REAL) ? SuiteSparseQR <double> (ordering, tol, econ, getCTX, A, Bsparse, Bdense, Zsparse, Zdense, R, E, H, HPinv, HTau, cc) : SuiteSparseQR <Complex> (ordering, tol, econ, getCTX, A, Bsparse, Bdense, Zsparse, Zdense, R, E, H, HPinv, HTau, cc)) ; }
false
false
false
false
false
0
visu_box_convertFullToCell(VisuBox *box, float cell[3], float full[3]) { g_return_if_fail(VISU_IS_BOX(box)); if (box->priv->fromFullToCell[0][0] != G_MAXFLOAT) tool_matrix_productVector(cell, box->priv->fromFullToCell, full); else { cell[0] = full[0]; cell[1] = full[1]; cell[2] = full[2]; } }
false
false
false
false
false
0
end_result_backtrace_entry (CutStreamParser *parser, CutStreamParserPrivate *priv, GMarkupParseContext *context, const gchar *element_name, GError **error) { if (!priv->backtrace_entry) return; /* should check file name, line, info? */ priv->backtrace = g_list_prepend(priv->backtrace, priv->backtrace_entry); priv->backtrace_entry = NULL; }
false
false
false
false
false
0
clk_core_prepare(struct clk_core *core) { int ret = 0; lockdep_assert_held(&prepare_lock); if (!core) return 0; if (core->prepare_count == 0) { ret = clk_core_prepare(core->parent); if (ret) return ret; trace_clk_prepare(core); if (core->ops->prepare) ret = core->ops->prepare(core->hw); trace_clk_prepare_complete(core); if (ret) { clk_core_unprepare(core->parent); return ret; } } core->prepare_count++; return 0; }
false
false
false
false
false
0
PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid) { if (PKCS7_get_signed_attribute(si, NID_pkcs9_contentType)) return 0; if (!coid) coid = OBJ_nid2obj(NID_pkcs7_data); return PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT, coid); }
false
false
false
false
false
0
createListContent(void) { using namespace CEGUI; WindowManager& winMgr = WindowManager::getSingleton(); // // Combobox setup // Combobox* cbobox = static_cast<Combobox*>(winMgr.getWindow("Demo7/Window2/Combobox")); // add items to the combobox list cbobox->addItem(new MyListItem("Combobox Item 1")); cbobox->addItem(new MyListItem("Combobox Item 2")); cbobox->addItem(new MyListItem("Combobox Item 3")); cbobox->addItem(new MyListItem("Combobox Item 4")); cbobox->addItem(new MyListItem("Combobox Item 5")); cbobox->addItem(new MyListItem("Combobox Item 6")); cbobox->addItem(new MyListItem("Combobox Item 7")); cbobox->addItem(new MyListItem("Combobox Item 8")); cbobox->addItem(new MyListItem("Combobox Item 9")); cbobox->addItem(new MyListItem("Combobox Item 10")); // // Multi-Column List setup // MultiColumnList* mclbox = static_cast<MultiColumnList*>(winMgr.getWindow("Demo7/Window2/MultiColumnList")); // Add some empty rows to the MCL mclbox->addRow(); mclbox->addRow(); mclbox->addRow(); mclbox->addRow(); mclbox->addRow(); // Set first row item texts for the MCL mclbox->setItem(new MyListItem("Laggers World"), 0, 0); mclbox->setItem(new MyListItem("yourgame.some-server.com"), 1, 0); mclbox->setItem(new MyListItem("[colour='FFFF0000']1000ms"), 2, 0); // Set second row item texts for the MCL mclbox->setItem(new MyListItem("Super-Server"), 0, 1); mclbox->setItem(new MyListItem("whizzy.fakenames.net"), 1, 1); mclbox->setItem(new MyListItem("[colour='FF00FF00']8ms"), 2, 1); // Set third row item texts for the MCL mclbox->setItem(new MyListItem("Cray-Z-Eds"), 0, 2); mclbox->setItem(new MyListItem("crayzeds.notarealserver.co.uk"), 1, 2); mclbox->setItem(new MyListItem("[colour='FF00FF00']43ms"), 2, 2); // Set fourth row item texts for the MCL mclbox->setItem(new MyListItem("Fake IPs"), 0, 3); mclbox->setItem(new MyListItem("123.320.42.242"), 1, 3); mclbox->setItem(new MyListItem("[colour='FFFFFF00']63ms"), 2, 3); // Set fifth row item texts for the MCL mclbox->setItem(new MyListItem("Yet Another Game Server"), 0, 4); mclbox->setItem(new MyListItem("abc.abcdefghijklmn.org"), 1, 4); mclbox->setItem(new MyListItem("[colour='FFFF6600']284ms"), 2, 4); }
false
false
false
false
false
0
finish_pass_gather (j_compress_ptr cinfo) { j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec; shuff_entropy_ptr entropy = (shuff_entropy_ptr) lossyc->entropy_private; int ci, dctbl, actbl; jpeg_component_info * compptr; JHUFF_TBL **htblptr; boolean did_dc[NUM_HUFF_TBLS]; boolean did_ac[NUM_HUFF_TBLS]; /* It's important not to apply jpeg_gen_optimal_table more than once * per table, because it clobbers the input frequency counts! */ MEMZERO(did_dc, SIZEOF(did_dc)); MEMZERO(did_ac, SIZEOF(did_ac)); for (ci = 0; ci < cinfo->comps_in_scan; ci++) { compptr = cinfo->cur_comp_info[ci]; dctbl = compptr->dc_tbl_no; actbl = compptr->ac_tbl_no; if (! did_dc[dctbl]) { htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl]; if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]); did_dc[dctbl] = TRUE; } if (! did_ac[actbl]) { htblptr = & cinfo->ac_huff_tbl_ptrs[actbl]; if (*htblptr == NULL) *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]); did_ac[actbl] = TRUE; } } }
false
false
false
false
false
0
onenand_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len) { struct onenand_chip *this = mtd->priv; u_char *buf = FLEXONENAND(this) ? this->page_buf : this->oob_buf; size_t retlen; int ret; unsigned int otp_lock_offset = ONENAND_OTP_LOCK_OFFSET; memset(buf, 0xff, FLEXONENAND(this) ? this->writesize : mtd->oobsize); /* * Write lock mark to 8th word of sector0 of page0 of the spare0. * We write 16 bytes spare area instead of 2 bytes. * For Flex-OneNAND, we write lock mark to 1st word of sector 4 of * main area of page 49. */ from = 0; len = FLEXONENAND(this) ? mtd->writesize : 16; /* * Note: OTP lock operation * OTP block : 0xXXFC XX 1111 1100 * 1st block : 0xXXF3 (If chip support) XX 1111 0011 * Both : 0xXXF0 (If chip support) XX 1111 0000 */ if (FLEXONENAND(this)) otp_lock_offset = FLEXONENAND_OTP_LOCK_OFFSET; /* ONENAND_OTP_AREA | ONENAND_OTP_BLOCK0 | ONENAND_OTP_AREA_BLOCK0 */ if (otp == 1) buf[otp_lock_offset] = 0xFC; else if (otp == 2) buf[otp_lock_offset] = 0xF3; else if (otp == 3) buf[otp_lock_offset] = 0xF0; else if (otp != 0) printk(KERN_DEBUG "[OneNAND] Invalid option selected for OTP\n"); ret = onenand_otp_walk(mtd, from, len, &retlen, buf, do_otp_lock, MTD_OTP_USER); return ret ? : retlen; }
false
false
false
false
false
0
on_project_element_added (IAnjutaProjectManager *pm, GFile *gfile, SymbolDBPlugin *sdb_plugin) { gchar *filename; gint real_added; GPtrArray *files_array; g_return_if_fail (sdb_plugin->project_root_uri != NULL); g_return_if_fail (sdb_plugin->project_root_dir != NULL); filename = g_file_get_path (gfile); files_array = g_ptr_array_new_with_free_func (g_free); g_ptr_array_add (files_array, filename); sdb_plugin->is_adding_element = TRUE; /* use a custom function to add the files to db */ real_added = do_add_new_files (sdb_plugin, files_array, TASK_ELEMENT_ADDED); if (real_added <= 0) { sdb_plugin->is_adding_element = FALSE; } g_ptr_array_unref (files_array); }
false
false
false
false
false
0
compute_all_net_distances(struct Map_info *In, struct Map_info *Net, double netmax, double **dists, double dmax) { int nn, kk, nalines, aline; double dist; struct line_pnts *Points; BOUND_BOX box; struct ilist *List; Points = Vect_new_line_struct(); List = Vect_new_list(); nn = Vect_get_num_primitives(In, GV_POINTS); nn = nn * (nn - 1); *dists = (double *)G_calloc(nn, sizeof(double)); kk = 0; nalines = Vect_get_num_lines(In); for (aline = 1; aline <= nalines; aline++) { int i, altype; G_debug(3, " aline = %d", aline); altype = Vect_read_line(In, Points, NULL, aline); if (!(altype & GV_POINTS)) continue; box.E = Points->x[0] + dmax; box.W = Points->x[0] - dmax; box.N = Points->y[0] + dmax; box.S = Points->y[0] - dmax; box.T = PORT_DOUBLE_MAX; box.B = -PORT_DOUBLE_MAX; Vect_select_lines_by_box(In, &box, GV_POINT, List); G_debug(3, " %d points in box", List->n_values); for (i = 0; i < List->n_values; i++) { int bline, ret; bline = List->value[i]; if (bline == aline) continue; G_debug(3, " bline = %d", bline); Vect_get_line_box(In, bline, &box); G_debug(3, " SP: %f %f -> %f %f", Points->x[0], Points->y[0], box.E, box.N); ret = Vect_net_shortest_path_coor(Net, Points->x[0], Points->y[0], 0.0, box.E, box.N, 0.0, netmax, netmax, &dist, NULL, NULL, NULL, NULL, NULL, NULL); if (ret == 0) { G_debug(3, "not reachable"); continue; /* Not reachable */ } G_debug(3, " dist = %f", dist); if (dist <= dmax) { (*dists)[kk] = dist; kk++; } G_debug(3, " kk = %d", kk); } } return (kk); }
false
false
false
false
false
0
dht_layout_new (xlator_t *this, int cnt) { dht_layout_t *layout = NULL; dht_conf_t *conf = NULL; conf = this->private; layout = GF_CALLOC (1, layout_size (cnt), gf_dht_mt_dht_layout_t); if (!layout) { goto out; } layout->type = DHT_HASH_TYPE_DM; layout->cnt = cnt; if (conf) { layout->spread_cnt = conf->dir_spread_cnt; layout->gen = conf->gen; } layout->ref = 1; out: return layout; }
false
false
false
false
false
0
operator<< (char c) { char temp[2]; temp[0] = c; temp[1] = 0; stringtemp += std::string(temp); return (*this); }
false
false
false
false
false
0
gsb_data_payee_set_description ( gint no_payee, const gchar *description ) { struct_payee *payee; payee = gsb_data_payee_get_structure ( no_payee ); if (!payee) return FALSE; /* we free the last name */ if ( payee -> payee_description ) g_free (payee -> payee_description); /* and copy the new one */ if (description) payee -> payee_description = my_strdup (description); else payee -> payee_description = NULL; return TRUE; }
false
false
false
false
false
0
addpatchvalues(struct patchinfo *p) { int p2p = p->p2p; addpatchstring("WATCHDOG", "1"); addpatchbyte("AutoFrame", 1); switch (p->protocol) { case DP_CT1: addpatchbyte("PROTOCOL", 1); break; case DP_VN3: addpatchbyte("PROTOCOL", 2); break; case DP_NI1: p2p = 0; addpatchbyte("PROTOCOL", 3); if (p->dn1 && p->spid1) { addpatchstring("DN", p->dn1); addpatchstring("SPID", p->spid1); } if (p->dn2 && p->spid2) { addpatchstring("DN2", p->dn2); addpatchstring("SPID2", p->spid2); } break; case DP_AUSTEL: addpatchbyte("PROTOCOL", 4); break; case DP_5ESS: p2p = 0; addpatchbyte("PROTOCOL", 5); if (p->dn1 && p->spid1) { addpatchstring("DN", p->dn1); addpatchstring("SPID", p->spid1); } if (p->dn2 && p->spid2) { addpatchstring("DN2", p->dn2); addpatchstring("SPID2", p->spid2); } break; } if (p2p) { addpatchbyte("P2P", 1); addpatchbyte("TEI", 0); } }
false
false
false
false
false
0
pmcraid_worker_function(struct work_struct *workp) { struct pmcraid_instance *pinstance; struct pmcraid_resource_entry *res; struct pmcraid_resource_entry *temp; struct scsi_device *sdev; unsigned long lock_flags; unsigned long host_lock_flags; u16 fw_version; u8 bus, target, lun; pinstance = container_of(workp, struct pmcraid_instance, worker_q); /* add resources only after host is added into system */ if (!atomic_read(&pinstance->expose_resources)) return; fw_version = be16_to_cpu(pinstance->inq_data->fw_version); spin_lock_irqsave(&pinstance->resource_lock, lock_flags); list_for_each_entry_safe(res, temp, &pinstance->used_res_q, queue) { if (res->change_detected == RES_CHANGE_DEL && res->scsi_dev) { sdev = res->scsi_dev; /* host_lock must be held before calling * scsi_device_get */ spin_lock_irqsave(pinstance->host->host_lock, host_lock_flags); if (!scsi_device_get(sdev)) { spin_unlock_irqrestore( pinstance->host->host_lock, host_lock_flags); pmcraid_info("deleting %x from midlayer\n", res->cfg_entry.resource_address); list_move_tail(&res->queue, &pinstance->free_res_q); spin_unlock_irqrestore( &pinstance->resource_lock, lock_flags); scsi_remove_device(sdev); scsi_device_put(sdev); spin_lock_irqsave(&pinstance->resource_lock, lock_flags); res->change_detected = 0; } else { spin_unlock_irqrestore( pinstance->host->host_lock, host_lock_flags); } } } list_for_each_entry(res, &pinstance->used_res_q, queue) { if (res->change_detected == RES_CHANGE_ADD) { if (!pmcraid_expose_resource(fw_version, &res->cfg_entry)) continue; if (RES_IS_VSET(res->cfg_entry)) { bus = PMCRAID_VSET_BUS_ID; if (fw_version <= PMCRAID_FW_VERSION_1) target = res->cfg_entry.unique_flags1; else target = res->cfg_entry.array_id & 0xFF; lun = PMCRAID_VSET_LUN_ID; } else { bus = PMCRAID_PHYS_BUS_ID; target = RES_TARGET( res->cfg_entry.resource_address); lun = RES_LUN(res->cfg_entry.resource_address); } res->change_detected = 0; spin_unlock_irqrestore(&pinstance->resource_lock, lock_flags); scsi_add_device(pinstance->host, bus, target, lun); spin_lock_irqsave(&pinstance->resource_lock, lock_flags); } } spin_unlock_irqrestore(&pinstance->resource_lock, lock_flags); }
false
false
false
false
false
0
fop_lookup_cbk_stub (call_frame_t *frame, fop_lookup_cbk_t fn, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf, dict_t *xdata, struct iatt *postparent) { call_stub_t *stub = NULL; GF_VALIDATE_OR_GOTO ("call-stub", frame, out); stub = stub_new (frame, 0, GF_FOP_LOOKUP); GF_VALIDATE_OR_GOTO ("call-stub", stub, out); stub->fn_cbk.lookup = fn; stub->args_cbk.op_ret = op_ret; stub->args_cbk.op_errno = op_errno; if (inode) stub->args_cbk.inode = inode_ref (inode); if (buf) stub->args_cbk.stat = *buf; if (postparent) stub->args_cbk.postparent = *postparent; if (xdata) stub->args_cbk.xdata = dict_ref (xdata); out: return stub; }
false
false
false
false
false
0
CGUtil_print_header(Codegen *codegen, C4_Model *model){ register gint i; Codegen_printf(codegen, "/* Code automatically generated by C4 DP library\n" " * Do not attempt to edit this code: it is spagetti.\n" " *\n" " * Model: %s\n" " */\n\n" " /* ---< START >--- */\n\n", model->name); for(i = 0; i < model->global_code_list->len; i++) Codegen_printf(codegen, model->global_code_list->pdata[i]); Codegen_printf(codegen, "\n"); return; }
false
false
false
false
false
0
GListFSelectOne(GGadget *g, int32 pos) { GListField *gl = (GListField *) g; int i; for ( i=0; i<gl->ltot; ++i ) gl->ti[i]->selected = false; if ( pos>=gl->ltot ) pos = gl->ltot-1; if ( pos<0 ) pos = 0; if ( gl->ltot>0 ) { gl->ti[pos]->selected = true; GTextFieldSetTitle(g,gl->ti[pos]->text); } }
false
false
false
false
false
0
yesCB (gftp_transfer * transfer, gftp_dialog_data * ddata) { gftpui_callback_data * cdata; gftp_window_data * wdata; g_return_if_fail (transfer != NULL); g_return_if_fail (transfer->files != NULL); wdata = transfer->fromwdata; cdata = g_malloc0 (sizeof (*cdata)); cdata->request = wdata->request; cdata->files = transfer->files; cdata->uidata = wdata; cdata->run_function = gftpui_common_run_delete; gftpui_common_run_callback_function (cdata); g_free (cdata); _gftp_gtk_free_del_data (transfer, ddata); }
false
false
false
false
false
0
ImportTMG(FILE * pf, const char *UNUSED(szFilename)) { int fCrawfordRule = TRUE; int fJacobyRule = TRUE; int fAutoDoubles = 0; int nLength = 0; int fCrawford = FALSE; int fCubeUse = TRUE; int n0 = 0, n1 = 0; int i = 0, j; int post_crawford = FALSE; char sz[80]; bgvariation bgv = VARIATION_STANDARD; #if USE_GTK if (fX) { /* Clear record to avoid ugly updates */ GTKClearMoveRecord(); GTKFreeze(); } #endif FreeMatch(); ClearMatch(); /* clear matchinfo */ for (j = 0; j < 2; ++j) SetMatchInfo(&mi.pchRating[j], NULL, NULL); SetMatchInfo(&mi.pchPlace, "TrueMoneyGames (http://www.truemoneygames.com)", NULL); SetMatchInfo(&mi.pchEvent, NULL, NULL); SetMatchInfo(&mi.pchRound, NULL, NULL); SetMatchInfo(&mi.pchAnnotator, NULL, NULL); SetMatchInfo(&mi.pchComment, NULL, NULL); mi.nYear = mi.nMonth = mi.nDay = 0; /* search for options (until first game is found) */ while (fgets(sz, 80, pf)) { if (ParseTMGGame(sz, &i, &n0, &n1, &fCrawford, &post_crawford, nLength)) break; ParseTMGOptions(sz, &mi, &fCrawfordRule, &fAutoDoubles, &fJacobyRule, &nLength, &bgv, &fCubeUse); } /* set remainder of match info */ while (!feof(pf)) { ImportTMGGame(pf, i, nLength, n0, n1, fCrawford, fCrawfordRule, fAutoDoubles, fJacobyRule, bgv, fCubeUse); while (fgets(sz, 80, pf)) if (ParseTMGGame(sz, &i, &n0, &n1, &fCrawford, &post_crawford, nLength)) break; } UpdateSettings(); /* swap players */ if (ms.gs != GAME_NONE) CommandSwapPlayers(NULL); #if USE_GTK if (fX) { GTKThaw(); GTKSet(ap); } #endif return 0; }
false
false
false
false
false
0
play_soundtrack (void) { if (nosound) return; if (sound_track_loaded) { dmsg (D_SOUND_TRACK, "start playing sound track"); Mix_PlayMusic (module, -1); sound_track_playing = 1; } }
false
false
false
false
false
0
update() { Config *config = Config::instance(); PowerUp *pwrUp; PowerUp *delUp; pwrUp = pwrUpRoot->next; while( pwrUp ) { pwrUp->age++; pwrUp->pos[1] += (speed*game->speedAdj); if(pwrUp->vel[0] || pwrUp->vel[1]) { float s = (1.0-game->speedAdj)+(game->speedAdj*0.982); pwrUp->vel[0] *= s; pwrUp->vel[1] *= s; pwrUp->pos[0] += pwrUp->vel[0]; pwrUp->pos[1] += pwrUp->vel[1]; if(pwrUp->vel[0] < 0.01) pwrUp->vel[0] = 0.0; if(pwrUp->vel[1] < 0.01) pwrUp->vel[1] = 0.0; } float b = config->screenBoundX()-1.0; if(pwrUp->pos[0] < -b) pwrUp->pos[0] = -b; if(pwrUp->pos[0] > b) pwrUp->pos[0] = b; if(pwrUp->pos[1] < -12) { if(game->gameMode == Global::Game) switch(pwrUp->type) { case PowerUps::SuperShields: game->hero->addLife(); game->hero->addScore(2500.0); break; case PowerUps::Shields: case PowerUps::Repair: game->hero->addScore(10000.0); break; default: game->hero->addScore(2500.0); break; } delUp = pwrUp; pwrUp = pwrUp->next; remove(delUp); } else { pwrUp = pwrUp->next; } } }
false
false
false
false
false
0
__create_base_blobdir(const gchar *path) { if (path == NULL) return FALSE; if (g_str_equal(path, "")) return FALSE; if (g_file_test(path, G_FILE_TEST_EXISTS)) return TRUE; gchar *dir_path = g_path_get_dirname(path); gint rv = g_mkdir_with_parents((const gchar *)dir_path, 0711); if (dir_path) g_free (dir_path); if (rv == -1) return FALSE; return TRUE; }
false
false
false
false
false
0
grab_one(const nstring &project_name) { // // get details of the project // to put in the structure // project_ty *pp = project_alloc(project_name.get_ref()); pp->bind_existing(); rpt_value_struct *rsp = new rpt_value_struct(); rpt_value::pointer result(rsp); nstring pn(project_name_get(pp)); rpt_value::pointer value = rpt_value_string::create(pn); rsp->assign("name", value); int err = project_is_readable(pp); if (err) { rsp->assign("error", rpt_value_string::create(strerror(err))); } else { // // The development directory of the project change is // the one which contains the trunk or branch baseline. // change::pointer cp = pp->change_get(); if (cp->is_being_developed()) { nstring dd(change_development_directory_get(cp, 0)); rsp->assign("directory", rpt_value_string::create(dd)); } value = rpt_value_pstate::create(project_name_get(pp)); rsp->assign("state", value); } project_free(pp); // // all done // return result; }
false
false
false
false
false
0
close_stdio(void) { int fd; if ((fd = open("/dev/null", O_RDWR, 0)) < 0) { return; } else { if (dup2(fd, STDIN_FILENO) < 0) { return; } if (dup2(fd, STDOUT_FILENO) < 0) { return; } if (dup2(fd, STDERR_FILENO) < 0) { return; } if (fd > STDERR_FILENO) { close(fd); } } }
false
false
false
false
false
0
Append_Entry(entry** Entry, char *Variable, char* Value, section *SubSection, int Flag) { if (Entry == NULL) return NULL; if ((Value != NULL && SubSection != NULL) || (Value == NULL && SubSection == NULL)) return NULL; while ((*Entry) != NULL) { if (!strcmp((*Entry)->name,Variable)) { if (Flag & C_OVERWRITE) { entry *Ptr = (*Entry)->next; (*Entry)->next = NULL; free_entry(*Entry); *Entry = Ptr; if (Flag & C_WARN) print_msg("Will overwrite entry `%s'!\n", Variable); } else if (Flag & C_APPEND && SubSection != NULL && (*Entry)->subsection != NULL) { section **Section = &((*Entry)->subsection); while(*Section != NULL) Section = &((*Section)->next); *Section = SubSection; return *Entry; } else return NULL; } else Entry = &((*Entry)->next); } if ((*Entry = (entry*) calloc(1,sizeof(entry))) == NULL) return NULL; if (((*Entry)->name = strdup(Variable)) == NULL) { free_entry(*Entry); *Entry = NULL; return NULL; } if (Value != NULL) { if (!(Flag & C_ALLOW_LAST_BLANKS)) { int len = strlen(Value)-1; while (len >= 0 && isspace(Value[len])) Value[len--] = '\0'; } if (((*Entry)->value = strdup(Value)) == NULL) { free_entry(*Entry); *Entry = NULL; return NULL; } } else /* SubSection != NULL */ (*Entry)->subsection = SubSection; return *Entry; }
false
false
false
false
false
0
set_boot_order() { efi_variable_t boot_order; uint16_t *n = (uint16_t *)boot_order.Data; if (!opts.bootorder) return EFI_SUCCESS; memset(&boot_order, 0, sizeof(boot_order)); fill_var(&boot_order, "BootOrder"); boot_order.DataSize = parse_boot_order(opts.bootorder, n, 1024/sizeof(uint16_t)) * sizeof(uint16_t); if (boot_order.DataSize < 0) return 1; else return create_or_edit_variable(&boot_order); }
false
false
false
false
false
0
set_inout_sides (double x, double y, double wesn[], GMT_LONG sideXY[2]) { /* Given the rectangular region in wesn, return -1, 0, +1 for * x and y if the point is left/below (-1) in (0), or right/above (+1). * */ if (y < wesn[2]) sideXY[1] = -1; else if (y > wesn[3]) sideXY[1] = +1; else sideXY[1] = 0; while ((x + TWO_PI) < wesn[1]) x += TWO_PI; while ((x - TWO_PI) > wesn[0]) x -= TWO_PI; if (x < wesn[0]) sideXY[0] = -1; else if (x > wesn[1]) sideXY[0] = +1; else sideXY[0] = 0; }
false
false
false
false
false
0
_vala_main (gchar** args, int args_length1) { gint result = 0; gint res = 0; gint _tmp3_ = 0; GError * _inner_error_ = NULL; g_test_init (&args_length1, &args, NULL); { mock_service_start ("mock-service-normal.py", &_inner_error_); if (_inner_error_ != NULL) { goto __catch7_g_error; } } goto __finally7; __catch7_g_error: { GError* e = NULL; const gchar* _tmp0_ = NULL; e = _inner_error_; _inner_error_ = NULL; _tmp0_ = e->message; g_error ("test-vala-lang.vala:155: Unable to start mock service: %s", _tmp0_); _g_error_free0 (e); } __finally7: if (_inner_error_ != NULL) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return 0; } { SecretSchema* _tmp1_ = NULL; SecretSchema* _tmp2_ = NULL; _tmp1_ = secret_schema_new ("org.mock.Schema", SECRET_SCHEMA_NONE, "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER, "string", SECRET_SCHEMA_ATTRIBUTE_STRING, "even", SECRET_SCHEMA_ATTRIBUTE_BOOLEAN, NULL); _secret_schema_unref0 (schema); schema = _tmp1_; _tmp2_ = secret_schema_new ("unused.Schema.Name", SECRET_SCHEMA_DONT_MATCH_NAME, "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER, "string", SECRET_SCHEMA_ATTRIBUTE_STRING, NULL); _secret_schema_unref0 (no_name_schema); no_name_schema = _tmp2_; } g_test_add_data_func ("/vala/lookup/sync", NULL, _test_lookup_sync_gtest_data_func); g_test_add_data_func ("/vala/lookup/async", NULL, _test_lookup_async_gtest_data_func); g_test_add_data_func ("/vala/lookup/no-name", NULL, _test_lookup_no_name_gtest_data_func); g_test_add_data_func ("/vala/store/sync", NULL, _test_store_sync_gtest_data_func); g_test_add_data_func ("/vala/store/async", NULL, _test_store_async_gtest_data_func); g_test_add_data_func ("/vala/clear/sync", NULL, _test_clear_sync_gtest_data_func); g_test_add_data_func ("/vala/clear/async", NULL, _test_clear_async_gtest_data_func); _tmp3_ = g_test_run (); res = _tmp3_; secret_service_disconnect (); mock_service_stop (); _secret_schema_unref0 (schema); schema = NULL; result = res; return result; }
false
false
false
false
false
0
report_timeout_period(remote_fencing_op_t * op, int op_timeout) { GListPtr iter = NULL; xmlNode *update = NULL; const char *client_node = NULL; const char *client_id = NULL; const char *call_id = NULL; if (op->call_options & st_opt_sync_call) { /* There is no reason to report the timeout for a syncronous call. It * is impossible to use the reported timeout to do anything when the client * is blocking for the response. This update is only important for * async calls that require a callback to report the results in. */ return; } else if (!op->request) { return; } crm_trace("Reporting timeout for %s.%.8s", op->client_name, op->id); client_node = crm_element_value(op->request, F_STONITH_CLIENTNODE); call_id = crm_element_value(op->request, F_STONITH_CALLID); client_id = crm_element_value(op->request, F_STONITH_CLIENTID); if (!client_node || !call_id || !client_id) { return; } if (safe_str_eq(client_node, stonith_our_uname)) { /* The client is connected to this node, send the update direclty to them */ do_stonith_async_timeout_update(client_id, call_id, op_timeout); return; } /* The client is connected to another node, relay this update to them */ update = stonith_create_op(op->client_callid, op->id, STONITH_OP_TIMEOUT_UPDATE, NULL, 0); crm_xml_add(update, F_STONITH_REMOTE_OP_ID, op->id); crm_xml_add(update, F_STONITH_CLIENTID, client_id); crm_xml_add(update, F_STONITH_CALLID, call_id); crm_xml_add_int(update, F_STONITH_TIMEOUT, op_timeout); send_cluster_message(crm_get_peer(0, client_node), crm_msg_stonith_ng, update, FALSE); free_xml(update); for (iter = op->duplicates; iter != NULL; iter = iter->next) { remote_fencing_op_t *dup = iter->data; crm_trace("Reporting timeout for duplicate %s.%.8s", dup->client_name, dup->id); report_timeout_period(iter->data, op_timeout); } }
false
false
false
false
false
0
bfa_flash_status_read(void __iomem *pci_bar) { union bfa_flash_dev_status_reg_u dev_status; int status; u32 ret_status; int i; status = bfa_flash_fifo_flush(pci_bar); if (status < 0) return status; bfa_flash_set_cmd(pci_bar, 0, 4, 0, BFA_FLASH_READ_STATUS); for (i = 0; i < BFA_FLASH_CHECK_MAX; i++) { status = bfa_flash_cmd_act_check(pci_bar); if (!status) break; } if (status) return status; dev_status.i = readl(pci_bar + FLI_DEV_STATUS_REG); if (!dev_status.r.fifo_cnt) return BFA_FLASH_BUSY; ret_status = readl(pci_bar + FLI_RDDATA_REG); ret_status >>= 24; status = bfa_flash_fifo_flush(pci_bar); if (status < 0) return status; return ret_status; }
false
false
false
false
false
0
tracker_sparql_builder_delete_open (TrackerSparqlBuilder* self, const gchar* graph) { TrackerSparqlBuilderState _tmp0_ = 0; TrackerSparqlBuilderState _tmp1_ = 0; TrackerSparqlBuilderState* _tmp2_ = NULL; gint _tmp2__length1 = 0; const gchar* _tmp3_ = NULL; #line 263 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" g_return_if_fail (self != NULL); #line 263 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp0_ = tracker_sparql_builder_get_state (self); #line 263 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp1_ = _tmp0_; #line 263 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" g_return_if_fail (_tmp1_ == TRACKER_SPARQL_BUILDER_STATE_UPDATE); #line 266 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp2_ = self->priv->states; #line 266 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp2__length1 = self->priv->states_length1; #line 266 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _vala_array_add7 (&self->priv->states, &self->priv->states_length1, &self->priv->_states_size_, TRACKER_SPARQL_BUILDER_STATE_DELETE); #line 267 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp3_ = graph; #line 267 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" if (_tmp3_ != NULL) { #line 648 "tracker-builder.c" GString* _tmp4_ = NULL; const gchar* _tmp5_ = NULL; gchar* _tmp6_ = NULL; gchar* _tmp7_ = NULL; #line 268 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp4_ = self->priv->str; #line 268 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp5_ = graph; #line 268 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp6_ = g_strdup_printf ("DELETE FROM <%s> {\n", _tmp5_); #line 268 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp7_ = _tmp6_; #line 268 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" g_string_append (_tmp4_, _tmp7_); #line 268 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _g_free0 (_tmp7_); #line 665 "tracker-builder.c" } else { GString* _tmp8_ = NULL; #line 270 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" _tmp8_ = self->priv->str; #line 270 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-sparql/tracker-builder.vala" g_string_append (_tmp8_, "DELETE {\n"); #line 672 "tracker-builder.c" } }
false
false
false
false
false
0
rb_class_path(klass) VALUE klass; { VALUE path = classname(klass); if (!NIL_P(path)) return path; if (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, tmp_classpath, &path)) { return path; } else { char *s = "Class"; size_t len; if (TYPE(klass) == T_MODULE) { if (rb_obj_class(klass) == rb_cModule) { s = "Module"; } else { s = rb_class2name(RBASIC(klass)->klass); } } len = 2 + strlen(s) + 3 + 2 * SIZEOF_LONG + 1; path = rb_str_new(0, len); snprintf(RSTRING(path)->ptr, len+1, "#<%s:0x%lx>", s, klass); RSTRING(path)->len = strlen(RSTRING(path)->ptr); rb_ivar_set(klass, tmp_classpath, path); return path; } }
false
false
false
false
false
0
binlog_commit_flush_trx_cache(THD *thd, binlog_cache_mngr *cache_mngr, my_xid xid) { Xid_log_event end_evt(thd, xid); return (binlog_flush_cache(thd, &cache_mngr->trx_cache, &end_evt, TRUE)); }
false
false
false
false
false
0
mono_seq_point_iterator_next (SeqPointIterator* it) { if (it->ptr >= it->end) return FALSE; it->ptr += seq_point_read (&it->seq_point, it->ptr, it->begin, it->has_debug_data); return TRUE; }
false
false
false
false
false
0
keycode_to_string(KeyCode keycode, GtkWidget* widget) { gchar *keyname; KeySym sym; Display *display; keyname = NULL; display = widget ? GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(widget)) : GDK_DISPLAY(); sym = XKeycodeToKeysym(display, keycode, 0); if (sym != NoSymbol) keyname = XKeysymToString(sym); return keyname; }
false
false
false
false
false
0
get_table(const string &name) { if (d_container) { return d_container->get_attr_table(name); } return d_attrs.get_attr_table(name); }
false
false
false
false
false
0
cph_iface_mechanism_call_devices_get_sync ( CphIfaceMechanism *proxy, gint arg_timeout, gint arg_limit, const gchar *const *arg_include_schemes, const gchar *const *arg_exclude_schemes, gchar **out_error, GVariant **out_devices, GCancellable *cancellable, GError **error) { GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "DevicesGet", g_variant_new ("(ii^as^as)", arg_timeout, arg_limit, arg_include_schemes, arg_exclude_schemes), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(s@a{ss})", out_error, out_devices); g_variant_unref (_ret); _out: return _ret != NULL; }
false
false
false
false
false
0
intel_commit_scheduling(struct cpu_hw_events *cpuc, int idx, int cntr) { struct intel_excl_cntrs *excl_cntrs = cpuc->excl_cntrs; struct event_constraint *c = cpuc->event_constraint[idx]; struct intel_excl_states *xl; int tid = cpuc->excl_thread_id; if (cpuc->is_fake || !is_ht_workaround_enabled()) return; if (WARN_ON_ONCE(!excl_cntrs)) return; if (!(c->flags & PERF_X86_EVENT_DYNAMIC)) return; xl = &excl_cntrs->states[tid]; lockdep_assert_held(&excl_cntrs->lock); if (c->flags & PERF_X86_EVENT_EXCL) xl->state[cntr] = INTEL_EXCL_EXCLUSIVE; else xl->state[cntr] = INTEL_EXCL_SHARED; }
false
false
false
false
false
0
setVariable(const char * const variableName, const int * const groupcodes, const dimeParam * const params, const int numparams, dimeMemHandler * const memhandler) { int i = findVariable(variableName); if (i < 0) { i = this->records.count(); dimeStringRecord *sr = (dimeStringRecord*)dimeRecord::createRecord(9, memhandler); if (!sr) return false; sr->setString(variableName, memhandler); this->records.append(sr); for (int j = 0; j < numparams; j++) { this->records.append(dimeRecord::createRecord(groupcodes[j], memhandler)); } } i++; int cnt = 0; for (int j = 0; j < numparams; j++) { int k = i; int n = this->records.count(); while (k < n && this->records[k]->getGroupCode() != groupcodes[j] && this->records[k]->getGroupCode() != 9) { k++; } if (k < n && this->records[k]->getGroupCode() == groupcodes[j]) { cnt++; this->records[k]->setValue(params[j]); } } return cnt; }
false
false
false
false
false
0
elementprint(Arc::XMLNode element,const std::string& ns,const std::string& ntype,std::ostream& h_file,std::ostream& cpp_file,std::string& complex_file_constructor_cpp) { std::string etype = element.Attribute("type"); elementprintnamed(etype,element,ns,ntype,h_file,cpp_file,complex_file_constructor_cpp); }
false
false
false
false
false
0
test_engine_unavailable_plugin (PeasEngine *engine) { PeasPluginInfo *info; testing_util_push_log_hook ("Could not find plugin 'does-not-exist'*"); info = peas_engine_get_plugin_info (engine, "unavailable"); g_assert (!peas_engine_load_plugin (engine, info)); g_assert (!peas_plugin_info_is_loaded (info)); g_assert (!peas_plugin_info_is_available (info, NULL)); }
false
false
false
false
false
0
setTemplateFile(QString filename) { if(filename.isEmpty()) { switch(m_outputType) { case Html: filename = DEFAULT_HTML_TEMPLATE; break; case Latex: filename = DEFAULT_LATEX_TEMPLATE; break; case NotationWidget: filename = DEFAULT_NOTATION_TEMPLATE; break; case Pgn: filename = DEFAULT_PGN_TEMPLATE; break; default : qWarning("Could not decide which template file to use. Maybe strange OutputType"); } } if(!QFile::exists(filename)) { QString dataPath = AppSettings->dataPath(); m_templateFilename = dataPath + "/" + TEMPLATE_DIR + "/" + filename; if(!QFile::exists(m_templateFilename)) { m_templateFilename = ":/" + TEMPLATE_DIR + "/" + filename; } } else { m_templateFilename = filename; } }
false
false
false
false
false
0
AcpiNsSortList ( ACPI_OPERAND_OBJECT **Elements, UINT32 Count, UINT32 Index, UINT8 SortDirection) { ACPI_OPERAND_OBJECT *ObjDesc1; ACPI_OPERAND_OBJECT *ObjDesc2; ACPI_OPERAND_OBJECT *TempObj; UINT32 i; UINT32 j; /* Simple bubble sort */ for (i = 1; i < Count; i++) { for (j = (Count - 1); j >= i; j--) { ObjDesc1 = Elements[j-1]->Package.Elements[Index]; ObjDesc2 = Elements[j]->Package.Elements[Index]; if (((SortDirection == ACPI_SORT_ASCENDING) && (ObjDesc1->Integer.Value > ObjDesc2->Integer.Value)) || ((SortDirection == ACPI_SORT_DESCENDING) && (ObjDesc1->Integer.Value < ObjDesc2->Integer.Value))) { TempObj = Elements[j-1]; Elements[j-1] = Elements[j]; Elements[j] = TempObj; } } } }
false
false
false
false
false
0
GNUNET_DISK_directory_scan (const char *dirName, GNUNET_FileNameCallback callback, void *callback_cls) { DIR *dinfo; struct dirent *finfo; struct stat istat; int count = 0; char *name; char *dname; unsigned int name_len; unsigned int n_size; GNUNET_assert (dirName != NULL); dname = GNUNET_STRINGS_filename_expand (dirName); if (dname == NULL) return GNUNET_SYSERR; while ((strlen (dname) > 0) && (dname[strlen (dname) - 1] == DIR_SEPARATOR)) dname[strlen (dname) - 1] = '\0'; if (0 != STAT (dname, &istat)) { LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", dname); GNUNET_free (dname); return GNUNET_SYSERR; } if (!S_ISDIR (istat.st_mode)) { LOG (GNUNET_ERROR_TYPE_WARNING, _("Expected `%s' to be a directory!\n"), dirName); GNUNET_free (dname); return GNUNET_SYSERR; } errno = 0; dinfo = OPENDIR (dname); if ((errno == EACCES) || (dinfo == NULL)) { LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "opendir", dname); if (dinfo != NULL) CLOSEDIR (dinfo); GNUNET_free (dname); return GNUNET_SYSERR; } name_len = 256; n_size = strlen (dname) + name_len + 2; name = GNUNET_malloc (n_size); while ((finfo = READDIR (dinfo)) != NULL) { if ((0 == strcmp (finfo->d_name, ".")) || (0 == strcmp (finfo->d_name, ".."))) continue; if (callback != NULL) { if (name_len < strlen (finfo->d_name)) { GNUNET_free (name); name_len = strlen (finfo->d_name); n_size = strlen (dname) + name_len + 2; name = GNUNET_malloc (n_size); } /* dname can end in "/" only if dname == "/"; * if dname does not end in "/", we need to add * a "/" (otherwise, we must not!) */ GNUNET_snprintf (name, n_size, "%s%s%s", dname, (strcmp (dname, DIR_SEPARATOR_STR) == 0) ? "" : DIR_SEPARATOR_STR, finfo->d_name); if (GNUNET_OK != callback (callback_cls, name)) { CLOSEDIR (dinfo); GNUNET_free (name); GNUNET_free (dname); return GNUNET_SYSERR; } } count++; } CLOSEDIR (dinfo); GNUNET_free (name); GNUNET_free (dname); return count; }
false
false
false
false
false
0
initialize() { const qreal dist_x = 1.11; const qreal smallNeg = -1e-6; setDeckContents(); talon = new PatPile( this, 0, "talon" ); talon->setPileRole(PatPile::Stock); talon->setLayoutPos(0, smallNeg); talon->setSpread(0, 0); talon->setKeyboardSelectHint( KCardPile::NeverFocus ); talon->setKeyboardDropHint( KCardPile::NeverFocus ); connect( talon, SIGNAL(clicked(KCard*)), SLOT(drawDealRowOrRedeal()) ); waste = new PatPile( this, 8, "waste" ); waste->setPileRole(PatPile::Foundation); waste->setLayoutPos(1.1, smallNeg); waste->setSpread(0.12, 0); waste->setRightPadding( 5 * dist_x ); waste->setWidthPolicy( KCardPile::GrowRight ); waste->setKeyboardSelectHint( KCardPile::NeverFocus ); waste->setKeyboardDropHint( KCardPile::AutoFocusTop ); for( int r = 0; r < 7; ++r ) { stack[r] = new PatPile( this, 1 + r, QString("stack%1").arg(r) ); stack[r]->setPileRole(PatPile::Tableau); stack[r]->setLayoutPos(r*dist_x,0); // Manual tweak of the pile z values to make some animations better. stack[r]->setZValue((7-r)/100.0); stack[r]->setBottomPadding( 1.3 ); stack[r]->setHeightPolicy( KCardPile::GrowDown ); stack[r]->setKeyboardSelectHint( KCardPile::AutoFocusTop ); stack[r]->setKeyboardDropHint( KCardPile::NeverFocus ); } setActions(DealerScene::Hint | DealerScene::Demo | DealerScene::Draw); setSolver( new GolfSolver( this ) ); connect( this, SIGNAL(cardClicked(KCard*)), this, SLOT(tryAutomaticMove(KCard*)) ); }
false
false
false
false
false
0
stv0288_init(struct dvb_frontend *fe) { struct stv0288_state *state = fe->demodulator_priv; int i; u8 reg; u8 val; dprintk("stv0288: init chip\n"); stv0288_writeregI(state, 0x41, 0x04); msleep(50); /* we have default inittab */ if (state->config->inittab == NULL) { for (i = 0; !(stv0288_inittab[i] == 0xff && stv0288_inittab[i + 1] == 0xff); i += 2) stv0288_writeregI(state, stv0288_inittab[i], stv0288_inittab[i + 1]); } else { for (i = 0; ; i += 2) { reg = state->config->inittab[i]; val = state->config->inittab[i+1]; if (reg == 0xff && val == 0xff) break; stv0288_writeregI(state, reg, val); } } return 0; }
false
false
false
false
false
0
mgt_SHM_Create(void) { size_t size; void *p; char fnbuf[64]; int vsm_fd; AZ(heritage.vsm); size = mgt_shm_size(); bprintf(fnbuf, "%s.%jd", VSM_FILENAME, (intmax_t)getpid()); vsm_fd = vsm_zerofile(fnbuf, size); if (vsm_fd < 0) exit(1); p = (void *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED, vsm_fd, 0); AZ(close(vsm_fd)); if (p == MAP_FAILED) { fprintf(stderr, "Mmap error %s: %s\n", fnbuf, strerror(errno)); exit (-1); } mgt_vsm_p = p; mgt_vsm_l = size; /* This may or may not work */ (void)mlock(p, size); heritage.vsm = VSM_common_new(p, size); VSM_common_copy(heritage.vsm, static_vsm); heritage.param = VSM_common_alloc(heritage.vsm, sizeof *heritage.param, VSM_CLASS_PARAM, "", ""); AN(heritage.param); *heritage.param = mgt_param; heritage.panic_str_len = 64 * 1024; heritage.panic_str = VSM_common_alloc(heritage.vsm, heritage.panic_str_len, PAN_CLASS, "", ""); AN(heritage.panic_str); if (rename(fnbuf, VSM_FILENAME)) { fprintf(stderr, "Rename failed %s -> %s: %s\n", fnbuf, VSM_FILENAME, strerror(errno)); (void)unlink(fnbuf); exit (-1); } }
false
false
false
false
false
0
CPLDefaultErrorHandler( CPLErr eErrClass, int nError, const char * pszErrorMsg ) { static int bLogInit = FALSE; static FILE * fpLog = stderr; static int nCount = 0; static int nMaxErrors = -1; if (eErrClass != CE_Debug) { if( nMaxErrors == -1 ) { nMaxErrors = atoi(CPLGetConfigOption( "CPL_MAX_ERROR_REPORTS", "1000" )); } nCount++; if (nCount > nMaxErrors && nMaxErrors > 0 ) return; } if( !bLogInit ) { bLogInit = TRUE; fpLog = stderr; if( CPLGetConfigOption( "CPL_LOG", NULL ) != NULL ) { fpLog = fopen( CPLGetConfigOption("CPL_LOG",""), "wt" ); if( fpLog == NULL ) fpLog = stderr; } } if( eErrClass == CE_Debug ) fprintf( fpLog, "%s\n", pszErrorMsg ); else if( eErrClass == CE_Warning ) fprintf( fpLog, "Warning %d: %s\n", nError, pszErrorMsg ); else fprintf( fpLog, "ERROR %d: %s\n", nError, pszErrorMsg ); if (eErrClass != CE_Debug && nMaxErrors > 0 && nCount == nMaxErrors ) { fprintf( fpLog, "More than %d errors or warnings have been reported. " "No more will be reported from now.\n", nMaxErrors ); } fflush( fpLog ); }
false
false
false
false
false
0
create_contact(const char *con, int type) { struct contact *c = calloc(1, sizeof(struct contact)); if (con != NULL) strncpy(c->nick, con, sizeof(c->nick)); c->default_chatb = c->default_filetransb = type; return (c); }
false
false
false
false
false
0
bnx2x_alloc_fp_mem(struct bnx2x *bp) { int i; /* 1. Allocate FP for leading - fatal if error * 2. Allocate RSS - fix number of queues if error */ /* leading */ if (bnx2x_alloc_fp_mem_at(bp, 0)) return -ENOMEM; /* RSS */ for_each_nondefault_eth_queue(bp, i) if (bnx2x_alloc_fp_mem_at(bp, i)) break; /* handle memory failures */ if (i != BNX2X_NUM_ETH_QUEUES(bp)) { int delta = BNX2X_NUM_ETH_QUEUES(bp) - i; WARN_ON(delta < 0); bnx2x_shrink_eth_fp(bp, delta); if (CNIC_SUPPORT(bp)) /* move non eth FPs next to last eth FP * must be done in that order * FCOE_IDX < FWD_IDX < OOO_IDX */ /* move FCoE fp even NO_FCOE_FLAG is on */ bnx2x_move_fp(bp, FCOE_IDX(bp), FCOE_IDX(bp) - delta); bp->num_ethernet_queues -= delta; bp->num_queues = bp->num_ethernet_queues + bp->num_cnic_queues; BNX2X_ERR("Adjusted num of queues from %d to %d\n", bp->num_queues + delta, bp->num_queues); } return 0; }
false
false
false
false
false
0
gs_copy_glyph_options(gs_font *font, gs_glyph glyph, gs_font *copied, int options) { int code; #define MAX_GLYPH_PIECES 64 /* arbitrary, but 32 is too small - bug 687698. */ gs_glyph glyphs[MAX_GLYPH_PIECES]; uint count = 1, i; if (copied->procs.font_info != copied_font_info) return_error(gs_error_rangecheck); code = cf_data(copied)->procs->copy_glyph(font, glyph, copied, options); if (code != 0) return code; /* Copy any sub-glyphs. */ glyphs[0] = glyph; code = psf_add_subset_pieces(glyphs, &count, MAX_GLYPH_PIECES, MAX_GLYPH_PIECES, font); if (code < 0) return code; if (count > MAX_GLYPH_PIECES) return_error(gs_error_limitcheck); for (i = 1; i < count; ++i) { code = gs_copy_glyph_options(font, glyphs[i], copied, (options & ~COPY_GLYPH_NO_OLD) | COPY_GLYPH_BY_INDEX); if (code < 0) return code; /* if code > 0 then we already have the glyph, so no need to process further. * If the original glyph was not a CID then we are copying by name, not by index. * But the copy above copies by index which means we don't have an entry for * the glyp-h component in the name table. If we are using names then we * absolutely *must* have an entry in the name table, so go ahead and add * one here. Note that the array returned by psf_add_subset_pieces has the * GIDs with an offset of GS_MIN_GLYPH_INDEX added. Previously we removed this * offset, but if the resulting GID referenced a name already in use (or later used) * then the generated CMAP was incorrect. By leaving the offset in place we get * a name generated (numeric name based on GID) which gurantees no name collisions. * (Bug #693444). */ if (code == 0 && glyph < GS_MIN_CID_GLYPH && glyphs[i] > GS_MIN_GLYPH_INDEX) { code = copy_glyph_name(font, glyphs[i], copied, glyphs[i]); if (code < 0) return code; } } /* * Because 'seac' accesses the Encoding of the font as well as the * glyphs, we have to copy the Encoding entries as well. */ if (count == 1) return 0; switch (font->FontType) { case ft_encrypted: case ft_encrypted2: break; default: return 0; } #if 0 /* No need to add subglyphs to the Encoding because they always are taken from StandardEncoding (See the Type 1 spec about 'seac'). Attempt to add them to the encoding can cause a conflict, if the encoding specifies different glyphs for these char codes (See the bug #687172). */ { gs_copied_glyph_t *pcg; gs_glyph_data_t gdata; gs_char chars[2]; gdata.memory = font->memory; /* Since we just copied the glyph, copied_glyph_slot can't fail. */ DISCARD(copied_glyph_slot(cf_data(copied), glyph, &pcg)); gs_glyph_data_from_string(&gdata, pcg->gdata.data, pcg->gdata.size, NULL); code = gs_type1_piece_codes((gs_font_type1 *)font, &gdata, chars); if (code <= 0 || /* 0 is not possible here */ (code = gs_copied_font_add_encoding(copied, chars[0], glyphs[1])) < 0 || (code = gs_copied_font_add_encoding(copied, chars[1], glyphs[2])) < 0 ) return code; } #endif return 0; #undef MAX_GLYPH_PIECES }
false
false
false
false
false
0
translate_page_flags(char *buffer, ulong flags) { char buf[BUFSIZE]; int i, others; sprintf(buf, "%lx", flags); if (flags) { for (i = others = 0; i < vt->nr_pageflags; i++) { if (flags & vt->pageflags_data[i].mask) sprintf(&buf[strlen(buf)], "%s%s", others++ ? "," : " ", vt->pageflags_data[i].name); } } strcat(buf, "\n"); strcpy(buffer, buf); return(strlen(buf)); }
true
true
false
false
false
1
SHA512_Final(SHA512_State *s, unsigned char *digest) { int i; int pad; unsigned char c[BLKSIZE]; uint32 len[4]; if (s->blkused >= BLKSIZE-16) pad = (BLKSIZE-16) + BLKSIZE - s->blkused; else pad = (BLKSIZE-16) - s->blkused; for (i = 4; i-- ;) { uint32 lenhi = s->len[i]; uint32 lenlo = i > 0 ? s->len[i-1] : 0; len[i] = (lenhi << 3) | (lenlo >> (32-3)); } memset(c, 0, pad); c[0] = 0x80; SHA512_Bytes(s, &c, pad); for (i = 0; i < 4; i++) { c[i*4+0] = (len[3-i] >> 24) & 0xFF; c[i*4+1] = (len[3-i] >> 16) & 0xFF; c[i*4+2] = (len[3-i] >> 8) & 0xFF; c[i*4+3] = (len[3-i] >> 0) & 0xFF; } SHA512_Bytes(s, &c, 16); for (i = 0; i < 8; i++) { uint32 h, l; EXTRACT(h, l, s->h[i]); digest[i*8+0] = (h >> 24) & 0xFF; digest[i*8+1] = (h >> 16) & 0xFF; digest[i*8+2] = (h >> 8) & 0xFF; digest[i*8+3] = (h >> 0) & 0xFF; digest[i*8+4] = (l >> 24) & 0xFF; digest[i*8+5] = (l >> 16) & 0xFF; digest[i*8+6] = (l >> 8) & 0xFF; digest[i*8+7] = (l >> 0) & 0xFF; } }
false
false
false
false
false
0
gotincl() { token822_reverse(&tokaddr); if (token822_unquote(&address,&tokaddr) != 1) nomem(); tokaddr.len = 0; if (!address.len) strerr_die2x(111,FATAL,"empty :include: filenames not permitted"); if (byte_chr(address.s,address.len,'\0') < address.len) strerr_die2x(111,FATAL,"NUL not permitted in :include: filenames"); if ((address.s[0] != '.') && (address.s[0] != '/')) if (!stralloc_cats(&instr,"./")) nomem(); if (!stralloc_cat(&instr,&address)) nomem(); if (!stralloc_cats(&instr,".bin")) nomem(); if (!stralloc_0(&instr)) nomem(); }
false
false
false
false
false
0
getResource ( const Resources& res ) const { Resources result; for ( int i = 0; i < resourceNum; i++ ) result.resource(i) = getAvailableResource ( res.resource(i), i ); return result; }
false
false
false
false
false
0
add_group(struct group *grp, gid_t **groups_res, char*** group_names_res, int* ngroups_res, int* maxgroups_res) { int ngroups = *ngroups_res; int maxgroups = *maxgroups_res; gid_t *groups = *groups_res; char** group_names = *group_names_res; if (ngroups >= maxgroups) { gid_t *new_groups; char **new_group_names; maxgroups +=10; new_groups = (gid_t*)realloc(groups, sizeof(gid_t) * maxgroups); if (new_groups == NULL) { return -1; } groups = new_groups; new_group_names = (char**)realloc(group_names, sizeof(char*) * maxgroups); if(new_group_names == NULL) { return -1; } group_names = new_group_names; } groups[ngroups] = grp->gr_gid; group_names[ngroups++] = strdup(grp->gr_name); *ngroups_res = ngroups; *maxgroups_res = maxgroups; *groups_res = groups; *group_names_res = group_names; return 0; }
false
false
false
false
false
0
csio_get_fcoe_resinfo(struct csio_hw *hw) { struct csio_fcoe_res_info *res_info = &hw->fres_info; struct fw_fcoe_res_info_cmd *rsp; struct csio_mb *mbp; enum fw_retval retval; mbp = mempool_alloc(hw->mb_mempool, GFP_ATOMIC); if (!mbp) { CSIO_INC_STATS(hw, n_err_nomem); return -ENOMEM; } /* Get FCoE FW resource information */ csio_fcoe_read_res_info_init_mb(hw, mbp, CSIO_MB_DEFAULT_TMO, NULL); if (csio_mb_issue(hw, mbp)) { csio_err(hw, "failed to issue FW_FCOE_RES_INFO_CMD\n"); mempool_free(mbp, hw->mb_mempool); return -EINVAL; } rsp = (struct fw_fcoe_res_info_cmd *)(mbp->mb); retval = FW_CMD_RETVAL_G(ntohl(rsp->retval_len16)); if (retval != FW_SUCCESS) { csio_err(hw, "FW_FCOE_RES_INFO_CMD failed with ret x%x\n", retval); mempool_free(mbp, hw->mb_mempool); return -EINVAL; } res_info->e_d_tov = ntohs(rsp->e_d_tov); res_info->r_a_tov_seq = ntohs(rsp->r_a_tov_seq); res_info->r_a_tov_els = ntohs(rsp->r_a_tov_els); res_info->r_r_tov = ntohs(rsp->r_r_tov); res_info->max_xchgs = ntohl(rsp->max_xchgs); res_info->max_ssns = ntohl(rsp->max_ssns); res_info->used_xchgs = ntohl(rsp->used_xchgs); res_info->used_ssns = ntohl(rsp->used_ssns); res_info->max_fcfs = ntohl(rsp->max_fcfs); res_info->max_vnps = ntohl(rsp->max_vnps); res_info->used_fcfs = ntohl(rsp->used_fcfs); res_info->used_vnps = ntohl(rsp->used_vnps); csio_dbg(hw, "max ssns:%d max xchgs:%d\n", res_info->max_ssns, res_info->max_xchgs); mempool_free(mbp, hw->mb_mempool); return 0; }
false
false
false
false
false
0
tlg_has_seq_loop(LoopDat *lpdat_head, IntSet mt_set) { LoopDat *lpdat; IntSet seq_loop_set; copy_construct_IntSet(seq_loop_set, mt_set); clear_IntSet(seq_loop_set); for(lpdat = lpdat_head; lpdat != NULL; lpdat = lpdat->next){ if(lpdat->bpt->kind == LOOP) add1_IntSet(seq_loop_set, lpdat->loopno); } return seq_loop_set; }
false
false
false
false
true
1
bnx2x_warpcore_reset_lane(struct bnx2x *bp, struct bnx2x_phy *phy, u8 reset) { u16 val; /* Take lane out of reset after configuration is finished */ bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC6, &val); if (reset) val |= 0xC000; else val &= 0x3FFF; bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC6, val); bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC6, &val); }
false
false
false
false
false
0
gst_bayer2rgb_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps) { GstBayer2RGB *bayer2rgb = GST_BAYER2RGB (base); GstStructure *structure; int val, bpp; const char *format; GST_DEBUG ("in caps %" GST_PTR_FORMAT " out caps %" GST_PTR_FORMAT, incaps, outcaps); structure = gst_caps_get_structure (incaps, 0); gst_structure_get_int (structure, "width", &bayer2rgb->width); gst_structure_get_int (structure, "height", &bayer2rgb->height); bayer2rgb->stride = GST_ROUND_UP_4 (bayer2rgb->width); format = gst_structure_get_string (structure, "format"); if (g_str_equal (format, "bggr")) { bayer2rgb->format = GST_BAYER_2_RGB_FORMAT_BGGR; } else if (g_str_equal (format, "gbrg")) { bayer2rgb->format = GST_BAYER_2_RGB_FORMAT_GBRG; } else if (g_str_equal (format, "grbg")) { bayer2rgb->format = GST_BAYER_2_RGB_FORMAT_GRBG; } else if (g_str_equal (format, "rggb")) { bayer2rgb->format = GST_BAYER_2_RGB_FORMAT_RGGB; } else { return FALSE; } /* To cater for different RGB formats, we need to set params for later */ structure = gst_caps_get_structure (outcaps, 0); gst_structure_get_int (structure, "bpp", &bpp); bayer2rgb->pixsize = bpp / 8; gst_structure_get_int (structure, "red_mask", &val); bayer2rgb->r_off = get_pix_offset (val, bpp); gst_structure_get_int (structure, "green_mask", &val); bayer2rgb->g_off = get_pix_offset (val, bpp); gst_structure_get_int (structure, "blue_mask", &val); bayer2rgb->b_off = get_pix_offset (val, bpp); return TRUE; }
false
false
false
false
false
0
IsMember(OBBond *b) { return((_pathset.BitIsOn(b->GetBeginAtomIdx()))&&(_pathset.BitIsOn(b->GetEndAtomIdx()))); }
false
false
false
false
false
0
valid_varname(varname) char_u *varname; { char_u *p; for (p = varname; *p != NUL; ++p) if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) && *p != AUTOLOAD_CHAR) { EMSG2(_(e_illvar), varname); return FALSE; } return TRUE; }
false
false
false
false
false
0
qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 9) qt_static_metacall(this, _c, _id, _a); _id -= 9; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isAvailable(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
false
false
false
false
false
0
configure_rx_dma(uint32_t usart_index, enum buffer_operations operation_performed) { freertos_pdc_rx_control_t *rx_buffer_definition; rx_buffer_definition = &(rx_buffer_definitions[usart_index]); /* How much space is there between the start of the DMA buffer and the current read pointer? */ if (((uint32_t)rx_buffer_definition->next_byte_to_read) == rx_buffer_definition->rx_pdc_parameters.ul_addr) { /* The read pointer and the write pointer are equal. If this function was called because data was added to the buffer, then there is no free space in the buffer remaining. If this function was called because data was removed from the buffer, then the space remaining is from the write pointer up to the end of the buffer. */ if (operation_performed == data_added) { rx_buffer_definition->rx_pdc_parameters.ul_size = 0UL; } else { rx_buffer_definition->rx_pdc_parameters.ul_size = rx_buffer_definition->past_rx_buffer_end_address - rx_buffer_definition->rx_pdc_parameters.ul_addr; } } else if (((uint32_t)rx_buffer_definition->next_byte_to_read) > rx_buffer_definition->rx_pdc_parameters.ul_addr) { /* The read pointer is ahead of the write pointer. The space available is up to the write pointer to ensure unread data is not overwritten. */ rx_buffer_definition->rx_pdc_parameters.ul_size = ((uint32_t) rx_buffer_definition->next_byte_to_read) - rx_buffer_definition->rx_pdc_parameters.ul_addr; } else { /* The write pointer is ahead of the read pointer so the space available is up to the end of the buffer. */ rx_buffer_definition->rx_pdc_parameters.ul_size = rx_buffer_definition->past_rx_buffer_end_address - rx_buffer_definition->rx_pdc_parameters.ul_addr; } configASSERT((rx_buffer_definition->rx_pdc_parameters.ul_size + rx_buffer_definition->rx_pdc_parameters.ul_size) <= rx_buffer_definition->past_rx_buffer_end_address); if (rx_buffer_definition->rx_pdc_parameters.ul_size > 0) { /* Restart the DMA to receive into whichever space was calculated as remaining. First clear any characters that might already be in the registers. */ pdc_rx_init( all_usart_definitions[usart_index].pdc_base_address, &rx_buffer_definition->rx_pdc_parameters, NULL); pdc_enable_transfer( all_usart_definitions[usart_index].pdc_base_address, PERIPH_PTCR_RXTEN); usart_enable_interrupt( all_usart_definitions[usart_index].peripheral_base_address, US_IER_ENDRX | US_IER_TIMEOUT); } else { /* The write pointer has reached the read pointer. There is no more room so the DMA is not re-enabled until a read has created space. */ usart_disable_interrupt( all_usart_definitions[usart_index].peripheral_base_address, US_IER_ENDRX | US_IER_TIMEOUT); } }
false
false
false
false
false
0
nameGetter(ExecState *exec, JSObject*, const Identifier& propertyName, const PropertySlot& slot) { Plugin *thisObj = static_cast<Plugin *>(slot.slotBase()); return thisObj->mimeByName(exec, propertyName.qstring()); }
false
false
false
false
false
0
ptaGetPt(PTA *pta, l_int32 index, l_float32 *px, l_float32 *py) { PROCNAME("ptaGetPt"); if (!pta) return ERROR_INT("pta not defined", procName, 1); *px = pta->x[index]; *py = pta->y[index]; return 0; }
false
false
false
false
false
0
log_scale(int cent, double set) { if (cent == 0) { return set; } else if (cent < 2 && cent > -2) { // 1 cent if (set<0.0) return set - 0.0155; else return set + 0.0155; } else if (cent < 3 && cent > -3) { // 2 cent if (set<0.0) return set - 0.0265; else return set + 0.0265; }else if (cent < 4 && cent > -4) { // 3 cent if (set<0.0) return set - 0.0355; else return set + 0.0355; } else if (cent < 5 && cent > -5) { // 4 cent if (set<0.0) return set - 0.0455; else return set + 0.0455; } else if (cent < 6 && cent > -6) { // 5 cent if (set<0.0) return set - 0.0435; else return set + 0.0435; } else if (cent < 7 && cent > -7) { // 6 cent if (set<0.0) return set - 0.0425; else return set + 0.0425; } else if (cent < 8 && cent > -8) { // 7 cent if (set<0.0) return set - 0.0415; else return set + 0.0415; } else if (cent < 9 && cent > -9) { // 8 cent if (set<0.0) return set - 0.0405; else return set + 0.0405; } else if (cent < 10 && cent > -10) { // 9 cent if (set<0.0) return set - 0.0385; else return set + 0.0385; } else if (cent < 11 && cent > -11) { // 10 cent if (set<0.0) return set - 0.0365; else return set + 0.0365; } else if (cent < 51 && cent > -51) { // < 50 cent return set + (0.4/cent); } else return set; }
false
false
false
false
false
0