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
vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) { unsigned int i; vec<data_reference_p> datarefs; struct data_reference *dr; if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "=== vect_analyze_data_ref_accesses ==="); if (loop_vinfo) datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); else datarefs = BB_VINFO_DATAREFS (bb_vinfo); FOR_EACH_VEC_ELT (datarefs, i, dr) if (STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) && !vect_analyze_data_ref_access (dr)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "not vectorized: complicated access pattern."); if (bb_vinfo) { /* Mark the statement as not vectorizable. */ STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (DR_STMT (dr))) = false; continue; } else return false; } return true; }
false
false
false
false
false
0
r200LightModelfv( struct gl_context *ctx, GLenum pname, const GLfloat *param ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); switch (pname) { case GL_LIGHT_MODEL_AMBIENT: update_global_ambient( ctx ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: r200UpdateLocalViewer( ctx ); break; case GL_LIGHT_MODEL_TWO_SIDE: R200_STATECHANGE( rmesa, tcl ); if (ctx->Light.Model.TwoSide) rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] |= R200_LIGHT_TWOSIDE; else rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~(R200_LIGHT_TWOSIDE); if (rmesa->radeon.TclFallback) { r200ChooseRenderState( ctx ); r200ChooseVertexState( ctx ); } break; case GL_LIGHT_MODEL_COLOR_CONTROL: r200UpdateSpecular(ctx); break; default: break; } }
false
false
false
false
false
0
handleRead(int rpipe, unsigned int &result) { char type = 0; if (read(rpipe, &type, 1) <= 0) { if (errno == EAGAIN) return 0; return -1; } if (type != REPORT_OUT && type != REPORT_ERROR && type != CHILD_END) { std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl; exit(0); } unsigned int len = 0; if (read(rpipe, &len, sizeof(len)) <= 0) { std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl; exit(0); } char *buf = new char[len]; if (read(rpipe, buf, len) <= 0) { std::cerr << "#### You found a bug from cppcheck.\nThreadExecutor::handleRead error, type was:" << type << std::endl; exit(0); } if (type == REPORT_OUT) { _errorLogger.reportOut(buf); } else if (type == REPORT_ERROR) { ErrorLogger::ErrorMessage msg; msg.deserialize(buf); std::string file; unsigned int line(0); if (!msg._callStack.empty()) { file = msg._callStack.back().getfile(false); line = msg._callStack.back().line; } if (!_settings.nomsg.isSuppressed(msg._id, file, line)) { // Alert only about unique errors std::string errmsg = msg.toString(_settings._verbose); if (std::find(_errorList.begin(), _errorList.end(), errmsg) == _errorList.end()) { _errorList.push_back(errmsg); _errorLogger.reportErr(msg); } } } else if (type == CHILD_END) { std::istringstream iss(buf); unsigned int fileResult = 0; iss >> fileResult; result += fileResult; delete [] buf; return -1; } delete [] buf; return 1; }
false
false
false
false
false
0
arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp) { if (!*dev) *dev = &x86_dma_fallback_dev; *gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); *gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp); if (!is_device_dma_capable(*dev)) return false; return true; }
false
false
false
false
false
0
gammln( double X ) // Returns the value ln[gamma(X)] for X. // The gamma function is defined by the integral gamma(z) = int(0, +inf, t^(z-1).e^(-t)dt). // When the argument z is an integer, the gamma function is just the familiar factorial // function, but offset by one, n! = gamma(n + 1). { double x, y, tmp, ser; static double cof[6] = { 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5 }; y = x = X; tmp = x + 5.5; tmp -= (x+0.5) * log(tmp); ser = 1.000000000190015; for ( int8_t j = 0 ; j <= 5 ; j++ ) { ser += cof[j] / ++y; } return -tmp + log(2.5066282746310005 * ser / x); }
false
false
false
false
false
0
gauss_guess(gint n_dat, const gdouble *x, const gdouble *y, gdouble *param, gboolean *fres) { gint i, imax; param[1] = G_MAXDOUBLE; param[2] = -G_MAXDOUBLE; imax = 0; for (i = 0; i < n_dat; i++) { param[0] += x[i]/n_dat; if (param[1] > y[i]) { param[1] = y[i]; } if (param[2] < y[i]) { param[2] = y[i]; imax = i; } } param[2] -= param[1]; param[0] = x[imax]; param[3] = (x[n_dat-1] - x[0])/2/G_SQRT2; *fres = TRUE; }
false
false
false
false
false
0
dc_sound_set_kill(int script, int* yield, int* preturnint, int sound_bank) { if (sound_on && sound_bank > 0) sound_set_kill(sound_bank); }
false
false
false
false
false
0
isShort(const size_t flags) const { return (FrameList.isEmpty()) || !(flags & DSRTypes::HF_renderFullData); }
false
false
false
false
false
0
fopen_log(const char *fname,const char *access) {//================================================== // performs fopen, but produces error message to f_log if it fails FILE *f; if((f = fopen(fname,access)) == NULL) { if(f_log != NULL) fprintf(f_log,"Can't access (%s) file '%s'\n",access,fname); } return(f); }
false
false
false
false
false
0
scriptlevel( const QwtMmlNode *child ) const { int sl = QwtMmlNode::scriptlevel(); QwtMmlNode *sub = subscript(); QwtMmlNode *sup = superscript(); if ( child != 0 && ( child == sup || child == sub ) ) return sl + 1; else return sl; }
false
false
false
false
false
0
mprJoinPath(cchar *path, cchar *other) { MprFileSystem *fs; char *join, *drive, *cp; int sep; fs = mprLookupFileSystem(path); if (other == NULL || *other == '\0' || strcmp(other, ".") == 0) { return sclone(path); } if (isAbsPath(fs, other)) { if (fs->hasDriveSpecs && !isFullPath(fs, other) && isFullPath(fs, path)) { /* Other is absolute, but without a drive. Use the drive from path. */ drive = sclone(path); if ((cp = strchr(drive, ':')) != 0) { *++cp = '\0'; } return sjoin(drive, other, NULL); } else { return mprNormalizePath(other); } } if (path == NULL || *path == '\0') { return mprNormalizePath(other); } if ((cp = firstSep(fs, path)) != 0) { sep = *cp; } else if ((cp = firstSep(fs, other)) != 0) { sep = *cp; } else { sep = defaultSep(fs); } if ((join = sfmt("%s%c%s", path, sep, other)) == 0) { return 0; } return mprNormalizePath(join); }
false
false
false
false
false
0
crypt(const QString &text, const QString &key) { QByteArray texteEnBytes = text.toUtf8(); QString k = key; if (key.isEmpty()) k = QCryptographicHash::hash(qApp->applicationName().left(qApp->applicationName().indexOf("_d")).toUtf8(), QCryptographicHash::Sha1); QByteArray cle = k.toUtf8().toBase64(); QByteArray codeFinal; int tailleCle = cle.length(); for (int i = 0; i < texteEnBytes.length(); ++i) { codeFinal += char(texteEnBytes[i] ^ cle[i % tailleCle]); } return codeFinal.toHex().toBase64(); }
false
false
false
false
false
0
__sha1_transform(u32 hash[SHA1_DIGEST_WORDS], const u32 in[SHA1_BLOCK_WORDS], u32 W[SHA1_WORKSPACE_WORDS]) { register u32 a, b, c, d, e, t; int i; for (i = 0; i < SHA1_BLOCK_WORDS; i++) W[i] = cpu_to_be32(in[i]); for (i = 0; i < 64; i++) W[i+16] = rol32(W[i+13] ^ W[i+8] ^ W[i+2] ^ W[i], 1); a = hash[0]; b = hash[1]; c = hash[2]; d = hash[3]; e = hash[4]; for (i = 0; i < 20; i++) { t = F1(b, c, d) + K1 + rol32(a, 5) + e + W[i]; e = d; d = c; c = rol32(b, 30); b = a; a = t; } for (; i < 40; i ++) { t = F2(b, c, d) + K2 + rol32(a, 5) + e + W[i]; e = d; d = c; c = rol32(b, 30); b = a; a = t; } for (; i < 60; i ++) { t = F3(b, c, d) + K3 + rol32(a, 5) + e + W[i]; e = d; d = c; c = rol32(b, 30); b = a; a = t; } for (; i < 80; i ++) { t = F2(b, c, d) + K4 + rol32(a, 5) + e + W[i]; e = d; d = c; c = rol32(b, 30); b = a; a = t; } hash[0] += a; hash[1] += b; hash[2] += c; hash[3] += d; hash[4] += e; }
false
false
false
false
false
0
opal_graph_print(opal_graph_t *graph) { opal_adjacency_list_t *aj_list; opal_list_item_t *aj_list_item; opal_graph_edge_t *edge; opal_list_item_t *edge_item; char *tmp_str1, *tmp_str2; bool need_free1, need_free2; /* print header */ opal_output(0, " Graph "); opal_output(0, "===================="); /* run on all the vertices of the graph */ for (aj_list_item = opal_list_get_first(graph->adjacency_list); aj_list_item != opal_list_get_end(graph->adjacency_list); aj_list_item = opal_list_get_next(aj_list_item)) { aj_list = (opal_adjacency_list_t *) aj_list_item; /* print vertex data to temporary string*/ if (NULL != aj_list->vertex->print_vertex) { need_free1 = true; tmp_str1 = aj_list->vertex->print_vertex(aj_list->vertex->vertex_data); } else { need_free1 = false; tmp_str1 = ""; } /* print vertex */ opal_output(0, "V(%s) Connections:",tmp_str1); /* run on all the edges of the vertex */ for (edge_item = opal_list_get_first(aj_list->edges); edge_item != opal_list_get_end(aj_list->edges); edge_item = opal_list_get_next(edge_item)) { edge = (opal_graph_edge_t *)edge_item; /* print the vertex data of the vertex in the end of the edge to a temporary string */ if (NULL != edge->end->print_vertex) { need_free2 = true; tmp_str2 = edge->end->print_vertex(edge->end->vertex_data); } else { need_free2 = false; tmp_str2 = ""; } /* print the edge */ opal_output(0, " E(%s -> %d -> %s)",tmp_str1, edge->weight, tmp_str2); if (need_free2) { free(tmp_str2); } } if (need_free1) { free(tmp_str1); } } }
false
false
false
false
false
0
decrease_mouse_visibility () { DEBUG3("decrease_mouse_visibility: Entering\n"); /* Lock visual before operation */ VISUAL_MUTEX(global_vwk, VISUAL_MUTEX_LOCK); mouse_visibility--; if (mouse_visibility == 0) { VISUAL_SET_WRITE_MODE(global_vwk, MD_REPLACE); VISUAL_RESTORE_MOUSE_BG(global_vwk); } /* Unlock visual after operation */ VISUAL_MUTEX(global_vwk, VISUAL_MUTEX_UNLOCK); DEBUG3("decrease_mouse_visibility: Exiting\n"); }
false
false
false
false
false
0
_insert_and_free_related_list (GrlKeyID key, GList *relkeys_list, GrlData *data) { GList *p = relkeys_list; while (p) { grl_data_add_related_keys (data, (GrlRelatedKeys *) p->data); p = g_list_next (p); } g_list_free (relkeys_list); }
false
false
false
false
false
0
twofish_enc_blk_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv) { be128 ctrblk; if (dst != src) *dst = *src; le128_to_be128(&ctrblk, iv); le128_inc(iv); twofish_enc_blk(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk); u128_xor(dst, dst, (u128 *)&ctrblk); }
false
false
false
false
false
0
__free_1glb_flds(struct gref_t *grp) { /* if using this for local qualifed name will be set to nil */ if (grp->gnam != NULL) __my_free((char *) grp->gnam, strlen(grp->gnam + 1)); grp->gnam = NULL; /* also free glb ref exprssion - always in malloced memory here */ __free_xtree(grp->glbref); /* only sized targu is upwards rel list - may not have been alloced yet */ if (grp->upwards_rel && grp->targu.uprel_itps != NULL) { __my_free((char *) grp->targu.uprel_itps, grp->gin_mdp->flatinum*sizeof(struct itree_t *)); } if (grp->grcmps != NULL) { __my_free((char *) grp->grcmps, (grp->last_gri + 1)*sizeof(struct sy_t *)); grp->grcmps = NULL; } if (grp->grxcmps != NULL) { __my_free((char *) grp->grxcmps, (grp->last_gri + 1)*sizeof(struct expr_t *)); grp->grxcmps = NULL; } }
false
false
false
false
false
0
tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line) { switch (tpg->fourcc) { case V4L2_PIX_FMT_SBGGR8: case V4L2_PIX_FMT_SGBRG8: case V4L2_PIX_FMT_SGRBG8: case V4L2_PIX_FMT_SRGGB8: case V4L2_PIX_FMT_SBGGR10: case V4L2_PIX_FMT_SGBRG10: case V4L2_PIX_FMT_SGRBG10: case V4L2_PIX_FMT_SRGGB10: case V4L2_PIX_FMT_SBGGR12: case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: return buf_line & 1; default: return 0; } }
false
false
false
false
false
0
execute(const QString &fileName) { if (fileName.isEmpty()) { kDebug() << "File name empty!"; return; } KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine); kdeclarative.initialize(); //binds things like kconfig and icons kdeclarative.setupBindings(); component->loadUrl(fileName); scriptEngine = kdeclarative.scriptEngine(); registerDataEngineMetaTypes(scriptEngine); if (delay) { QTimer::singleShot(0, q, SLOT(scheduleExecutionEnd())); } else { scheduleExecutionEnd(); } }
false
false
false
false
false
0
field_index_eq(const void *p1, const void *p2) { FieldIndex *fi1 = (FieldIndex *)p1; FieldIndex *fi2 = (FieldIndex *)p2; return (fi1->field == fi2->field) && (fi1->klass->type == fi2->klass->type); }
false
false
false
false
false
0
free_hist_datum(void *datum, const char *file, int line) { Stringfree_fl(datum, file, line); }
false
false
false
false
false
0
quote_blob(char *data, int len, DB_FORMAT_CALLBACK add) { #ifdef ODBC_DEBUG_HEADER fprintf(stderr,"[ODBC][%s][%d]\n",__FILE__,__LINE__); fprintf(stderr,"\tquote_blob\n"); fflush(stderr); #endif int i; unsigned char c; //char buffer[8]; (*add)("'", 1); for (i = 0; i < len; i++) { c = (unsigned char)data[i]; if (c == '\\') (*add)("\\\\\\\\", 4); else if (c == '\'') (*add)("''", 2); else if (c == 0) (*add)("\\\\000", 5); /*else if (c < 32 || c == 127) { int n = sprintf(buffer, "\\\\%03o", c); (*add)(buffer, n); }*/ else (*add)((char *)&c, 1); } (*add)("'", 1); }
false
false
false
false
false
0
jswrap_graphics_stringWidth(JsVar *parent, JsVar *var) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return 0; JsVar *customWidth = 0; int customFirstChar; if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { customWidth = jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_WIDTH, 0); customFirstChar = (int)jsvGetIntegerAndUnLock(jsvObjectGetChild(parent, JSGRAPHICS_CUSTOMFONT_FIRSTCHAR, 0)); } JsVar *str = jsvAsString(var, false); JsvStringIterator it; jsvStringIteratorNew(&it, str, 0); int width = 0; while (jsvStringIteratorHasChar(&it)) { char ch = jsvStringIteratorGetChar(&it); if (gfx.data.fontSize>0) { #ifndef SAVE_ON_FLASH width += (int)graphicsVectorCharWidth(&gfx, gfx.data.fontSize, ch); #endif } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_4X6) { width += 4; } else if (gfx.data.fontSize == JSGRAPHICS_FONTSIZE_CUSTOM) { if (jsvIsString(customWidth)) { if (ch>=customFirstChar) width += (unsigned char)jsvGetCharInString(customWidth, (size_t)(ch-customFirstChar)); } else width += (int)jsvGetInteger(customWidth); } jsvStringIteratorNext(&it); } jsvStringIteratorFree(&it); jsvUnLock(str); jsvUnLock(customWidth); return width; }
false
false
false
false
false
0
S_NameValueList_FindValue( const char *key, int entry_count, EnvisatNameValue **entries, const char *default_value ) { int i; i = S_NameValueList_FindKey( key, entry_count, entries ); if( i == -1 ) return default_value; else return entries[i]->value; }
false
false
false
false
false
0
_vkMarkThis (edict_t * self, edict_t * other) { if (self->client->resp.kickvote == other) return true; return false; }
false
false
false
false
false
0
dirfile(dirname, filename) char *dirname; char *filename; { char *pathname; char *qpathname; int f; if (dirname == NULL || *dirname == '\0') return (NULL); /* * Construct the full pathname. */ pathname = (char *) calloc(strlen(dirname) + strlen(filename) + 2, sizeof(char)); if (pathname == NULL) return (NULL); sprintf(pathname, "%s%s%s", dirname, PATHNAME_SEP, filename); /* * Make sure the file exists. */ qpathname = shell_unquote(pathname); f = open(qpathname, OPEN_READ); if (f < 0) { free(pathname); pathname = NULL; } else { close(f); } free(qpathname); return (pathname); }
false
false
false
false
false
0
garbage_left(enum ARRAY_TYPE isarray, char *scan_length, enum COMPAT_MODE compat) { /* * INFORMIX allows for selecting a numeric into an int, the result is * truncated */ if (isarray == ECPG_ARRAY_NONE && INFORMIX_MODE(compat) && *scan_length == '.') return false; if (isarray == ECPG_ARRAY_ARRAY && *scan_length != ',' && *scan_length != '}') return true; if (isarray == ECPG_ARRAY_VECTOR && *scan_length != ' ' && *scan_length != '\0') return true; if (isarray == ECPG_ARRAY_NONE && *scan_length != ' ' && *scan_length != '\0') return true; return false; }
false
false
false
false
false
0
check_handlers_1 (tree master, tree_stmt_iterator i) { tree type = TREE_TYPE (master); for (; !tsi_end_p (i); tsi_next (&i)) { tree handler = tsi_stmt (i); if (TREE_TYPE (handler) && can_convert_eh (type, TREE_TYPE (handler))) { warning_at (EXPR_LOCATION (handler), 0, "exception of type %qT will be caught", TREE_TYPE (handler)); warning_at (EXPR_LOCATION (master), 0, " by earlier handler for %qT", type); break; } } }
false
false
false
false
false
0
send_fragment(private_task_manager_t *this, bool request, host_t *src, host_t *dst, fragment_payload_t *fragment) { message_t *message; packet_t *packet; status_t status; message = message_create(IKEV1_MAJOR_VERSION, IKEV1_MINOR_VERSION); /* other implementations seem to just use 0 as message ID, so here we go */ message->set_message_id(message, 0); message->set_request(message, request); message->set_source(message, src->clone(src)); message->set_destination(message, dst->clone(dst)); message->set_exchange_type(message, this->frag.exchange); message->add_payload(message, (payload_t*)fragment); status = this->ike_sa->generate_message(this->ike_sa, message, &packet); if (status != SUCCESS) { DBG1(DBG_IKE, "failed to generate IKE fragment"); message->destroy(message); return FALSE; } charon->sender->send(charon->sender, packet); message->destroy(message); return TRUE; }
false
false
false
false
false
0
MagickWordStreamLSBRead(WordStreamReadHandle *word_stream, const unsigned int requested_bits) { register unsigned int remaining_quantum_bits, quantum; remaining_quantum_bits = requested_bits; quantum = 0; while (remaining_quantum_bits != 0) { register unsigned int word_bits; if (word_stream->bits_remaining == 0) { word_stream->word=word_stream->read_func(word_stream->read_func_state); word_stream->bits_remaining=32; } word_bits = remaining_quantum_bits; if (word_bits > word_stream->bits_remaining) word_bits = word_stream->bits_remaining; quantum |= (((word_stream->word >> (32-word_stream->bits_remaining)) & BitAndMasks[word_bits]) << (requested_bits-remaining_quantum_bits)); remaining_quantum_bits -= word_bits; word_stream->bits_remaining -= word_bits; } return quantum; }
false
false
false
false
true
1
simple_action(Packet *p) { if (p->length() > _nbytes) { p->take(p->length() - _nbytes); } return p; }
false
false
false
false
false
0
httpOpenPassHandler(Http *http) { HttpStage *stage; if ((stage = httpCreateHandler(http, "passHandler", HTTP_STAGE_ALL, NULL)) == 0) { return MPR_ERR_CANT_CREATE; } http->passHandler = stage; stage->open = openPass; stage->process = processPass; /* PassHandler has an alias as the ErrorHandler too */ if ((stage = httpCreateHandler(http, "errorHandler", HTTP_STAGE_ALL, NULL)) == 0) { return MPR_ERR_CANT_CREATE; } stage->open = openPass; stage->process = processPass; return 0; }
false
false
false
false
false
0
queryMaker() { QList<QueryMaker*> list; foreach( Collections::Collection *collection, m_idCollectionMap ) { list.append( collection->queryMaker() ); } return new Collections::AggregateQueryMaker( this, list ); }
false
false
false
false
false
0
select_transform (JXFORM_CODE transform) /* Silly little routine to detect multiple transform options, * which we can't handle. */ { #if TRANSFORMS_SUPPORTED if (transformoption.transform == JXFORM_NONE || transformoption.transform == transform) { transformoption.transform = transform; } else { fprintf(stderr, "%s: can only do one image transformation at a time\n", progname); usage(); } #else fprintf(stderr, "%s: sorry, image transformation was not compiled\n", progname); exit(EXIT_FAILURE); #endif }
false
false
false
false
false
0
reset_conn(conn c) { connwant(c, 'r', &dirty); /* was this a peek or stats command? */ if (c->out_job && c->out_job->r.state == Copy) job_free(c->out_job); c->out_job = NULL; c->reply_sent = 0; /* now that we're done, reset this */ c->state = STATE_WANTCOMMAND; }
false
false
false
false
false
0
SetCurrentWaypoint(uint32 uiPointId) { if (!(HasEscortState(STATE_ESCORT_PAUSED))) // Only when paused { return; } if (uiPointId == CurrentWP->uiId) // Already here { return; } bool bFoundWaypoint = false; for (std::list<Escort_Waypoint>::iterator itr = WaypointList.begin(); itr != WaypointList.end(); ++itr) { if (itr->uiId == uiPointId) { CurrentWP = itr; // Set to found itr bFoundWaypoint = true; break; } } if (!bFoundWaypoint) { debug_log("SD2: EscortAI current waypoint tried to set to id %u, but doesn't exist in WaypointList", uiPointId); return; } m_uiWPWaitTimer = 1; debug_log("SD2: EscortAI current waypoint set to id %u", CurrentWP->uiId); }
false
false
false
false
false
0
pixCloseSafeBrick(PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize) { l_int32 maxtrans, bordsize; PIX *pixsb, *pixt, *pixdb; SEL *sel, *selh, *selv; PROCNAME("pixCloseSafeBrick"); if (!pixs) return (PIX *)ERROR_PTR("pixs not defined", procName, pixd); if (pixGetDepth(pixs) != 1) return (PIX *)ERROR_PTR("pixs not 1 bpp", procName, pixd); if (hsize < 1 || vsize < 1) return (PIX *)ERROR_PTR("hsize and vsize not >= 1", procName, pixd); if (hsize == 1 && vsize == 1) return pixCopy(pixd, pixs); /* Symmetric b.c. handles correctly without added pixels */ if (MORPH_BC == SYMMETRIC_MORPH_BC) return pixCloseBrick(pixd, pixs, hsize, vsize); maxtrans = L_MAX(hsize / 2, vsize / 2); bordsize = 32 * ((maxtrans + 31) / 32); /* full 32 bit words */ pixsb = pixAddBorder(pixs, bordsize, 0); if (hsize == 1 || vsize == 1) { /* no intermediate result */ sel = selCreateBrick(vsize, hsize, vsize / 2, hsize / 2, SEL_HIT); pixdb = pixClose(NULL, pixsb, sel); selDestroy(&sel); } else { /* do separably */ selh = selCreateBrick(1, hsize, 0, hsize / 2, SEL_HIT); selv = selCreateBrick(vsize, 1, vsize / 2, 0, SEL_HIT); pixt = pixDilate(NULL, pixsb, selh); pixdb = pixDilate(NULL, pixt, selv); pixErode(pixt, pixdb, selh); pixErode(pixdb, pixt, selv); pixDestroy(&pixt); selDestroy(&selh); selDestroy(&selv); } pixt = pixRemoveBorder(pixdb, bordsize); pixDestroy(&pixsb); pixDestroy(&pixdb); if (!pixd) { pixd = pixt; } else { pixCopy(pixd, pixt); pixDestroy(&pixt); } return pixd; }
false
false
false
false
false
0
_elm_win_state_eval(void *data __UNUSED__) { Eina_List *l; Evas_Object *obj; _elm_win_state_eval_job = NULL; if (_elm_config->auto_norender_withdrawn) { EINA_LIST_FOREACH(_elm_win_list, l, obj) { if ((elm_win_withdrawn_get(obj)) || ((elm_win_iconified_get(obj) && (_elm_config->auto_norender_iconified_same_as_withdrawn)))) { if (!evas_object_data_get(obj, "__win_auto_norender")) { Evas *evas = evas_object_evas_get(obj); elm_win_norender_push(obj); evas_object_data_set(obj, "__win_auto_norender", obj); if (_elm_config->auto_flush_withdrawn) { edje_file_cache_flush(); edje_collection_cache_flush(); evas_image_cache_flush(evas); evas_font_cache_flush(evas); } if (_elm_config->auto_dump_withdrawn) { evas_render_dump(evas); } } } else { if (evas_object_data_get(obj, "__win_auto_norender")) { elm_win_norender_pop(obj); evas_object_data_del(obj, "__win_auto_norender"); } } } } if (_elm_config->auto_throttle) { if (_elm_win_count == 0) { if (_elm_win_auto_throttled) { ecore_throttle_adjust(-_elm_config->auto_throttle_amount); _elm_win_auto_throttled = EINA_FALSE; } } else { if ((_elm_win_count_iconified + _elm_win_count_withdrawn) >= _elm_win_count_shown) { if (!_elm_win_auto_throttled) { ecore_throttle_adjust(_elm_config->auto_throttle_amount); _elm_win_auto_throttled = EINA_TRUE; } } else { if (_elm_win_auto_throttled) { ecore_throttle_adjust(-_elm_config->auto_throttle_amount); _elm_win_auto_throttled = EINA_FALSE; } } } } }
false
false
false
false
false
0
kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) { vcpu->arch.hflags = 0; atomic_set(&vcpu->arch.nmi_queued, 0); vcpu->arch.nmi_pending = 0; vcpu->arch.nmi_injected = false; kvm_clear_interrupt_queue(vcpu); kvm_clear_exception_queue(vcpu); memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db)); kvm_update_dr0123(vcpu); vcpu->arch.dr6 = DR6_INIT; kvm_update_dr6(vcpu); vcpu->arch.dr7 = DR7_FIXED_1; kvm_update_dr7(vcpu); vcpu->arch.cr2 = 0; kvm_make_request(KVM_REQ_EVENT, vcpu); vcpu->arch.apf.msr_val = 0; vcpu->arch.st.msr_val = 0; kvmclock_reset(vcpu); kvm_clear_async_pf_completion_queue(vcpu); kvm_async_pf_hash_reset(vcpu); vcpu->arch.apf.halted = false; if (!init_event) { kvm_pmu_reset(vcpu); vcpu->arch.smbase = 0x30000; } memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs)); vcpu->arch.regs_avail = ~0; vcpu->arch.regs_dirty = ~0; kvm_x86_ops->vcpu_reset(vcpu, init_event); }
false
false
false
false
false
0
findToolbar() const { if ( element.attribute("toolbar") == "yes" ) return element; for (QDomElement e = element.firstChildElement("folder"); !e.isNull(); e = e.nextSiblingElement("folder") ) { QDomElement result = KBookmarkGroup(e).findToolbar(); if (!result.isNull()) return result; } return QDomElement(); }
false
false
false
false
false
0
update() { updateFixture(createShape()); m_interactionOutline = m_activationOutline = QPainterPath(); createOutlines(m_activationOutline, m_interactionOutline); //propagate update to overlays if (m_citem) { Kolf::Overlay* overlay = m_citem->overlay(false); if (overlay) //may be 0 if the overlay has not yet been instantiated overlay->update(); } }
false
false
false
false
false
0
make_about_panel() { { about_panel = new Fl_Double_Window(345, 180, "About FLUID"); about_panel->color(FL_LIGHT1); about_panel->selection_color(FL_DARK1); about_panel->hotspot(about_panel); { Fl_Box* o = new Fl_Box(10, 10, 115, 120); o->image(image_fluid); } // Fl_Box* o { Fl_Box* o = new Fl_Box(135, 10, 200, 70, "FLTK User\nInterface Designer\nVersion 1.3.1"); o->color((Fl_Color)12); o->selection_color(FL_DARK1); o->labelfont(1); o->labelsize(18); o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE)); } // Fl_Box* o { Fl_Box* o = new Fl_Box(135, 90, 200, 45, "Copyright 1998-2010 by\nBill Spitzak and others"); o->align(Fl_Align(132|FL_ALIGN_INSIDE)); } // Fl_Box* o { Fl_Button* o = new Fl_Button(115, 145, 123, 25, "View License..."); o->labelcolor(FL_DARK_BLUE); o->callback((Fl_Callback*)cb_View); } // Fl_Button* o { Fl_Return_Button* o = new Fl_Return_Button(250, 145, 83, 25, "Close"); o->callback((Fl_Callback*)cb_Close); } // Fl_Return_Button* o about_panel->set_non_modal(); about_panel->end(); } // Fl_Double_Window* about_panel return about_panel; }
false
false
false
false
false
0
ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info) { int cfg_base = info->cfg_base; int hi, low, reg; /* Enter Configuration */ outb(chip->entr1, cfg_base); outb(chip->entr2, cfg_base); /* Select Logical Device 5 Registers (UART2) */ outb(0x07, cfg_base); outb(0x05, cfg_base+1); /* Read address control register */ outb(0x60, cfg_base); hi = inb(cfg_base+1); outb(0x61, cfg_base); low = inb(cfg_base+1); info->fir_base = (hi<<8) + low; info->sir_base = info->fir_base; pr_debug("%s(), probing fir_base=0x%03x\n", __func__, info->fir_base); /* Read IRQ control register */ outb(0x70, cfg_base); reg = inb(cfg_base+1); info->irq = reg & 0x0f; pr_debug("%s(), probing irq=%d\n", __func__, info->irq); /* Read DMA channel */ outb(0x74, cfg_base); reg = inb(cfg_base+1); info->dma = reg & 0x07; if(info->dma == 0x04) net_warn_ratelimited("%s(), No DMA channel assigned !\n", __func__); else pr_debug("%s(), probing dma=%d\n", __func__, info->dma); /* Read Enabled Status */ outb(0x30, cfg_base); reg = inb(cfg_base+1); info->enabled = (reg & 0x80) && (reg & 0x01); pr_debug("%s(), probing enabled=%d\n", __func__, info->enabled); /* Read Power Status */ outb(0x22, cfg_base); reg = inb(cfg_base+1); info->suspended = (reg & 0x20); pr_debug("%s(), probing suspended=%d\n", __func__, info->suspended); /* Exit configuration */ outb(0xbb, cfg_base); return 0; }
false
false
false
false
false
0
Perl_localize(pTHX_ OP *o, I32 lex) { dVAR; PERL_ARGS_ASSERT_LOCALIZE; if (o->op_flags & OPf_PARENS) /* [perl #17376]: this appears to be premature, and results in code such as C< our(%x); > executing in list mode rather than void mode */ #if 0 list(o); #else NOOP; #endif else { if ( PL_parser->bufptr > PL_parser->oldbufptr && PL_parser->bufptr[-1] == ',' && ckWARN(WARN_PARENTHESIS)) { char *s = PL_parser->bufptr; bool sigil = FALSE; /* some heuristics to detect a potential error */ while (*s && (strchr(", \t\n", *s))) s++; while (1) { if (*s && strchr("@$%*", *s) && *++s && (isWORDCHAR(*s) || UTF8_IS_CONTINUED(*s))) { s++; sigil = TRUE; while (*s && (isWORDCHAR(*s) || UTF8_IS_CONTINUED(*s))) s++; while (*s && (strchr(", \t\n", *s))) s++; } else break; } if (sigil && (*s == ';' || *s == '=')) { Perl_warner(aTHX_ packWARN(WARN_PARENTHESIS), "Parentheses missing around \"%s\" list", lex ? (PL_parser->in_my == KEY_our ? "our" : PL_parser->in_my == KEY_state ? "state" : "my") : "local"); } } } if (lex) o = my(o); else o = op_lvalue(o, OP_NULL); /* a bit kludgey */ PL_parser->in_my = FALSE; PL_parser->in_my_stash = NULL; return o; }
false
false
false
false
true
1
rle_run(float *dc, unsigned char *dc_mask, float avg, unsigned int start, unsigned int width, const float maxerror) { unsigned int left = start, right = start; float acc = dc[start]; bool left_stuck = false, right_stuck = false; do { const float len = right - left + 1; if (!left_stuck && left > 0) { const float x0 = dc[left-1]; const float diff = colordifference(avg, x0) * dc_masking_level/(dc_masking_level+dc_mask[left-1]); if (diff < maxerror) { acc += x0; left--; } else left_stuck = true; } else left_stuck = true; if (!right_stuck && right < width-2) { const float x0 = dc[right+1]; const float diff = colordifference(avg, x0) * dc_masking_level/(dc_masking_level+dc_mask[right+1]); if (diff < maxerror) { acc += x0; right++; } else right_stuck = true; } else right_stuck = true; } while(!left_stuck || !right_stuck); return (lra){ left, right, acc, }; }
false
false
false
false
false
0
NewItem(R2 A,const Metric & mm) { register int n; if(!Size || Norme2_2(lIntTria[Size-1].x-A)) { if (Size==MaxSize) ReShape(); lIntTria[Size].t=0; lIntTria[Size].x=A; lIntTria[Size].m=mm; #ifdef DEBUG1 if (SHOW) cout << "SHOW ++ NewItem A" << Size << A << endl; #endif n=Size++; } else n=Size-1; return n; }
false
false
false
false
false
0
UURemoveTemp (uulist *thefile) { if (thefile == NULL) return UURET_ILLVAL; if (thefile->binfile) { if (unlink (thefile->binfile)) { UUMessage (uulib_id, __LINE__, UUMSG_WARNING, uustring (S_TMP_NOT_REMOVED), thefile->binfile, strerror (uu_errno = errno)); } _FP_free (thefile->binfile); thefile->binfile = NULL; thefile->state &= ~UUFILE_TMPFILE; } return UURET_OK; }
false
false
false
false
false
0
dlm_plock_callback(struct plock_op *op) { struct file *file; struct file_lock *fl; struct file_lock *flc; int (*notify)(struct file_lock *fl, int result) = NULL; struct plock_xop *xop = (struct plock_xop *)op; int rv = 0; spin_lock(&ops_lock); if (!list_empty(&op->list)) { log_print("dlm_plock_callback: op on list %llx", (unsigned long long)op->info.number); list_del(&op->list); } spin_unlock(&ops_lock); /* check if the following 2 are still valid or make a copy */ file = xop->file; flc = &xop->flc; fl = xop->fl; notify = xop->callback; if (op->info.rv) { notify(fl, op->info.rv); goto out; } /* got fs lock; bookkeep locally as well: */ flc->fl_flags &= ~FL_SLEEP; if (posix_lock_file(file, flc, NULL)) { /* * This can only happen in the case of kmalloc() failure. * The filesystem's own lock is the authoritative lock, * so a failure to get the lock locally is not a disaster. * As long as the fs cannot reliably cancel locks (especially * in a low-memory situation), we're better off ignoring * this failure than trying to recover. */ log_print("dlm_plock_callback: vfs lock error %llx file %p fl %p", (unsigned long long)op->info.number, file, fl); } rv = notify(fl, 0); if (rv) { /* XXX: We need to cancel the fs lock here: */ log_print("dlm_plock_callback: lock granted after lock request " "failed; dangling lock!\n"); goto out; } out: kfree(xop); return rv; }
false
false
false
false
false
0
Open( const char * pszFilename, int bUpdateIn) { if (bUpdateIn) { return FALSE; } pszName = CPLStrdup( pszFilename ); // -------------------------------------------------------------------- // Does this appear to be an openair file? // -------------------------------------------------------------------- VSILFILE* fp = VSIFOpenL(pszFilename, "rb"); if (fp == NULL) return FALSE; char szBuffer[10000]; int nbRead = (int)VSIFReadL(szBuffer, 1, sizeof(szBuffer) - 1, fp); szBuffer[nbRead] = '\0'; int bIsOpenAir = (strstr(szBuffer, "\nAC ") != NULL && strstr(szBuffer, "\nAN ") != NULL && strstr(szBuffer, "\nAL ") != NULL && strstr(szBuffer, "\nAH") != NULL); if (bIsOpenAir) { VSIFSeekL( fp, 0, SEEK_SET ); VSILFILE* fp2 = VSIFOpenL(pszFilename, "rb"); if (fp2) { nLayers = 2; papoLayers = (OGRLayer**) CPLMalloc(2 * sizeof(OGRLayer*)); papoLayers[0] = new OGROpenAirLayer(fp); papoLayers[1] = new OGROpenAirLabelLayer(fp2); } } else VSIFCloseL(fp); return bIsOpenAir; }
false
false
false
false
false
0
rdbGenericLoadStringObject(FILE*fp, int encode) { int isencoded; uint32_t len; sds val; len = rdbLoadLen(fp,&isencoded); if (isencoded) { switch(len) { case REDIS_RDB_ENC_INT8: case REDIS_RDB_ENC_INT16: case REDIS_RDB_ENC_INT32: return rdbLoadIntegerObject(fp,len,encode); case REDIS_RDB_ENC_LZF: return rdbLoadLzfStringObject(fp); default: redisPanic("Unknown RDB encoding type"); } } if (len == REDIS_RDB_LENERR) return NULL; val = sdsnewlen(NULL,len); if (len && fread(val,len,1,fp) == 0) { sdsfree(val); return NULL; } return createObject(REDIS_STRING,val); }
false
false
false
false
false
0
cb_undo_activated (GOActionComboStack *a, WorkbookControl *wbc) { unsigned n = workbook_find_command (wb_control_get_workbook (wbc), TRUE, go_action_combo_stack_selection (a)); while (n-- > 0) command_undo (wbc); }
false
false
false
false
false
0
__ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, char * name, int value) { void * __ecereTemp1; struct __ecereNameSpace__ecere__com__ClassProperty * _property = __ecereNameSpace__ecere__com__eClass_FindClassProperty(_class, name); if(_property) { if(_property->Set) _property->Set(_class, value); } else { __ecereMethod___ecereNameSpace__ecere__sys__OldList_Add(&_class->delayedCPValues, (__ecereTemp1 = __ecereNameSpace__ecere__com__eSystem_New0(16), ((struct __ecereNameSpace__ecere__sys__NamedLink *)__ecereTemp1)->name = name, ((struct __ecereNameSpace__ecere__sys__NamedLink *)__ecereTemp1)->data = (void *)value, ((struct __ecereNameSpace__ecere__sys__NamedLink *)__ecereTemp1))); } }
false
false
false
false
false
0
majority(potrace_bitmap_t *bm, int x, int y) { int i, a, ct; for (i=2; i<5; i++) { /* check at "radius" i */ ct = 0; for (a=-i+1; a<=i-1; a++) { ct += BM_GET(bm, x+a, y+i-1) ? 1 : -1; ct += BM_GET(bm, x+i-1, y+a-1) ? 1 : -1; ct += BM_GET(bm, x+a-1, y-i) ? 1 : -1; ct += BM_GET(bm, x-i, y+a) ? 1 : -1; } if (ct>0) { return 1; } else if (ct<0) { return 0; } } return 0; }
false
false
false
false
false
0
TagToPythonString(uint32 tag,int ismac) { char foo[30]; if ( ismac ) { sprintf( foo,"<%d,%d>", tag>>16, tag&0xffff ); } else { foo[0] = tag>>24; foo[1] = tag>>16; foo[2] = tag>>8; foo[3] = tag; foo[4] = '\0'; } return( STRING_TO_PY(foo)); }
false
false
false
false
false
0
rtw_aes_decrypt23a(struct rtw_adapter *padapter, struct recv_frame *precvframe) { /* exclude ICV */ struct sta_info *stainfo; struct rx_pkt_attrib *prxattrib = &precvframe->attrib; struct security_priv *psecuritypriv = &padapter->securitypriv; struct sk_buff *skb = precvframe->pkt; int length; u8 *pframe, *prwskey; int res = _SUCCESS; pframe = skb->data; /* 4 start to encrypt each fragment */ if (prxattrib->encrypt != WLAN_CIPHER_SUITE_CCMP) return _FAIL; stainfo = rtw_get_stainfo23a(&padapter->stapriv, &prxattrib->ta[0]); if (!stainfo) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "%s: stainfo == NULL!!!\n", __func__); res = _FAIL; goto exit; } RT_TRACE(_module_rtl871x_security_c_, _drv_err_, "%s: stainfo!= NULL!!!\n", __func__); if (is_multicast_ether_addr(prxattrib->ra)) { /* in concurrent we should use sw decrypt in * group key, so we remove this message */ if (!psecuritypriv->binstallGrpkey) { res = _FAIL; DBG_8723A("%s:rx bc/mc packets, but didn't install " "group key!!!!!!!!!!\n", __func__); goto exit; } prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey; if (psecuritypriv->dot118021XGrpKeyid != prxattrib->key_index) { DBG_8723A("not match packet_index =%d, install_index =" "%d\n", prxattrib->key_index, psecuritypriv->dot118021XGrpKeyid); res = _FAIL; goto exit; } } else { prwskey = &stainfo->dot118021x_UncstKey.skey[0]; } length = skb->len - prxattrib->hdrlen - prxattrib->iv_len; res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length); exit: return res; }
false
false
false
false
false
0
ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping, SmallVector<SmallVector<int, 4>, 16> &RevMap, BitVector &SlotIsReg) { if (!(ColorWithRegs || ColorWithRegsOpt) || !VRM->HasUnusedRegisters()) return false; bool Changed = false; DEBUG(dbgs() << "Assigning unused registers to spill slots:\n"); for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) { LiveInterval *li = SSIntervals[i]; int SS = TargetRegisterInfo::stackSlot2Index(li->reg); if (!UsedColors[SS] || li->weight < 20) // If the weight is < 20, i.e. two references in a loop with depth 1, // don't bother with it. continue; // These slots allow to share the same registers. bool AllColored = true; SmallVector<unsigned, 4> ColoredRegs; for (unsigned j = 0, ee = RevMap[SS].size(); j != ee; ++j) { int RSS = RevMap[SS][j]; const TargetRegisterClass *RC = LS->getIntervalRegClass(RSS); // If it's not colored to another stack slot, try coloring it // to a "free" register. if (!RC) { AllColored = false; continue; } unsigned Reg = VRM->getFirstUnusedRegister(RC); if (!Reg) { AllColored = false; continue; } if (!AllMemRefsCanBeUnfolded(RSS)) { AllColored = false; continue; } else { DEBUG(dbgs() << "Assigning fi#" << RSS << " to " << TRI->getName(Reg) << '\n'); ColoredRegs.push_back(Reg); SlotMapping[RSS] = Reg; SlotIsReg.set(RSS); Changed = true; } } // Register and its sub-registers are no longer free. while (!ColoredRegs.empty()) { unsigned Reg = ColoredRegs.back(); ColoredRegs.pop_back(); VRM->setRegisterUsed(Reg); // If reg is a callee-saved register, it will have to be spilled in // the prologue. MRI->setPhysRegUsed(Reg); for (const unsigned *AS = TRI->getAliasSet(Reg); *AS; ++AS) { VRM->setRegisterUsed(*AS); MRI->setPhysRegUsed(*AS); } } // This spill slot is dead after the rewrites if (AllColored) { MFI->RemoveStackObject(SS); ++NumEliminated; } } DEBUG(dbgs() << '\n'); return Changed; }
false
false
false
false
false
0
bf_chparent_chparents(Var arglist, Byte next, void *vdata, Objid progr) { /* (OBJ what, OBJ|LIST new_parent) */ if (!is_obj_or_list_of_objs(arglist.v.list[2])) { free_var(arglist); return make_error_pack(E_TYPE); } Objid what = arglist.v.list[1].v.obj; if (!valid(what) || (arglist.v.list[2].type == TYPE_OBJ && !valid(arglist.v.list[2].v.obj) && arglist.v.list[2].v.obj != NOTHING) || (arglist.v.list[2].type == TYPE_LIST && !all_valid(arglist.v.list[2]))) { free_var(arglist); return make_error_pack(E_INVARG); } else if (!controls(progr, what) || (arglist.v.list[2].type == TYPE_OBJ && valid(arglist.v.list[2].v.obj) && !db_object_allows(arglist.v.list[2].v.obj, progr, FLAG_FERTILE)) || (arglist.v.list[2].type == TYPE_LIST && !all_allowed(arglist.v.list[2], progr, FLAG_FERTILE))) { free_var(arglist); return make_error_pack(E_PERM); } else if ((arglist.v.list[2].type == TYPE_OBJ && is_a_descendant(arglist.v.list[2], arglist.v.list[1])) || (arglist.v.list[2].type == TYPE_LIST && any_are_descendants(arglist.v.list[2], arglist.v.list[1]))) { free_var(arglist); return make_error_pack(E_RECMOVE); } else { if (!db_change_parent(what, arglist.v.list[2])) { free_var(arglist); return make_error_pack(E_INVARG); } else { free_var(arglist); return no_var_pack(); } } }
false
false
false
false
false
0
setDate( const QDate& date ) { m_date.setDate( date ); m_refDate = date; m_weekDayFirstOfMonth = m_date.firstDayOfMonth().dayOfWeek(); m_numDaysThisMonth = m_date.daysInMonth(); m_numDayColumns = m_date.daysInWeek(); }
false
false
false
false
false
0
GVL_get_volname(int id, char *filename) { geovol *gvl; if (NULL == (gvl = gvl_get_vol(id))) { return (-1); } if (0 > gvl->hfile) { return (-1); } G_strcpy(filename, gvl_file_get_name(gvl->hfile)); return (1); }
false
false
false
false
false
0
H5O_link_copy(const void *_mesg, void *_dest) { const H5O_link_t *lnk = (const H5O_link_t *) _mesg; H5O_link_t *dest = (H5O_link_t *) _dest; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check args */ HDassert(lnk); if(!dest && NULL == (dest = H5FL_MALLOC(H5O_link_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy static information */ *dest = *lnk; /* Duplicate the link's name */ HDassert(lnk->name); if(NULL == (dest->name = H5MM_xstrdup(lnk->name))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate link name") /* Copy other information needed for different link types */ if(lnk->type == H5L_TYPE_SOFT) { if(NULL == (dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate soft link value") } /* end if */ else if(lnk->type >= H5L_TYPE_UD_MIN) { if(lnk->u.ud.size > 0) { if(NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size); } /* end if */ } /* end if */ /* Set return value */ ret_value = dest; done: if(NULL == ret_value) if(dest) { if(dest->name && dest->name != lnk->name) dest->name = (char *)H5MM_xfree(dest->name); if(NULL == _dest) dest = H5FL_FREE(H5O_link_t ,dest); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) }
false
false
false
false
false
0
Load(FILE *stream, ReadFunction loadFn,void *arg) { size_t i; char *buf; Deque D,*d; if (fread(&D,1,sizeof(Deque),stream) == 0) return NULL; d = Create(D.ElementSize); if (d == NULL) return NULL; buf = malloc(D.ElementSize); if (buf == NULL) { Finalize(d); iError.RaiseError("iDeque.Load",CONTAINER_ERROR_NOMEMORY); return NULL; } for (i=0; i<D.count;i++) { if (loadFn == NULL) { if (fread(buf,1,D.ElementSize,stream) == 0) break; } else { if (loadFn(buf,arg,stream) <= 0) { break; } } Add(d,buf); } free(buf); d->count = D.count; d->Flags = D.Flags; return d; }
false
false
false
false
true
1
handle_input_chunk(input_state * restrict input, char * restrict chunk) { client_state *client = input->data; char *request; char *data = skip_newlines(chunk); if (*data == '\0') { /* Ignore empty input lines. */ free(chunk); input_read_chunk(input, handle_input_chunk); return; } if (client->mode == CLIENT_MODE_CHECK_RESULT) { chomp(data); client->command = parse_check_result(data, client->delimiter); } else client->command = parse_command(data); free(chunk); client->command_length = strlen(client->command); client->command[client->command_length++] = '\n'; xasprintf(&request, "PUSH %u", client->command_length); info("%s C: %s", client->tls->peer, request); tls_write_line(client->tls, request); free(request); tls_read_line(client->tls, handle_tls_push_response); }
false
false
false
false
false
0
CopyAttributeOutCSV(CopyState cstate, char *string, bool use_quote, bool single_attr) { char *ptr; char *start; char c; char delimc = cstate->delim[0]; char quotec = cstate->quote[0]; char escapec = cstate->escape[0]; /* force quoting if it matches null_print (before conversion!) */ if (!use_quote && strcmp(string, cstate->null_print) == 0) use_quote = true; if (cstate->need_transcoding) ptr = pg_server_to_any(string, strlen(string), cstate->file_encoding); else ptr = string; /* * Make a preliminary pass to discover if it needs quoting */ if (!use_quote) { /* * Because '\.' can be a data value, quote it if it appears alone on a * line so it is not interpreted as the end-of-data marker. */ if (single_attr && strcmp(ptr, "\\.") == 0) use_quote = true; else { char *tptr = ptr; while ((c = *tptr) != '\0') { if (c == delimc || c == quotec || c == '\n' || c == '\r') { use_quote = true; break; } if (IS_HIGHBIT_SET(c) && cstate->encoding_embeds_ascii) tptr += pg_encoding_mblen(cstate->file_encoding, tptr); else tptr++; } } } if (use_quote) { CopySendChar(cstate, quotec); /* * We adopt the same optimization strategy as in CopyAttributeOutText */ start = ptr; while ((c = *ptr) != '\0') { if (c == quotec || c == escapec) { DUMPSOFAR(); CopySendChar(cstate, escapec); start = ptr; /* we include char in next run */ } if (IS_HIGHBIT_SET(c) && cstate->encoding_embeds_ascii) ptr += pg_encoding_mblen(cstate->file_encoding, ptr); else ptr++; } DUMPSOFAR(); CopySendChar(cstate, quotec); } else { /* If it doesn't need quoting, we can just dump it as-is */ CopySendString(cstate, ptr); } }
false
false
false
false
false
0
gtkalignment_gtk_alignment_set_padding(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_) { ScmObj alignment_scm; GtkAlignment* alignment; ScmObj padding_top_scm; u_int padding_top; ScmObj padding_bottom_scm; u_int padding_bottom; ScmObj padding_left_scm; u_int padding_left; ScmObj padding_right_scm; u_int padding_right; ScmObj SCM_SUBRARGS[5]; int SCM_i; SCM_ENTER_SUBR("gtk-alignment-set-padding"); for (SCM_i=0; SCM_i<5; SCM_i++) { SCM_SUBRARGS[SCM_i] = SCM_ARGREF(SCM_i); } alignment_scm = SCM_SUBRARGS[0]; if (!SCM_GTK_ALIGNMENT_P(alignment_scm)) Scm_Error("<gtk-alignment> required, but got %S", alignment_scm); alignment = SCM_GTK_ALIGNMENT(alignment_scm); padding_top_scm = SCM_SUBRARGS[1]; if (!SCM_UINTEGERP(padding_top_scm)) Scm_Error("C integer required, but got %S", padding_top_scm); padding_top = Scm_GetIntegerU(padding_top_scm); padding_bottom_scm = SCM_SUBRARGS[2]; if (!SCM_UINTEGERP(padding_bottom_scm)) Scm_Error("C integer required, but got %S", padding_bottom_scm); padding_bottom = Scm_GetIntegerU(padding_bottom_scm); padding_left_scm = SCM_SUBRARGS[3]; if (!SCM_UINTEGERP(padding_left_scm)) Scm_Error("C integer required, but got %S", padding_left_scm); padding_left = Scm_GetIntegerU(padding_left_scm); padding_right_scm = SCM_SUBRARGS[4]; if (!SCM_UINTEGERP(padding_right_scm)) Scm_Error("C integer required, but got %S", padding_right_scm); padding_right = Scm_GetIntegerU(padding_right_scm); { gtk_alignment_set_padding(alignment, padding_top, padding_bottom, padding_left, padding_right); SCM_RETURN(SCM_UNDEFINED); } }
false
false
false
false
false
0
CLG_Initialise(void) { clear_subnet(&top_subnet4); clear_subnet(&top_subnet6); if (CNF_GetNoClientLog()) { active = 0; } else { active = 1; } nodes = NULL; max_nodes = 0; n_nodes = 0; alloced = 0; alloc_limit = CNF_GetClientLogLimit(); alloc_limit_reached = 0; }
false
false
false
false
false
0
snd_pcm_meter_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_meter_t *meter = pcm->private_data; snd_pcm_sframes_t err = snd_pcm_rewind(meter->gen.slave, frames); if (err > 0 && pcm->stream == SND_PCM_STREAM_PLAYBACK) meter->rptr = *pcm->appl.ptr; return err; }
false
false
false
false
false
0
_dxfIrregShrink(Object object) { int i; Object child; struct shrinkTask task; Class class; class = DXGetObjectClass(object); switch(class) { case CLASS_FIELD: if (! DXEmptyField((Field)object)) if (! IrregShrinkField((Pointer)&object)) goto error; break; case CLASS_GROUP: if (! DXCreateTaskGroup()) goto error; i = 0; while (NULL != (child = DXGetEnumeratedMember((Group)object, i++, NULL))) { if (DXGetObjectClass(child), CLASS_FIELD) { if (! DXEmptyField((Field)child)) { task.object = child; if (!DXAddTask(IrregShrinkField, (Pointer)&task, sizeof(task),1.0)) { DXAbortTaskGroup(); goto error; } } } else { if (! _dxfIrregShrink(child)) { DXAbortTaskGroup(); goto error; } } } if (! DXExecuteTaskGroup() || DXGetError() != ERROR_NONE) return NULL; break; case CLASS_XFORM: if (! DXGetXformInfo((Xform)object, &child, 0)) goto error; if (! _dxfIrregShrink(child)) goto error; break; default: DXSetError(ERROR_DATA_INVALID, "unknown object"); goto error; } return object; error: return NULL; }
false
false
false
false
false
0
print_table_r4_ivy(FILE *fp, struct symbol *s) { int i, j, k, l, v; char *s1; int n0=s->args[0].n; int n1=s->args[1].n; int n2=s->args[2].n; int n3=s->args[3].n; fprintf(fp, " ((%s . 4) . (\n", s->name); for (i = 0; i < n0; i++) { for (j = 0; j < n1; j++) { for (k = 0; k < n2; k++) { for (l = 0; l < n3; l++) { v = atom_value(ATOM4(s, i, j, k, l)); switch(v) { case 0: s1 = "nil"; break; case 1: s1 = "t"; break; case 2: s1 = "nil"; break; default: s1 = "nil"; break; } fprintf(fp, " ((%d %d %d %d) . %s)\n", i, j, k, l, s1); } } } } fprintf(fp, " ))\n"); }
false
false
false
false
false
0
get_env(std::string const& var, std::string* value) { // This was basically ripped out of wxWindows. #ifdef _WIN32 # ifdef NO_GET_ENVIRONMENT return false; # else // first get the size of the buffer DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0); if (len == 0) { // this means that there is no such variable return false; } if (value) { char* t = new char[len + 1]; ::GetEnvironmentVariable(var.c_str(), t, len); *value = t; delete [] t; } return true; # endif #else char* p = getenv(var.c_str()); if (p == 0) { return false; } if (value) { *value = p; } return true; #endif }
false
false
false
false
false
0
ascii_to_big5(unsigned char ch) { ch -= ' '; if (ch >= (unsigned char)(127 - ' ')) ch = '@' - ' '; return ascii_to_big5_table[ch]; }
false
false
false
false
false
0
ddf_LPSolve0(ddf_LPPtr lp,ddf_LPSolverType solver,ddf_ErrorType *err) /* The original version of ddf_LPSolve that solves an LP with specified arithimetics. When LP is inconsistent then *re returns the evidence row. When LP is dual-inconsistent then *se returns the evidence column. */ { int i; ddf_boolean found=ddf_FALSE; *err=ddf_NoError; lp->solver=solver; time(&lp->starttime); switch (lp->solver) { case ddf_CrissCross: ddf_CrissCrossSolve(lp,err); break; case ddf_DualSimplex: ddf_DualSimplexSolve(lp,err); break; } time(&lp->endtime); lp->total_pivots=0; for (i=0; i<=4; i++) lp->total_pivots+=lp->pivots[i]; if (*err==ddf_NoError) found=ddf_TRUE; return found; }
false
false
false
false
false
0
cx88_enum_input (struct cx88_core *core,struct v4l2_input *i) { static const char * const iname[] = { [ CX88_VMUX_COMPOSITE1 ] = "Composite1", [ CX88_VMUX_COMPOSITE2 ] = "Composite2", [ CX88_VMUX_COMPOSITE3 ] = "Composite3", [ CX88_VMUX_COMPOSITE4 ] = "Composite4", [ CX88_VMUX_SVIDEO ] = "S-Video", [ CX88_VMUX_TELEVISION ] = "Television", [ CX88_VMUX_CABLE ] = "Cable TV", [ CX88_VMUX_DVB ] = "DVB", [ CX88_VMUX_DEBUG ] = "for debug only", }; unsigned int n = i->index; if (n >= 4) return -EINVAL; if (0 == INPUT(n).type) return -EINVAL; i->type = V4L2_INPUT_TYPE_CAMERA; strcpy(i->name,iname[INPUT(n).type]); if ((CX88_VMUX_TELEVISION == INPUT(n).type) || (CX88_VMUX_CABLE == INPUT(n).type)) { i->type = V4L2_INPUT_TYPE_TUNER; } i->std = CX88_NORMS; return 0; }
false
false
false
false
false
0
InitStorage(char *path) { char *p, *np; char ns[256], pa[12]; int changed = 0; /* First, take this opportunity to clear the seek optimisation table. If we're changing the file name format, none of the items in it will be valid in any case. */ memset(seekOpt, 0, sizeof seekOpt); /* Set the path based on the environment variable, argument, or default. */ if (path == NULL) { if ((path = getenv("EGG_DATA")) == NULL) { path = DATAFMT; } } /* If the path contains any of our special "$" editing codes, interpolate the requested text into the string. Strftime "%" editing codes are left intact. */ ns[0] = 0; p = path; while ((np = strchr(p, '$')) != NULL) { char *phrargs = np + 1; /* Copy portion of string prior to phrase to output. */ if (np > p) { int l = strlen(ns); memcpy(ns + l, p, np - p); ns[l + (np - p)] = 0; } /* Parse format phrase and possible arguments. */ while ((*phrargs != 0) && !isalpha(*phrargs)) { phrargs++; } if (*phrargs == 0) { fprintf(stderr, "Data format string error in:\n %s\nunterminated $ phrase.\n", path); exit(-1); } /* Copy arguments, if any, to second character of arguments string for possible use by phrase interpreters in sprintf. */ pa[0] = '%'; /* Start editing phrase */ pa[1] = 0; if (phrargs > (np + 1)) { memcpy(pa + 1, np + 1, phrargs - (np + 1)); pa[1 + (phrargs - (np + 1))] = 0; } /*fprintf(stderr, "Phrase arguments = <%s>\n", pa);*/ /* Now interpret the specific format phrase letters. The value selected by each phrase should be concatenated to the output string ns. Available format phrases are: $b Basket name $e Egg name $[0][n]E Egg number, right justified, optionally zero filled in n characters */ switch (*phrargs) { case 'b': /* Basket name */ strcat(ns, baskettable[0].name); break; case 'e': /* Egg name */ strcat(ns, eggtable[0].name); break; case 'E': /* Egg number, edited decimal number */ strcat(pa, "d"); sprintf(ns + strlen(ns), pa, eggtable[0].id); break; default: fprintf(stderr, "Data format string error in:\n %s\nunknown phrase $%c.\n", path, *phrargs); exit(-1); } /* Adjust pointer to resume scan following the phrase in the source string. */ p = phrargs + 1; changed++; } if (changed) { strcat(ns, p); /* Concatenate balance of string */ path = strdup(ns); if (path == NULL) { fprintf(stderr, "Cannot allocate memory for file name format string.\n"); exit(-1); } /*printf("Expanded path name phrase = <%s>\n", path); exit(0);*/ } datafmt = path; return 0; }
false
false
false
false
true
1
murmurhash2(const char *key, size_t len) { const uint32_t m = 0x5bd1e995; const int r = 24; const uint32_t seed = 0x34a4b627; // Initialize the hash to a 'random' value uint32_t h = seed ^ len; // Mix 4 bytes at a time into the hash while (len >= 4) { uint32_t k = *(uint32_t *) key; k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; key += 4; len -= 4; } // Handle the last few bytes of the input array switch (len) { case 3: h ^= key[2] << 16; case 2: h ^= key[1] << 8; case 1: h ^= key[0]; h *= m; } // Do a few final mixes of the hash to ensure the last few // bytes are well-incorporated. h ^= h >> 13; h *= m; h ^= h >> 15; return h; }
false
false
false
false
false
0
set_rx_mode(struct nic *nic __unused) { int i; u16 mc_filter[4]; /* Multicast hash filter */ u32 rx_mode; memset(mc_filter, 0xff, sizeof(mc_filter)); rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; if (sdc->mii_if.full_duplex && sdc->flowctrl) mc_filter[3] |= 0x0200; for (i = 0; i < 4; i++) outw(mc_filter[i], BASE + MulticastFilter0 + i * 2); outb(rx_mode, BASE + RxMode); return; }
false
false
false
false
false
0
t1_sge_intr_enable(struct sge *sge) { u32 en = SGE_INT_ENABLE; u32 val = readl(sge->adapter->regs + A_PL_ENABLE); if (sge->adapter->port[0].dev->hw_features & NETIF_F_TSO) en &= ~F_PACKET_TOO_BIG; writel(en, sge->adapter->regs + A_SG_INT_ENABLE); writel(val | SGE_PL_INTR_MASK, sge->adapter->regs + A_PL_ENABLE); }
false
false
false
false
false
0
PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); os << indent << "PickedAxis1: " << this->PickedAxis1 << endl; os << indent << "PickedAxis2: " << this->PickedAxis2 << endl; os << indent << "PickedCenter: " << this->PickedCenter << endl; os << indent << "ResliceCursorAlgorithm: " << this->ResliceCursorAlgorithm << "\n"; if (this->ResliceCursorAlgorithm) { this->ResliceCursorAlgorithm->PrintSelf(os, indent); } os << indent << "TransformMatrix: " << this->TransformMatrix << "\n"; if (this->TransformMatrix) { this->TransformMatrix->PrintSelf(os, indent); } // this->PointIds; // this->Plane; // this->Cell; }
false
false
false
false
false
0
connection_requested_handles (TpConnection *self, const GArray *handles, const GError *error, gpointer user_data, GObject *weak_object) { RequestHandlesContext *context = user_data; g_object_ref (self); if (error == NULL) { if (G_UNLIKELY (g_strv_length (context->ids) != handles->len)) { const gchar *cm = tp_proxy_get_bus_name ((TpProxy *) self); GError *e = g_error_new (TP_DBUS_ERRORS, TP_DBUS_ERROR_INCONSISTENT, "Connection manager %s is broken: we asked for %u " "handles but RequestHandles returned %u", cm, g_strv_length (context->ids), handles->len); /* This CM is bad and wrong. We can't trust it to get anything * right. */ WARNING ("%s", e->message); context->callback (self, context->handle_type, 0, NULL, NULL, e, context->user_data, weak_object); g_error_free (e); return; } DEBUG ("%u handles of type %u", handles->len, context->handle_type); /* On the Telepathy side, we have held these handles (at least once). * That's all we need. */ context->callback (self, context->handle_type, handles->len, (const TpHandle *) handles->data, (const gchar * const *) context->ids, NULL, context->user_data, weak_object); } else { DEBUG ("%u handles of type %u failed: %s %u: %s", g_strv_length (context->ids), context->handle_type, g_quark_to_string (error->domain), error->code, error->message); context->callback (self, context->handle_type, 0, NULL, NULL, error, context->user_data, weak_object); } g_object_unref (self); }
false
false
false
false
false
0
OnMessage(talk_base::Message* /*pmsg*/) { int waiting_time_ms = 0; if (capturer_ && capturer_->ReadFrame(false, &waiting_time_ms)) { PostDelayed(waiting_time_ms, this); } else { Quit(); } }
false
false
false
false
false
0
initTable(void) { int i; hashSize = INITIAL_HASH_SIZE; while (!isPrime(hashSize)) { hashSize++; } buckets = (Sym **) allocate(hashSize * sizeof(Sym *)); for (i = 0; i < hashSize; i++) { buckets[i] = NULL; } numEntries = 0; }
false
false
false
false
false
0
drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) { struct drm_pending_vblank_event *e, *t; struct timeval now; unsigned int seq; assert_spin_locked(&dev->event_lock); seq = drm_vblank_count_and_time(dev, pipe, &now); list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { if (e->pipe != pipe) continue; if ((seq - e->event.sequence) > (1<<23)) continue; DRM_DEBUG("vblank event on %d, current %d\n", e->event.sequence, seq); list_del(&e->base.link); drm_vblank_put(dev, pipe); send_vblank_event(dev, e, seq, &now); } trace_drm_vblank_event(pipe, seq); }
false
false
false
false
false
0
genie_make_ref_row_row (NODE_T * p, MOID_T * dst_mode, MOID_T * src_mode, ADDR_T sp) { A68_REF name, new_row, old_row; A68_ARRAY *new_arr, *old_arr; A68_TUPLE *new_tup, *old_tup; int k; dst_mode = DEFLEX (dst_mode); src_mode = DEFLEX (src_mode); name = *(A68_REF *) STACK_ADDRESS (sp); /* ROWING NIL yields NIL */ if (IS_NIL (name)) { return (nil_ref); } old_row = * DEREF (A68_REF, &name); GET_DESCRIPTOR (old_arr, old_tup, &old_row); /* Make new descriptor */ new_row = heap_generator (p, dst_mode, ALIGNED_SIZE_OF (A68_ARRAY) + DIM (SUB (dst_mode)) * ALIGNED_SIZE_OF (A68_TUPLE)); name = heap_generator (p, dst_mode, A68_REF_SIZE); GET_DESCRIPTOR (new_arr, new_tup, &new_row); DIM (new_arr) = DIM (SUB (dst_mode)); MOID (new_arr) = MOID (old_arr); ELEM_SIZE (new_arr) = ELEM_SIZE (old_arr); SLICE_OFFSET (new_arr) = 0; FIELD_OFFSET (new_arr) = 0; ARRAY (new_arr) = ARRAY (old_arr); /* Fill out the descriptor */ LWB (&(new_tup[0])) = 1; UPB (&(new_tup[0])) = 1; SPAN (&(new_tup[0])) = 1; SHIFT (&(new_tup[0])) = LWB (&(new_tup[0])); for (k = 0; k < DIM (SUB (src_mode)); k++) { new_tup[k + 1] = old_tup[k]; } /* Yield the new name */ * DEREF (A68_REF, &name) = new_row; return (name); }
false
false
false
false
false
0
Blt_Arg(WamWord arg_no_word, WamWord term_word, WamWord sub_term_word) { WamWord *arg_adr; int func, arity; int arg_no; Set_C_Bip_Name("arg", 3); arg_no = Rd_Positive_Check(arg_no_word) - 1; arg_adr = Rd_Compound_Check(term_word, &func, &arity); Unset_C_Bip_Name(); return (unsigned) arg_no < (unsigned) arity && Unify(sub_term_word, arg_adr[arg_no]); }
false
false
false
false
false
0
search_operand_body_inner(Block *body) { if (body != NULL) { search_operand_pe(body->pre_head); if (body->inner != NULL) insert_assign_stm_for_acc_func_blocks(body->inner); } }
false
false
false
false
false
0
tps65090_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct tps65090_platform_data *pdata = dev_get_platdata(&client->dev); int irq_base = 0; struct tps65090 *tps65090; int ret; if (!pdata && !client->dev.of_node) { dev_err(&client->dev, "tps65090 requires platform data or of_node\n"); return -EINVAL; } if (pdata) irq_base = pdata->irq_base; tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL); if (!tps65090) { dev_err(&client->dev, "mem alloc for tps65090 failed\n"); return -ENOMEM; } tps65090->dev = &client->dev; i2c_set_clientdata(client, tps65090); tps65090->rmap = devm_regmap_init_i2c(client, &tps65090_regmap_config); if (IS_ERR(tps65090->rmap)) { ret = PTR_ERR(tps65090->rmap); dev_err(&client->dev, "regmap_init failed with err: %d\n", ret); return ret; } if (client->irq) { ret = regmap_add_irq_chip(tps65090->rmap, client->irq, IRQF_ONESHOT | IRQF_TRIGGER_LOW, irq_base, &tps65090_irq_chip, &tps65090->irq_data); if (ret) { dev_err(&client->dev, "IRQ init failed with err: %d\n", ret); return ret; } } else { /* Don't tell children they have an IRQ that'll never fire */ tps65090s[CHARGER].num_resources = 0; } ret = mfd_add_devices(tps65090->dev, -1, tps65090s, ARRAY_SIZE(tps65090s), NULL, 0, regmap_irq_get_domain(tps65090->irq_data)); if (ret) { dev_err(&client->dev, "add mfd devices failed with err: %d\n", ret); goto err_irq_exit; } return 0; err_irq_exit: if (client->irq) regmap_del_irq_chip(client->irq, tps65090->irq_data); return ret; }
false
false
false
false
false
0
pixmap(const QString &elementID) { if (elementID.isNull() || d->multipleImages) { return d->findInCache(elementID, size()); } else { return d->findInCache(elementID); } }
false
false
false
false
false
0
parse_opt (int key, char *arg, struct argp_state *state) { char *endptr; static unsigned char pattern[16]; switch (key) { case 'c': count = ping_cvt_number (arg, 0, 0); break; case 'd': socket_type |= SO_DEBUG; break; case 'f': if (!is_root) error (EXIT_FAILURE, 0, "flooding needs root privilege"); options |= OPT_FLOOD; setbuf (stdout, (char *) NULL); break; #ifdef IPV6_FLOWINFO case 'F': options |= OPT_FLOWINFO; flowinfo = ping_cvt_number (arg, 0, 0) & IPV6_FLOWINFO_FLOWLABEL; break; #endif case 'i': options |= OPT_INTERVAL; interval = ping_cvt_number (arg, 0, 0); break; case 'l': if (!is_root) error (EXIT_FAILURE, 0, "preloading needs root privilege"); preload = strtoul (arg, &endptr, 0); if (*endptr || preload > INT_MAX) error (EXIT_FAILURE, 0, "preload size too large"); break; case 'n': options |= OPT_NUMERIC; break; case 'p': decode_pattern (arg, &pattern_len, pattern); patptr = pattern; break; case 'q': options |= OPT_QUIET; break; case 'r': socket_type |= SO_DONTROUTE; break; case 's': data_length = ping_cvt_number (arg, PING_MAX_DATALEN, 1); break; #ifdef IPV6_TCLASS case 'T': options |= OPT_TCLASS; tclass = ping_cvt_number (arg, 0, 0); break; #endif case 'v': options |= OPT_VERBOSE; break; case 'w': timeout = ping_cvt_number (arg, INT_MAX, 0); break; case ARG_HOPLIMIT: hoplimit = ping_cvt_number (arg, 255, 0); break; case ARGP_KEY_NO_ARGS: argp_error (state, "missing host operand"); default: return ARGP_ERR_UNKNOWN; } return 0; }
true
true
false
false
false
1
pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct pt_unit *tape = file->private_data; struct mtop __user *p = (void __user *)arg; struct mtop mtop; switch (cmd) { case MTIOCTOP: if (copy_from_user(&mtop, p, sizeof(struct mtop))) return -EFAULT; switch (mtop.mt_op) { case MTREW: mutex_lock(&pt_mutex); pt_rewind(tape); mutex_unlock(&pt_mutex); return 0; case MTWEOF: mutex_lock(&pt_mutex); pt_write_fm(tape); mutex_unlock(&pt_mutex); return 0; default: /* FIXME: rate limit ?? */ printk(KERN_DEBUG "%s: Unimplemented mt_op %d\n", tape->name, mtop.mt_op); return -EINVAL; } default: return -ENOTTY; } }
false
false
false
false
false
0
ap_linexpr0_copy(ap_linexpr0_t* a) { ap_linexpr0_t* e; size_t i; e = (ap_linexpr0_t*)malloc(sizeof(ap_linexpr0_t)); ap_coeff_init_set(&e->cst,&a->cst); e->discr = a->discr; e->size = a->size; switch (a->discr){ case AP_LINEXPR_DENSE: e->p.coeff = a->size==0 ? NULL : (ap_coeff_t*)malloc(a->size*sizeof(ap_coeff_t)); for (i=0; i<a->size; i++) ap_coeff_init_set(&e->p.coeff[i],&a->p.coeff[i]); break; case AP_LINEXPR_SPARSE: e->p.linterm = a->size==0 ? NULL : (ap_linterm_t*)malloc(a->size*sizeof(ap_linterm_t)); for (i=0; i<a->size; i++){ ap_coeff_init_set(&e->p.linterm[i].coeff,&a->p.linterm[i].coeff); e->p.linterm[i].dim = a->p.linterm[i].dim; } break; } e->size = a->size; return e; }
false
true
false
false
false
1
removeKey(Dictionary* dict, char* key) { DictValue* next; DictValue* toRelease; next = dict->values; while(next != NULL) { if(strcmp(next->key, key) == 0) { toRelease = next; if(toRelease->prev) { toRelease->prev->next = toRelease->next; } else { dict->values = toRelease->next; } if(toRelease->next) { toRelease->next->prev = toRelease->prev; } switch(toRelease->type) { case DictionaryType: releaseDictionary((Dictionary*) toRelease); break; case ArrayType: releaseArray((ArrayValue*) toRelease); break; case StringType: free(((StringValue*)(toRelease))->value); free(toRelease->key); free(toRelease); break; case DataType: free(((DataValue*)(toRelease))->value); case IntegerType: case BoolType: free(toRelease->key); free(toRelease); break; } return; } next = next->next; } return; }
false
false
false
false
false
0
PushBackCopy(VP8LBackwardRefs* const refs, int length) { int size = refs->size; while (length >= MAX_LENGTH) { refs->refs[size++] = PixOrCopyCreateCopy(1, MAX_LENGTH); length -= MAX_LENGTH; } if (length > 0) { refs->refs[size++] = PixOrCopyCreateCopy(1, length); } refs->size = size; }
false
false
false
false
false
0
job_local_read_cleanuptime(const JobId &id,const GMConfig &config,time_t &cleanuptime) { std::string fname = config.ControlDir() + "/job." + id + sfx_local; std::string str; if(!job_local_read_var(fname,"cleanuptime",str)) return false; cleanuptime=Arc::Time(str).GetTime(); return true; }
false
false
false
false
false
0
verifyData(V,A a_) { return (0!=a_&&QA(a_)&&a_->t==Ct&&a_->r==2)?MSTrue:MSFalse; }
false
false
false
false
false
0
test_double (void) { { gdouble a = 0.0; a = -10.0; { gboolean _tmp0_ = FALSE; _tmp0_ = TRUE; while (TRUE) { gdouble _tmp2_ = 0.0; Number* z = NULL; gdouble _tmp3_ = 0.0; Number* _tmp4_ = NULL; Number* _tmp5_ = NULL; gdouble _tmp6_ = 0.0; gdouble _tmp7_ = 0.0; if (!_tmp0_) { gdouble _tmp1_ = 0.0; _tmp1_ = a; a = _tmp1_ + 0.5; } _tmp0_ = FALSE; _tmp2_ = a; if (!(_tmp2_ <= 10.0)) { break; } _tmp3_ = a; _tmp4_ = number_new_double (_tmp3_); z = _tmp4_; _tmp5_ = z; _tmp6_ = number_to_double (_tmp5_); _tmp7_ = a; if (_tmp6_ != _tmp7_) { gdouble _tmp8_ = 0.0; Number* _tmp9_ = NULL; gdouble _tmp10_ = 0.0; gdouble _tmp11_ = 0.0; gchar* _tmp12_ = NULL; gchar* _tmp13_ = NULL; _tmp8_ = a; _tmp9_ = z; _tmp10_ = number_to_double (_tmp9_); _tmp11_ = a; _tmp12_ = g_strdup_printf ("Number.double (%f).to_double () -> %f, expected %f", _tmp8_, _tmp10_, _tmp11_); _tmp13_ = _tmp12_; fail (_tmp13_); _g_free0 (_tmp13_); _number_unref0 (z); return; } _number_unref0 (z); } } } pass (NULL); }
false
false
false
false
false
0
der_get_octet_string_ber (const unsigned char *p, size_t len, heim_octet_string *data, size_t *size) { int e; Der_type type; Der_class cls; unsigned int tag, depth = 0; size_t l, datalen, oldlen = len; data->length = 0; data->data = NULL; while (len) { e = der_get_tag (p, len, &cls, &type, &tag, &l); if (e) goto out; if (cls != ASN1_C_UNIV) { e = ASN1_BAD_ID; goto out; } if (type == PRIM && tag == UT_EndOfContent) { if (depth == 0) break; depth--; } if (tag != UT_OctetString) { e = ASN1_BAD_ID; goto out; } p += l; len -= l; e = der_get_length (p, len, &datalen, &l); if (e) goto out; p += l; len -= l; if (datalen > len) return ASN1_OVERRUN; if (type == PRIM) { void *ptr; ptr = realloc(data->data, data->length + datalen); if (ptr == NULL) { e = ENOMEM; goto out; } data->data = ptr; memcpy(((unsigned char *)data->data) + data->length, p, datalen); data->length += datalen; } else depth++; p += datalen; len -= datalen; } if (depth != 0) return ASN1_INDEF_OVERRUN; if(size) *size = oldlen - len; return 0; out: free(data->data); data->data = NULL; data->length = 0; return e; }
false
false
false
false
false
0
hx509_certs_iter_f(hx509_context context, hx509_certs certs, int (*func)(hx509_context, void *, hx509_cert), void *ctx) { hx509_cursor cursor; hx509_cert c; int ret; ret = hx509_certs_start_seq(context, certs, &cursor); if (ret) return ret; while (1) { ret = hx509_certs_next_cert(context, certs, cursor, &c); if (ret) break; if (c == NULL) { ret = 0; break; } ret = (*func)(context, ctx, c); hx509_cert_free(c); if (ret) break; } hx509_certs_end_seq(context, certs, cursor); return ret; }
false
false
false
false
false
0
main() { srand(time(0)); const size_t length = 1<<24; timer tim; LinkedList<int> list(length); cout << "constructing list of " << length << " random integers... "; cout.flush(); for(size_t i = 0; i < length; ++i){ list.addFirst( rand() % (length << 1) ); } cout << "done" << endl; cout << "sorting... "; cout.flush(); tim.start(); list.sort<std::less<int> >(); tim.end(); cout << "done" << endl; cout << "took " << (tim.duration() * 1e-6) << " seconds" << endl; // ^ have to convert from microseconds LinkedList<int>::iterator it = list.begin(); LinkedList<int>::iterator end= list.end(); bool sorted = true; size_t length_counter = 0; int prev = *it; ++it; ++length_counter; cout << "Verifying sortedness and length of list... "; cout.flush(); for( ; sorted && (it != end); ++it){ sorted = sorted && (prev <= *it); prev = *it; ++length_counter; } cout << "done" << endl; if(sorted){ if(length_counter == length){ cout << "SUCCESS! List is sorted and the correct length!" << endl; }else{ cout << "FAILURE! List is sorted, but the wrong length! (Is " << length_counter << " long, should be " << length << ")" << endl; } }else{ if(length_counter == length){ cout << "FAILURE! List ain't sorted (but it is the right length)" << endl; }else{ cout << "FAILURE! List ain't sorted, and it's not even the right length! (Is " << length_counter << " long, should be " << length << ")" << endl; } } #ifdef _WIN32 system("pause"); #endif return 0; }
false
false
false
false
false
0
IN_DrawTime(int x, int y, int h, int m, int s) { if (h) { IN_DrawNumber(h, x, y, 2); IN_DrTextB(DEH_String(":"), x + 26, y); } x += 34; if (m || h) { IN_DrawNumber(m, x, y, 2); } x += 34; if (s) { IN_DrTextB(DEH_String(":"), x - 8, y); IN_DrawNumber(s, x, y, 2); } }
false
false
false
false
false
0
recv (void *buf, size_t n, int flags, const ACE_Time_Value *timeout) { ssize_t result = 0; if (this->pre_recv() == -1 && this->leftovers_.length() == 0) return -1; if (this->leftovers_.length() > 0) { result = ACE_MIN (n,this->leftovers_.length()); ACE_OS::memcpy (buf,this->leftovers_.rd_ptr(), result); this->leftovers_.rd_ptr(result); buf = (char *)buf + result; } if (result < (ssize_t)n && result < (ssize_t)data_len_) { n -= result; result += this->ace_stream_.recv(buf, n, flags, timeout); } if (result > 0) data_consumed((size_t)result); return result; }
false
false
false
false
false
0