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
decode_buf( uint8_t * out, size_t bufsize, const uint8_t * base, size_t * rem, size_t * idx ) { if (*rem < bufsize ) { return 0; } memcpy( out, (base + *idx), bufsize ); *idx += bufsize; *rem -= bufsize; return bufsize; }
false
true
false
false
false
1
PrintNode( ostream& os ) { os << " set" << this->Id << " [shape=rect,"; if ( this->OutputId >= 0 ) { os << "style=filled,"; } os << "label=\""; if ( this->Norm.Component < 0 ) { os << vtkMultiThresholdNormNames[-this->Norm.Component-1] << "("; } os << ( this->Norm.Association == vtkDataObject::FIELD_ASSOCIATION_POINTS ? "point " : "cell " ); if ( this->Norm.Type >= 0 ) { os << vtkDataSetAttributes::GetAttributeTypeAsString(this->Norm.Type); } else { os << this->Norm.Name.c_str(); } if ( this->Norm.Component < 0 ) { os << ")"; } else { os << "(" << this->Norm.Component << ")"; } os << " in " << (this->EndpointClosures[0] == OPEN ? "]" : "[") << this->EndpointValues[0] << "," << this->EndpointValues[1] << (this->EndpointClosures[1] == OPEN ? "[" : "]") << "\"]" << endl; }
false
false
false
false
false
0
dark_average (uint8_t * data, unsigned int pixels, unsigned int lines, unsigned int channels, unsigned int black) { unsigned int i, j, k, average, count; unsigned int avg[3]; uint8_t val; /* computes average value on black margin */ for (k = 0; k < channels; k++) { avg[k] = 0; count = 0; for (i = 0; i < lines; i++) { for (j = 0; j < black; j++) { val = data[i * channels * pixels + j + k]; avg[k] += val; count++; } } if (count) avg[k] /= count; DBG (DBG_info, "dark_average: avg[%d] = %d\n", k, avg[k]); } average = 0; for (i = 0; i < channels; i++) average += avg[i]; average /= channels; DBG (DBG_info, "dark_average: average = %d\n", average); return average; }
false
false
false
false
false
0
HTS_ModelSet_get_gv(HTS_ModelSet * ms, size_t stream_index, const char *string, const double *iw, double *mean, double *vari) { size_t i; size_t len = ms->stream[0][stream_index].vector_length; for (i = 0; i < len; i++) { mean[i] = 0.0; vari[i] = 0.0; } for (i = 0; i < ms->num_voices; i++) if (iw[i] != 0.0) HTS_Model_add_parameter(&ms->gv[i][stream_index], 2, string, mean, vari, NULL, iw[i]); }
false
false
false
false
false
0
_gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext, const gnutls_datum_t * ciphertext, bigint_t * params, unsigned params_len, unsigned btype) { unsigned int k, i; int ret; size_t esize, mod_bits; gnutls_pk_params_st pk_params; if (params_len > GNUTLS_MAX_PK_PARAMS) return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); for (i = 0; i < params_len; i++) pk_params.params[i] = params[i]; pk_params.params_nr = params_len; mod_bits = _gnutls_mpi_get_nbits (params[0]); k = mod_bits / 8; if (mod_bits % 8 != 0) k++; esize = ciphertext->size; if (esize != k) { gnutls_assert (); return GNUTLS_E_PK_DECRYPTION_FAILED; } /* we can use btype to see if the private key is * available. */ if (btype == 2) { ret = _gnutls_pk_decrypt (GNUTLS_PK_RSA, plaintext, ciphertext, &pk_params); } else { ret = _gnutls_pk_encrypt (GNUTLS_PK_RSA, plaintext, ciphertext, &pk_params); } if (ret < 0) { gnutls_assert (); return ret; } /* EB = 00||BT||PS||00||D * (use block type 'btype') * * From now on, return GNUTLS_E_DECRYPTION_FAILED on errors, to * avoid attacks similar to the one described by Bleichenbacher in: * "Chosen Ciphertext Attacks against Protocols Based on RSA * Encryption Standard PKCS #1". */ if (plaintext->data[0] != 0 || plaintext->data[1] != btype) { gnutls_assert (); return GNUTLS_E_DECRYPTION_FAILED; } ret = GNUTLS_E_DECRYPTION_FAILED; switch (btype) { case 2: for (i = 2; i < plaintext->size; i++) { if (plaintext->data[i] == 0) { ret = 0; break; } } break; case 1: for (i = 2; i < plaintext->size; i++) { if (plaintext->data[i] == 0 && i > 2) { ret = 0; break; } if (plaintext->data[i] != 0xff) { _gnutls_handshake_log ("PKCS #1 padding error"); _gnutls_free_datum (plaintext); /* PKCS #1 padding error. Don't use GNUTLS_E_PKCS1_WRONG_PAD here. */ break; } } break; default: gnutls_assert (); _gnutls_free_datum (plaintext); break; } i++; if (ret < 0) { gnutls_assert (); _gnutls_free_datum (plaintext); return GNUTLS_E_DECRYPTION_FAILED; } memmove (plaintext->data, &plaintext->data[i], esize - i); plaintext->size = esize - i; return 0; }
false
false
false
false
false
0
create_mtx_files_F(int const scfIter) { do_output(LOG_CAT_INFO, LOG_AREA_SCF, "Creating mtx files for Fock matrices"); { // alpha std::stringstream ss_fileName; ss_fileName << "F_matrix_alpha_" << scfIter; std::stringstream ss_id; ss_id << scfopts.calculation_identifier << " - effective Hamiltonian matrix (alpha), SCF cycle " << scfIter; FockMatrix_alpha.readFromFile(); write_matrix_in_matrix_market_format( FockMatrix_alpha, matOpts.inversePermutationHML, ss_fileName.str(), ss_id.str(), scfopts.method_and_basis_set ); FockMatrix_alpha.writeToFile(); } { // beta std::stringstream ss_fileName; ss_fileName << "F_matrix_beta_" << scfIter; std::stringstream ss_id; ss_id << scfopts.calculation_identifier << " - effective Hamiltonian matrix (beta), SCF cycle " << scfIter; FockMatrix_beta.readFromFile(); write_matrix_in_matrix_market_format( FockMatrix_beta, matOpts.inversePermutationHML, ss_fileName.str(), ss_id.str(), scfopts.method_and_basis_set ); FockMatrix_beta.writeToFile(); } }
false
false
false
false
false
0
gf_odf_avc_cfg_write(GF_AVCConfig *cfg, char **outData, u32 *outSize) { u32 i, count; GF_BitStream *bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); gf_bs_write_int(bs, cfg->configurationVersion, 8); gf_bs_write_int(bs, cfg->AVCProfileIndication , 8); gf_bs_write_int(bs, cfg->profile_compatibility, 8); gf_bs_write_int(bs, cfg->AVCLevelIndication, 8); gf_bs_write_int(bs, 0x3F, 6); gf_bs_write_int(bs, cfg->nal_unit_size - 1, 2); gf_bs_write_int(bs, 0x7, 3); count = gf_list_count(cfg->sequenceParameterSets); gf_bs_write_int(bs, count, 5); for (i=0; i<count; i++) { GF_AVCConfigSlot *sl = (GF_AVCConfigSlot *)gf_list_get(cfg->sequenceParameterSets, i); gf_bs_write_int(bs, sl->size, 16); gf_bs_write_data(bs, sl->data, sl->size); } count = gf_list_count(cfg->pictureParameterSets); gf_bs_write_int(bs, count, 8); for (i=0; i<count; i++) { GF_AVCConfigSlot *sl = (GF_AVCConfigSlot *)gf_list_get(cfg->pictureParameterSets, i); gf_bs_write_int(bs, sl->size, 16); gf_bs_write_data(bs, sl->data, sl->size); } switch (cfg->AVCProfileIndication) { case 100: case 110: case 122: case 144: gf_bs_write_int(bs, 0xFF, 6); gf_bs_write_int(bs, cfg->chroma_format, 2); gf_bs_write_int(bs, 0xFF, 5); gf_bs_write_int(bs, cfg->luma_bit_depth - 8, 3); gf_bs_write_int(bs, 0xFF, 5); gf_bs_write_int(bs, cfg->chroma_bit_depth - 8, 3); count = cfg->sequenceParameterSetExtensions ? gf_list_count(cfg->sequenceParameterSetExtensions) : 0; gf_bs_write_u8(bs, count); for (i=0; i<count; i++) { GF_AVCConfigSlot *sl = (GF_AVCConfigSlot *) gf_list_get(cfg->sequenceParameterSetExtensions, i); gf_bs_write_u16(bs, sl->size); gf_bs_write_data(bs, sl->data, sl->size); } break; } *outSize = 0; *outData = NULL; gf_bs_get_content(bs, outData, outSize); gf_bs_del(bs); return GF_OK; }
false
false
false
false
false
0
createRectangle() { int i; int ipt = 0; int nSide = nPts / 4; if (nSide < 1) nSide = 1; std::auto_ptr<Envelope> env ( dim.getEnvelope() ); double XsegLen = env->getWidth() / nSide; double YsegLen = env->getHeight() / nSide; vector<Coordinate> *vc = new vector<Coordinate>(4*nSide+1); //CoordinateSequence* pts=new CoordinateArraySequence(4*nSide+1); for (i = 0; i < nSide; i++) { double x = env->getMinX() + i * XsegLen; double y = env->getMinY(); (*vc)[ipt++] = coord(x, y); } for (i = 0; i < nSide; i++) { double x = env->getMaxX(); double y = env->getMinY() + i * YsegLen; (*vc)[ipt++] = coord(x, y); } for (i = 0; i < nSide; i++) { double x = env->getMaxX() - i * XsegLen; double y = env->getMaxY(); (*vc)[ipt++] = coord(x, y); } for (i = 0; i < nSide; i++) { double x = env->getMinX(); double y = env->getMaxY() - i * YsegLen; (*vc)[ipt++] = coord(x, y); } (*vc)[ipt++] = (*vc)[0]; CoordinateSequence *cs = geomFact->getCoordinateSequenceFactory()->create(vc); LinearRing* ring=geomFact->createLinearRing(cs); Polygon* poly=geomFact->createPolygon(ring, NULL); return poly; }
false
false
false
false
false
0
setPhysRegsDeadExcept(const SmallVectorImpl<unsigned> &UsedRegs, const TargetRegisterInfo &TRI) { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); if (!MO.isReg() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) continue; bool Dead = true; for (SmallVectorImpl<unsigned>::const_iterator I = UsedRegs.begin(), E = UsedRegs.end(); I != E; ++I) if (TRI.regsOverlap(*I, Reg)) { Dead = false; break; } // If there are no uses, including partial uses, the def is dead. if (Dead) MO.setIsDead(); } }
false
false
false
false
false
0
fso_gsm_plus_ctfr_issue (FsoGsmPlusCTFR* self, const gchar* number, gint number_type) { gchar* result = NULL; gint _tmp0_ = 0; const gchar* _tmp4_ = NULL; const gchar* _tmp5_ = NULL; gint _tmp6_ = 0; gchar* _tmp7_ = NULL; gchar* _tmp8_ = NULL; gchar* _tmp9_ = NULL; gchar* _tmp10_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (number != NULL, NULL); _tmp0_ = number_type; if (_tmp0_ == 0) { const gchar* _tmp1_ = NULL; const gchar* _tmp2_ = NULL; gchar* _tmp3_ = NULL; _tmp1_ = number; _tmp2_ = string_to_string (_tmp1_); _tmp3_ = g_strconcat ("+CTFR=", _tmp2_, NULL); result = _tmp3_; return result; } _tmp4_ = number; _tmp5_ = string_to_string (_tmp4_); _tmp6_ = number_type; _tmp7_ = g_strdup_printf ("%i", _tmp6_); _tmp8_ = _tmp7_; _tmp9_ = g_strconcat ("+CTFR=", _tmp5_, ",", _tmp8_, NULL); _tmp10_ = _tmp9_; _g_free0 (_tmp8_); result = _tmp10_; return result; }
false
false
false
false
false
0
input_pad_gtk_window_set_show_layout (InputPadGtkWindow *window, InputPadWindowShowLayoutType type) { g_return_if_fail (window && INPUT_PAD_IS_GTK_WINDOW (window)); g_return_if_fail (window->priv != NULL); switch (type) { case INPUT_PAD_WINDOW_SHOW_LAYOUT_TYPE_NOTHING: gtk_toggle_action_set_active (window->priv->show_layout_action, FALSE); break; case INPUT_PAD_WINDOW_SHOW_LAYOUT_TYPE_DEFAULT: gtk_toggle_action_set_active (window->priv->show_layout_action, TRUE); break; default:; } }
false
false
false
false
false
0
ensure_service_names (adcli_result res, adcli_enroll *enroll) { int length = 0; if (res != ADCLI_SUCCESS) return res; if (enroll->service_names) return ADCLI_SUCCESS; /* The default ones specified by MS */ enroll->service_names = _adcli_strv_add (enroll->service_names, strdup ("HOST"), &length); enroll->service_names = _adcli_strv_add (enroll->service_names, strdup ("RestrictedKrbHost"), &length); return ADCLI_SUCCESS; }
false
false
false
false
false
0
free_menu(MENU * menu) { T((T_CALLED("free_menu(%p)"), menu)); if (!menu) RETURN(E_BAD_ARGUMENT); if (menu->status & _POSTED) RETURN(E_POSTED); if (menu->items) _nc_Disconnect_Items(menu); if ((menu->status & _MARK_ALLOCATED) && menu->mark) free(menu->mark); free(menu); RETURN(E_OK); }
false
false
false
false
false
0
pixel_fogofwar_hexa(const struct tile *ptile, const struct player *pplayer, bool knowledge) { bv_pixel pixel; BV_CLR_ALL(pixel); BV_SET(pixel, 0); BV_SET(pixel, 3); BV_SET(pixel, 5); BV_SET(pixel, 7); BV_SET(pixel, 9); BV_SET(pixel, 11); BV_SET(pixel, 13); BV_SET(pixel, 15); BV_SET(pixel, 17); BV_SET(pixel, 18); BV_SET(pixel, 20); BV_SET(pixel, 22); BV_SET(pixel, 24); BV_SET(pixel, 26); BV_SET(pixel, 28); BV_SET(pixel, 30); BV_SET(pixel, 32); BV_SET(pixel, 35); return pixel; }
false
false
false
false
false
0
printNodeInfo() const { for (unsigned int i = 0; i < nodeCount; ++i) { if (!nodes[i].colors) continue; INFO("RIG_Node[%%%i]($[%u]%i): %u colors, weight %f, deg %u/%u\n X", i, nodes[i].f,nodes[i].reg,nodes[i].colors, nodes[i].weight, nodes[i].degree, nodes[i].degreeLimit); for (Graph::EdgeIterator ei = nodes[i].outgoing(); !ei.end(); ei.next()) INFO(" %%%i", RIG_Node::get(ei)->getValue()->id); for (Graph::EdgeIterator ei = nodes[i].incident(); !ei.end(); ei.next()) INFO(" %%%i", RIG_Node::get(ei)->getValue()->id); INFO("\n"); } }
false
false
false
false
false
0
mXactCacheGetBySet(int nmembers, MultiXactMember *members) { dlist_iter iter; debug_elog3(DEBUG2, "CacheGet: looking for %s", mxid_to_string(InvalidMultiXactId, nmembers, members)); /* sort the array so comparison is easy */ qsort(members, nmembers, sizeof(MultiXactMember), mxactMemberComparator); dlist_foreach(iter, &MXactCache) { mXactCacheEnt *entry = dlist_container(mXactCacheEnt, node, iter.cur); if (entry->nmembers != nmembers) continue; /* * We assume the cache entries are sorted, and that the unused bits in * "status" are zeroed. */ if (memcmp(members, entry->members, nmembers * sizeof(MultiXactMember)) == 0) { debug_elog3(DEBUG2, "CacheGet: found %u", entry->multi); dlist_move_head(&MXactCache, iter.cur); return entry->multi; } } debug_elog2(DEBUG2, "CacheGet: not found :-("); return InvalidMultiXactId; }
false
false
false
false
false
0
initializing_context (tree field) { tree t = DECL_CONTEXT (field); /* Anonymous union members can be initialized in the first enclosing non-anonymous union context. */ while (t && ANON_AGGR_TYPE_P (t)) t = TYPE_CONTEXT (t); return t; }
false
false
false
false
false
0
t10_pi_generate(struct blk_integrity_iter *iter, csum_fn *fn, unsigned int type) { unsigned int i; for (i = 0 ; i < iter->data_size ; i += iter->interval) { struct t10_pi_tuple *pi = iter->prot_buf; pi->guard_tag = fn(iter->data_buf, iter->interval); pi->app_tag = 0; if (type == 1) pi->ref_tag = cpu_to_be32(lower_32_bits(iter->seed)); else pi->ref_tag = 0; iter->data_buf += iter->interval; iter->prot_buf += sizeof(struct t10_pi_tuple); iter->seed++; } return 0; }
false
false
false
false
false
0
raise_file_descriptor_limit (BusContext *context) { #ifdef DBUS_UNIX DBusError error = DBUS_ERROR_INIT; /* we only do this once */ if (context->initial_fd_limit != NULL) return; context->initial_fd_limit = _dbus_rlimit_save_fd_limit (&error); if (context->initial_fd_limit == NULL) { bus_context_log (context, DBUS_SYSTEM_LOG_INFO, "%s: %s", error.name, error.message); dbus_error_free (&error); return; } /* We used to compute a suitable rlimit based on the configured number * of connections, but that breaks down as soon as we allow fd-passing, * because each connection is allowed to pass 64 fds to us, and if * they all did, we'd hit kernel limits. We now hard-code 64k as a * good limit, like systemd does: that's enough to avoid DoS from * anything short of multiple uids conspiring against us. */ if (!_dbus_rlimit_raise_fd_limit_if_privileged (65536, &error)) { bus_context_log (context, DBUS_SYSTEM_LOG_INFO, "%s: %s", error.name, error.message); dbus_error_free (&error); return; } #endif }
false
false
false
false
false
0
soap_in_xsd__boolean(struct soap *soap, const char *tag, enum xsd__boolean *a, const char *type) { if (soap_element_begin_in(soap, tag, 0, NULL)) return NULL; if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":boolean")) { soap->error = SOAP_TYPE; return NULL; } a = (enum xsd__boolean *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__boolean, sizeof(enum xsd__boolean), 0, NULL, NULL, NULL); if (!a) return NULL; if (soap->body && !*soap->href) { if (!a || soap_s2xsd__boolean(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) return NULL; } else { a = (enum xsd__boolean *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_xsd__boolean, 0, sizeof(enum xsd__boolean), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; }
false
false
false
false
false
0
_update_project_path (FrogrMainView *self, const gchar *path) { FrogrMainViewPrivate *priv = FROGR_MAIN_VIEW_GET_PRIVATE (self); /* Early return if nothing changed */ if (!g_strcmp0 (priv->project_filepath, path)) return; g_free (priv->project_name); g_free (priv->project_dir); g_free (priv->project_filepath); if (!path) { priv->project_name = NULL; priv->project_dir = NULL; priv->project_filepath = NULL; } else { GFile *file = NULL; GFile *dir = NULL; GFileInfo *file_info = NULL; gchar *dir_path = NULL; const gchar *home_dir = NULL; /* Get the display name in beautiful UTF-8 */ file = g_file_new_for_path (path); file_info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, G_FILE_QUERY_INFO_NONE, NULL, NULL); priv->project_name = g_strdup (g_file_info_get_display_name (file_info)); /* Get the base directory, in beautiful UTF-8 too */ dir = g_file_get_parent (file); dir_path = g_file_get_parse_name (dir); home_dir = g_get_home_dir (); if (g_str_has_prefix (dir_path, home_dir)) { gchar *tmp_path = NULL; tmp_path = dir_path; dir_path = g_strdup_printf ("~%s", &dir_path[g_utf8_strlen (home_dir, -1)]); g_free (tmp_path); } priv->project_dir = dir_path; /* Finally, store the raw path too */ priv->project_filepath = g_strdup (path); g_object_unref (file); g_object_unref (dir); } }
false
false
false
false
true
1
findInSource( QFlags<TargetTag> tag ) { Q_UNUSED( tag ) //first show the filebrowser AmarokUrl url; url.setCommand( "navigate" ); url.setPath( "files" ); url.run(); //then navigate to the correct directory BrowserCategory * fileCategory = The::mainWindow()->browserDock()->list()->activeCategoryRecursive(); if( fileCategory ) { FileBrowser * fileBrowser = dynamic_cast<FileBrowser *>( fileCategory ); if( fileBrowser ) { //get the path of the parent directory of the file KUrl playableUrl = m_track->playableUrl(); fileBrowser->setDir( playableUrl.directory() ); } } }
false
false
false
false
false
0
radeon_get_i2c_prescale(struct radeon_device *rdev) { u32 sclk = rdev->pm.current_sclk; u32 prescale = 0; u32 nm; u8 n, m, loop; int i2c_clock; switch (rdev->family) { case CHIP_R100: case CHIP_RV100: case CHIP_RS100: case CHIP_RV200: case CHIP_RS200: case CHIP_R200: case CHIP_RV250: case CHIP_RS300: case CHIP_RV280: case CHIP_R300: case CHIP_R350: case CHIP_RV350: i2c_clock = 60; nm = (sclk * 10) / (i2c_clock * 4); for (loop = 1; loop < 255; loop++) { if ((nm / loop) < loop) break; } n = loop - 1; m = loop - 2; prescale = m | (n << 8); break; case CHIP_RV380: case CHIP_RS400: case CHIP_RS480: case CHIP_R420: case CHIP_R423: case CHIP_RV410: prescale = (((sclk * 10)/(4 * 128 * 100) + 1) << 8) + 128; break; case CHIP_RS600: case CHIP_RS690: case CHIP_RS740: /* todo */ break; case CHIP_RV515: case CHIP_R520: case CHIP_RV530: case CHIP_RV560: case CHIP_RV570: case CHIP_R580: i2c_clock = 50; if (rdev->family == CHIP_R520) prescale = (127 << 8) + ((sclk * 10) / (4 * 127 * i2c_clock)); else prescale = (((sclk * 10)/(4 * 128 * 100) + 1) << 8) + 128; break; case CHIP_R600: case CHIP_RV610: case CHIP_RV630: case CHIP_RV670: /* todo */ break; case CHIP_RV620: case CHIP_RV635: case CHIP_RS780: case CHIP_RS880: case CHIP_RV770: case CHIP_RV730: case CHIP_RV710: case CHIP_RV740: /* todo */ break; case CHIP_CEDAR: case CHIP_REDWOOD: case CHIP_JUNIPER: case CHIP_CYPRESS: case CHIP_HEMLOCK: /* todo */ break; default: DRM_ERROR("i2c: unhandled radeon chip\n"); break; } return prescale; }
false
false
false
false
false
0
ctl_readable(evContext lev, void *uap, int fd, int evmask) { static const char me[] = "ctl_readable"; struct ctl_sess *sess = uap; struct ctl_sctx *ctx; char *eos, tmp[MAX_NTOP]; ssize_t n; REQUIRE(sess != NULL); REQUIRE(fd >= 0); REQUIRE(evmask == EV_READ); REQUIRE(sess->state == reading || sess->state == reading_data); ctx = sess->ctx; evTouchIdleTimer(lev, sess->rdtiID); if (!allocated_p(sess->inbuf) && ctl_bufget(&sess->inbuf, ctx->logger) < 0) { (*ctx->logger)(ctl_error, "%s: %s: cant get an input buffer", me, address_expr); ctl_close(sess); return; } n = read(sess->sock, sess->inbuf.text + sess->inbuf.used, MAX_LINELEN - sess->inbuf.used); if (n <= 0) { (*ctx->logger)(ctl_debug, "%s: %s: read: %s", me, address_expr, (n == 0) ? "Unexpected EOF" : strerror(errno)); ctl_close(sess); return; } sess->inbuf.used += n; eos = memchr(sess->inbuf.text, '\n', sess->inbuf.used); if (eos != NULL && eos != sess->inbuf.text && eos[-1] == '\r') { eos[-1] = '\0'; if ((sess->respflags & CTL_DATA) != 0) { INSIST(sess->verb != NULL); (*sess->verb->func)(sess->ctx, sess, sess->verb, sess->inbuf.text, CTL_DATA, sess->respctx, sess->ctx->uctx); } else { ctl_stop_read(sess); ctl_docommand(sess); } sess->inbuf.used -= ((eos - sess->inbuf.text) + 1); if (sess->inbuf.used == 0U) ctl_bufput(&sess->inbuf); else memmove(sess->inbuf.text, eos + 1, sess->inbuf.used); return; } if (sess->inbuf.used == (size_t)MAX_LINELEN) { (*ctx->logger)(ctl_error, "%s: %s: line too long, closing", me, address_expr); ctl_close(sess); } }
false
false
false
false
false
0
searchIncludesEntry(const KNS3::EntryInternal& entry) const { if (mCurrentRequest.sortMode == Updates) { if (entry.status() != Entry::Updateable) { return false; } } if (mCurrentRequest.searchTerm.isEmpty()) { return true; } QString search = mCurrentRequest.searchTerm; if (entry.name().contains(search, Qt::CaseInsensitive) || entry.summary().contains(search, Qt::CaseInsensitive) || entry.author().name().contains(search, Qt::CaseInsensitive) ) { return true; } return false; }
false
false
false
false
false
0
DIM_GetChannelState(struct dim_channel *ch, struct dim_ch_state_t *state_ptr) { if (!ch || !state_ptr) return NULL; state_ptr->ready = ch->state.level < 2; state_ptr->done_buffers = ch->done_sw_buffers_number; return state_ptr; }
false
false
false
false
false
0
gin_redo(XLogRecPtr lsn, XLogRecord *record) { uint8 info = record->xl_info & ~XLR_INFO_MASK; /* * GIN indexes do not require any conflict processing. */ RestoreBkpBlocks(lsn, record, false); topCtx = MemoryContextSwitchTo(opCtx); switch (info) { case XLOG_GIN_CREATE_INDEX: ginRedoCreateIndex(lsn, record); break; case XLOG_GIN_CREATE_PTREE: ginRedoCreatePTree(lsn, record); break; case XLOG_GIN_INSERT: ginRedoInsert(lsn, record); break; case XLOG_GIN_SPLIT: ginRedoSplit(lsn, record); break; case XLOG_GIN_VACUUM_PAGE: ginRedoVacuumPage(lsn, record); break; case XLOG_GIN_DELETE_PAGE: ginRedoDeletePage(lsn, record); break; case XLOG_GIN_UPDATE_META_PAGE: ginRedoUpdateMetapage(lsn, record); break; case XLOG_GIN_INSERT_LISTPAGE: ginRedoInsertListPage(lsn, record); break; case XLOG_GIN_DELETE_LISTPAGE: ginRedoDeleteListPages(lsn, record); break; default: elog(PANIC, "gin_redo: unknown op code %u", info); } MemoryContextSwitchTo(topCtx); MemoryContextReset(opCtx); }
false
false
false
false
false
0
gst_mpegvideoparse_chain (GstPad * pad, GstBuffer * buf) { MpegVideoParse *mpegvideoparse; GstFlowReturn res; gboolean discont; mpegvideoparse = GST_MPEGVIDEOPARSE (gst_object_get_parent (GST_OBJECT (pad))); discont = GST_BUFFER_IS_DISCONT (buf); if (mpegvideoparse->segment.rate > 0.0) res = gst_mpegvideoparse_chain_forward (mpegvideoparse, discont, buf); else res = gst_mpegvideoparse_chain_reverse (mpegvideoparse, discont, buf); gst_object_unref (mpegvideoparse); return res; }
false
false
false
false
false
0
prot_flush_writebuffer(struct protstream *s, const char *buf, size_t len) { int n; do { cmdtime_netstart(); #ifdef HAVE_SSL if (s->tls_conn != NULL) { n = SSL_write(s->tls_conn, (char *)buf, len); } else { n = write(s->fd, buf, len); } #else /* HAVE_SSL */ n = write(s->fd, buf, len); #endif /* HAVE_SSL */ cmdtime_netend(); } while (n == -1 && errno == EINTR && !signals_poll()); return n; }
false
false
false
false
false
0
cvt_l(SprintfState *ss, long num, int width, int prec, int radix, int type, int flags, const char *hexp) { char cvtbuf[100]; char *cvt; int digits; /* according to the man page this needs to happen */ if ((prec == 0) && (num == 0)) { return 0; } /* ** Converting decimal is a little tricky. In the unsigned case we ** need to stop when we hit 10 digits. In the signed case, we can ** stop when the number is zero. */ cvt = cvtbuf + sizeof(cvtbuf); digits = 0; while (num) { int digit = (((unsigned long)num) % radix) & 0xF; *--cvt = hexp[digit]; digits++; num = (long)(((unsigned long)num) / radix); } if (digits == 0) { *--cvt = '0'; digits++; } /* ** Now that we have the number converted without its sign, deal with ** the sign and zero padding. */ return fill_n(ss, cvt, digits, width, prec, type, flags); }
false
false
false
false
false
0
auth_client_setup (const char *mount, client_t *client) { /* This will look something like "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" */ const char *header = httpp_getvar(client->parser, "authorization"); char *userpass, *tmp; char *username, *password; auth_client *auth_user; do { if (header == NULL) break; if (strncmp(header, "Basic ", 6) == 0) { userpass = util_base64_decode (header+6); if (userpass == NULL) { WARN1("Base64 decode of Authorization header \"%s\" failed", header+6); break; } tmp = strchr(userpass, ':'); if (tmp == NULL) { free (userpass); break; } *tmp = 0; username = userpass; password = tmp+1; client->username = strdup (username); client->password = strdup (password); free (userpass); break; } INFO1 ("unhandled authorization header: %s", header); } while (0); auth_user = calloc (1, sizeof(auth_client)); auth_user->mount = strdup (mount); auth_user->client = client; return auth_user; }
false
false
false
false
false
0
pdc_desc_put(struct pch_dma_chan *pd_chan, struct pch_dma_desc *desc) { if (desc) { spin_lock(&pd_chan->lock); list_splice_init(&desc->tx_list, &pd_chan->free_list); list_add(&desc->desc_node, &pd_chan->free_list); spin_unlock(&pd_chan->lock); } }
false
false
false
false
false
0
SolveP5_1(double a,double b,double c,double d,double e) // return real root of x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0 { int cnt; if( fabs(e)<eps ) return 0; double brd = fabs(a); // brd - border of real roots if( fabs(b)>brd ) brd = fabs(b); if( fabs(c)>brd ) brd = fabs(c); if( fabs(d)>brd ) brd = fabs(d); if( fabs(e)>brd ) brd = fabs(e); brd++; // brd - border of real roots double x0, f0; // less, than root double x1, f1; // greater, than root double x2, f2, f2s; // next values, f(x2), f'(x2) double dx; if( e<0 ) { x0 = 0; x1 = brd; f0=e; f1=F5(x1); x2 = 0.01*brd; } else { x0 =-brd; x1 = 0; f0=F5(x0); f1=e; x2 =-0.01*brd; } if( fabs(f0)<eps ) return x0; if( fabs(f1)<eps ) return x1; // now x0<x1, f(x0)<0, f(x1)>0 // Firstly 5 bisections for( cnt=0; cnt<5; cnt++) { x2 = (x0 + x1)/2; // next point f2 = F5(x2); // f(x2) if( fabs(f2)<eps ) return x2; if( f2>0 ) { x1=x2; f1=f2; } else { x0=x2; f0=f2; } } // At each step: // x0<x1, f(x0)<0, f(x1)>0. // x2 - next value // we hope that x0 < x2 < x1, but not necessarily do { cnt++; if( x2<=x0 || x2>= x1 ) x2 = (x0 + x1)/2; // now x0 < x2 < x1 f2 = F5(x2); // f(x2) if( fabs(f2)<eps ) return x2; if( f2>0 ) { x1=x2; f1=f2; } else { x0=x2; f0=f2; } f2s= (((5*x2+4*a)*x2+3*b)*x2+2*c)*x2+d; // f'(x2) if( fabs(f2s)<eps ) { x2=1e99; continue; } dx = f2/f2s; x2 -= dx; } while(fabs(dx)>eps); return x2; }
false
false
false
false
false
0
message_template_parse_emailbody(const char *configuration) { char *tmpread, *tmpwrite; char *emailbody = ast_strdup(configuration); /* substitute strings \t and \n into the apropriate characters */ tmpread = tmpwrite = emailbody; while ((tmpwrite = strchr(tmpread,'\\'))) { int len = strlen("\n"); switch (tmpwrite[1]) { case 'n': memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1); strncpy(tmpwrite, "\n", len); break; case 't': memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1); strncpy(tmpwrite, "\t", len); break; default: ast_log(LOG_NOTICE, "Substitution routine does not support this character: %c\n", tmpwrite[1]); } tmpread = tmpwrite + len; } return emailbody; }
false
false
false
false
false
0
mh_mailstorage_get_folder_session(struct mailstorage * storage, char * pathname, mailsession ** result) { int r; r = mailsession_select_folder(storage->sto_session, pathname); if (r != MAIL_NO_ERROR) return r; * result = storage->sto_session; return MAIL_NO_ERROR; }
false
false
false
false
false
0
ibmasm_init_reverse_heartbeat(struct service_processor *sp, struct reverse_heartbeat *rhb) { init_waitqueue_head(&rhb->wait); rhb->stopped = 0; }
false
false
false
false
false
0
highlight_selected(GooCanvasItem * button) { if (selected_button != NULL && selected_button != button) { g_object_set(selected_button, "svg-id", "#BUTTON_TEXT", NULL); } if (selected_button != button) { g_object_set(button, "svg-id", "#BUTTON_TEXT_SELECTED", NULL); selected_button = button; } }
false
false
false
false
false
0
mei_me_pg_unset(struct mei_device *dev) { struct mei_me_hw *hw = to_me_hw(dev); u32 reg; reg = mei_me_reg_read(hw, H_HPG_CSR); trace_mei_reg_read(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg); WARN(!(reg & H_HPG_CSR_PGI), "PGI is not set\n"); reg |= H_HPG_CSR_PGIHEXR; trace_mei_reg_write(dev->dev, "H_HPG_CSR", H_HPG_CSR, reg); mei_me_reg_write(hw, H_HPG_CSR, reg); }
false
false
false
false
false
0
eventFilter( QObject *o, QEvent *e ) { Q_UNUSED(o); // o is m_widget or its viewport //Q_ASSERT( o == m_widget ); switch ( e->type() ) { case QEvent::Leave: case QEvent::FocusOut: case QEvent::WindowDeactivate: unhideCursor(); break; case QEvent::KeyPress: case QEvent::ShortcutOverride: hideCursor(); break; case QEvent::Enter: case QEvent::FocusIn: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: case QEvent::MouseMove: case QEvent::Show: case QEvent::Hide: case QEvent::Wheel: unhideCursor(); if ( m_widget->hasFocus() ) { m_autoHideTimer.setSingleShot( true ); m_autoHideTimer.start( KCursorPrivate::self()->hideCursorDelay ); } break; default: break; } return false; }
false
false
false
false
false
0
zx_DEC_ELEM_sa11_Evidence(struct zx_ctx* c, struct zx_sa11_Evidence_s* x) { struct zx_elem_s* el = x->gg.kids; switch (el->g.tok) { case zx_sa11_AssertionIDReference_ELEM: if (!x->AssertionIDReference) x->AssertionIDReference = el; return 1; case zx_sa11_Assertion_ELEM: if (!x->Assertion) x->Assertion = (struct zx_sa11_Assertion_s*)el; return 1; default: return 0; } }
false
false
false
false
false
0
record_bullets() { bullets.clear(); *(short *)bullets.reserve(sizeof(short)) = bullet_array.size(); for( short bulletRecno = 1; bulletRecno <= bullet_array.size(); ++bulletRecno) { CRC_TYPE checkNum = 0; if( !bullet_array.is_deleted(bulletRecno) ) checkNum = bullet_array[bulletRecno]->crc8(); *(CRC_TYPE *)bullets.reserve(sizeof(CRC_TYPE)) = checkNum; } }
false
false
false
false
false
0
IsBKGFile(FileHelper * fh) { fhReset(fh); fhSkipWS(fh); if (fhReadString(fh, "Black")) return TRUE; fhReset(fh); fhSkipWS(fh); if (fhReadString(fh, "White")) return TRUE; return FALSE; }
false
false
false
false
false
0
mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status) { TransportState result = 0; gboolean _tmp0_ = FALSE; const gchar* _tmp1_ = NULL; gboolean _tmp3_ = FALSE; g_return_val_if_fail (self != NULL, 0); _tmp1_ = status; if (_tmp1_ != NULL) { const gchar* _tmp2_ = NULL; _tmp2_ = status; _tmp0_ = g_strcmp0 (_tmp2_, "Playing") == 0; } else { _tmp0_ = FALSE; } _tmp3_ = _tmp0_; if (_tmp3_) { result = TRANSPORT_STATE_PLAYING; return result; } result = TRANSPORT_STATE_PAUSED; return result; }
false
false
false
false
false
0
bytes_write_java( struct SResource *res, UErrorCode *status) { const char* type = "new byte[] {"; const char* byteDecl = "%i, "; char byteBuffer[100] = { 0 }; uint8_t* byteArray = NULL; int byteIterator = 0; int32_t srcLen=res->u.fBinaryValue.fLength; if(srcLen>0 ) { byteArray = res->u.fBinaryValue.fData; write_tabs(out); T_FileStream_write(out, type, (int32_t)uprv_strlen(type)); T_FileStream_write(out, "\n", 1); tabCount++; for (;byteIterator<srcLen;byteIterator++) { if (byteIterator%16 == 0) { write_tabs(out); } if (byteArray[byteIterator] < 128) { sprintf(byteBuffer, byteDecl, byteArray[byteIterator]); } else { sprintf(byteBuffer, byteDecl, (byteArray[byteIterator]-256)); } T_FileStream_write(out, byteBuffer, (int32_t)uprv_strlen(byteBuffer)); if (byteIterator%16 == 15) { T_FileStream_write(out, "\n", 1); } } if (((byteIterator-1)%16) != 15) { T_FileStream_write(out, "\n", 1); } tabCount--; write_tabs(out); T_FileStream_write(out, "},\n", 3); } else { /* Empty array */ write_tabs(out); T_FileStream_write(out,type,(int32_t)uprv_strlen(type)); T_FileStream_write(out,"},\n",3); } }
false
false
false
false
false
0
get_object_address( zword_t obj ) { int offset; /* Address calculation is object table base + size of default properties area + * object number-1 * object size */ if ( h_type < V4 ) offset = h_objects_offset + ( ( P3_MAX_PROPERTIES - 1 ) * 2 ) + ( ( obj - 1 ) * O3_SIZE ); else offset = h_objects_offset + ( ( P4_MAX_PROPERTIES - 1 ) * 2 ) + ( ( obj - 1 ) * O4_SIZE ); return ( ( zword_t ) offset ); }
false
false
false
false
false
0
FuncIO_send(Obj self,Obj fd,Obj st,Obj offset,Obj count,Obj flags) { Int bytes; if (!IS_INTOBJ(fd) || !IS_STRING(st) || !IS_STRING_REP(st) || !IS_INTOBJ(offset) || !IS_INTOBJ(count) || !IS_INTOBJ(flags)) { SyClearErrorNo(); return Fail; } if (GET_LEN_STRING(st) < INT_INTOBJ(offset)+INT_INTOBJ(count)) { SyClearErrorNo(); return Fail; } bytes = (Int) send(INT_INTOBJ(fd), (char *) CHARS_STRING(st)+INT_INTOBJ(offset), INT_INTOBJ(count),INT_INTOBJ(flags)); if (bytes < 0) { SySetErrorNo(); return Fail; } else return INTOBJ_INT(bytes); }
false
false
false
false
false
0
lua_pushlstring (lua_State *L, const char *s, size_t len) { tsvalue(L->top) = luaS_newlstr(L, s, len); ttype(L->top) = LUA_TSTRING; api_incr_top(L); }
false
false
false
false
false
0
__ecereMethod___ecereNameSpace__ecere__gfx3D__Object_InsideFrustum(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__gfx3D__Plane * planes) { struct __ecereNameSpace__ecere__gfx3D__Object * __ecerePointer___ecereNameSpace__ecere__gfx3D__Object = (struct __ecereNameSpace__ecere__gfx3D__Object *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__ecere__gfx3D__Object->offset) : 0); int result = 1; int p; for(p = 0; p < 6; p++) { struct __ecereNameSpace__ecere__gfx3D__Plane * plane = &planes[p]; double dot = __ecereMethod___ecereNameSpace__ecere__gfx3D__Vector3D_DotProduct(&(*plane).normal, &__ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wcenter); double distance = dot + (*plane).d; if(distance < -__ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wradius) { result = 0; break; } if(((distance < 0) ? -distance : distance) < __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wradius) result = 2; } if(result == 2) { struct __ecereNameSpace__ecere__gfx3D__Vector3D box[8] = { { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.z }, { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.z }, { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.z }, { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.z }, { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.z }, { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.z }, { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmin.z }, { __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.x, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.y, __ecerePointer___ecereNameSpace__ecere__gfx3D__Object->wmax.z } }; int numPlanesAllIn = 0; for(p = 0; p < 6; p++) { struct __ecereNameSpace__ecere__gfx3D__Plane * plane = &planes[p]; int i; int numGoodPoints = 0; for(i = 0; i < 8; ++i) { double dot = __ecereMethod___ecereNameSpace__ecere__gfx3D__Vector3D_DotProduct(&(*plane).normal, &box[i]); double distance = dot + (*plane).d; if(distance > (double)(double)(-1)) numGoodPoints++; } if(!numGoodPoints) { result = 0; break; } if(numGoodPoints == 8) numPlanesAllIn++; } if(numPlanesAllIn == 6) result = 1; } return result; }
false
false
false
true
false
1
ddf_MatrixNormalizedSortedCopy(ddf_MatrixPtr M,ddf_rowindex *newpos) /* 094 */ { /* Sort the rows of Amatrix lexicographically, and return a link to this sorted copy. The vector newpos is allocated, where newpos[i] returns the new row index of the original row i (i=1,...,M->rowsize). */ ddf_MatrixPtr Mcopy=NULL,Mnorm=NULL; ddf_rowrange m,i; ddf_colrange d; ddf_rowindex roworder; /* if (newpos!=NULL) free(newpos); */ m= M->rowsize; d= M->colsize; roworder=(long *)calloc(m+1,sizeof(long)); *newpos=(long *)calloc(m+1,sizeof(long)); if (m >=0 && d >=0){ Mnorm=ddf_MatrixNormalizedCopy(M); Mcopy=ddf_CreateMatrix(m, d); for(i=1; i<=m; i++) roworder[i]=i; ddf_RandomPermutation(roworder, m, 123); ddf_QuickSort(roworder,1,m,Mnorm->matrix,d); ddf_PermuteCopyAmatrix(Mcopy->matrix, Mnorm->matrix, m, d, roworder); ddf_CopyArow(Mcopy->rowvec, M->rowvec, d); for(i=1; i<=m; i++) { if (set_member(roworder[i],M->linset)) set_addelem(Mcopy->linset, i); (*newpos)[roworder[i]]=i; } Mcopy->numbtype=M->numbtype; Mcopy->representation=M->representation; Mcopy->objective=M->objective; ddf_FreeMatrix(Mnorm); } free(roworder); return Mcopy; }
false
false
false
false
false
0
cfq_cic_lookup(struct cfq_data *cfqd, struct io_context *ioc) { if (ioc) return icq_to_cic(ioc_lookup_icq(ioc, cfqd->queue)); return NULL; }
false
false
false
false
false
0
getp_to_byte_array(VMG_ vm_val_t *retval, const vm_val_t *self_val, const char *str, uint *argc) { static CVmNativeCodeDesc desc(1); size_t len; CCharmapToLocal *mapper; vm_val_t *arg; size_t byte_len; size_t src_bytes_used; size_t out_idx; CVmObjByteArray *arr; /* check arguments */ if (get_prop_check_argc(retval, argc, &desc)) return TRUE; /* retrieve the CharacterSet object and make sure it's valid */ arg = G_stk->get(0); if (arg->typ != VM_OBJ || !CVmObjCharSet::is_charset(vmg_ arg->val.obj)) err_throw(VMERR_BAD_TYPE_BIF); /* get the to-local mapping from the character set */ mapper = ((CVmObjCharSet *)vm_objp(vmg_ arg->val.obj)) ->get_to_local(vmg0_); /* get my length and skip the length prefix */ len = vmb_get_len(str); str += VMB_LEN; /* * first, do a mapping with a null output buffer to determine how many * bytes we need for the mapping */ byte_len = mapper->map_utf8(0, 0, str, len, &src_bytes_used); /* allocate a new ByteArray with the required number of bytes */ retval->set_obj(CVmObjByteArray::create(vmg_ FALSE, byte_len)); arr = (CVmObjByteArray *)vm_objp(vmg_ retval->val.obj); /* convert it again, this time storing the bytes */ for (out_idx = 1 ; len != 0 ; ) { char buf[128]; /* convert a buffer-full */ byte_len = mapper->map_utf8(buf, sizeof(buf), str, len, &src_bytes_used); /* store the bytes in the byte array */ arr->cons_copy_from_buf((unsigned char *)buf, out_idx, byte_len); /* advance past the output bytes we used */ out_idx += byte_len; /* advance past the source bytes we used */ str += src_bytes_used; len -= src_bytes_used; } /* discard arguments */ G_stk->discard(); /* handled */ return TRUE; }
false
false
false
false
false
0
dns_set_async_mode(int myval,CDNSCLIENT *mythis) { int dpipe[2]; if (myval && (dns_r_pipe==-1)) { if (pipe(dpipe)) return 1; dns_r_pipe=dpipe[0]; dns_w_pipe=dpipe[1]; sem_init(&dns_th_pipe,0,1); GB.Watch(dns_r_pipe , GB_WATCH_READ , (void *)dns_callback,0); } mythis->iAsync=myval; return 0; }
false
false
false
false
false
0
diff(const RCP<const Symbol> &x) const { return mul(mul(tan(get_arg()), sec(get_arg())), get_arg()->diff(x)); }
false
false
false
false
false
0
hawki_dfs_set_groups(cpl_frameset * set) { cpl_frame * cur_frame ; const char * tag ; int nframes ; int i ; /* Check entries */ if (set == NULL) return -1 ; /* Initialize */ nframes = cpl_frameset_get_size(set) ; /* Loop on frames */ for (i=0 ; i<nframes ; i++) { cur_frame = cpl_frameset_get_frame(set, i) ; tag = cpl_frame_get_tag(cur_frame) ; /* RAW frames */ if (!strcmp(tag, HAWKI_COMMAND_LINE) || !strcmp(tag, HAWKI_CAL_DARK_RAW) || !strcmp(tag, HAWKI_TEC_FLAT_RAW) || !strcmp(tag, HAWKI_CAL_FLAT_RAW) || !strcmp(tag, HAWKI_CAL_ZPOINT_RAW) || !strcmp(tag, HAWKI_CAL_ILLUM_RAW) || !strcmp(tag, HAWKI_CAL_DISTOR_RAW) || !strcmp(tag, HAWKI_IMG_JITTER_SKY_RAW) || !strcmp(tag, HAWKI_IMG_JITTER_RAW) || !strcmp(tag, HAWKI_CAL_LINGAIN_LAMP_RAW) || !strcmp(tag, HAWKI_CAL_LINGAIN_DARK_RAW) || !strcmp(tag, HAWKI_CALPRO_BASICCALIBRATED) || !strcmp(tag, HAWKI_CALPRO_SKY_BASICCALIBRATED) || !strcmp(tag, HAWKI_CALPRO_BKGIMAGE) || !strcmp(tag, HAWKI_CALPRO_BKG_SUBTRACTED) || !strcmp(tag, HAWKI_CALPRO_DIST_CORRECTED) || !strcmp(tag, HAWKI_CALPRO_COMBINED) || !strcmp(tag, HAWKI_CALPRO_OBJ_MASK) || !strcmp(tag, HAWKI_CALPRO_ZPOINT_TAB)) cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_RAW) ; /* CALIB frames */ else if (!strcmp(tag, HAWKI_CALPRO_BPM) || !strcmp(tag, HAWKI_UTIL_STDSTARS_RAW) || !strcmp(tag, HAWKI_UTIL_DISTMAP_RAW) || !strcmp(tag, HAWKI_CALPRO_BPM_HOT) || !strcmp(tag, HAWKI_CALPRO_BPM_COLD) || !strcmp(tag, HAWKI_CALPRO_FLAT) || !strcmp(tag, HAWKI_CALPRO_DARK) || !strcmp(tag, HAWKI_CALPRO_STDSTARS) || !strcmp(tag, HAWKI_CALPRO_DISTORTION_X) || !strcmp(tag, HAWKI_CALPRO_DISTORTION_Y) || !strcmp(tag, HAWKI_CALPRO_DISTORTION)) cpl_frame_set_group(cur_frame, CPL_FRAME_GROUP_CALIB) ; } return 0 ; }
false
false
false
false
false
0
cam_keypoints_tracking2_add_to_linked_list(CamList *l, void *data) { CamList *head; head = (CamList*)malloc(sizeof(CamList)); head->data = data; head->next = l; if (l) head->index = l->index + 1; else head->index = 1; return (head); }
false
false
false
false
false
0
Stream_nextLine(Stream * stream) { String * line; char currentChar; if(stream == NULL || !stream->canRead) return NULL; line = String_createEmpty(); currentChar = fgetc(stream->stream); if(currentChar == EOF) { String_destroy(line); return NULL; } if(currentChar == '\n') { return line; } String_appendChar(line, currentChar); while((currentChar = fgetc(stream->stream)) != '\n' && currentChar != EOF) { String_appendChar(line, currentChar); } return line; }
false
false
false
false
false
0
il4965_rs_tl_rm_old_stats(struct il_traffic_load *tl, u32 curr_time) { /* The oldest age we want to keep */ u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; while (tl->queue_count && tl->time_stamp < oldest_time) { tl->total -= tl->packet_count[tl->head]; tl->packet_count[tl->head] = 0; tl->time_stamp += TID_QUEUE_CELL_SPACING; tl->queue_count--; tl->head++; if (tl->head >= TID_QUEUE_MAX_SIZE) tl->head = 0; } }
false
false
false
false
false
0
SetCatPrio(uint8 cat, uint8 newprio) { for ( uint16 i = 0; i < GetFileCount(); i++ ) { CPartFile* file = GetFileByIndex( i ); if ( !cat || file->GetCategory() == cat ) { if ( newprio == PR_AUTO ) { file->SetAutoDownPriority(true); } else { file->SetAutoDownPriority(false); file->SetDownPriority(newprio); } } } }
false
false
false
false
false
0
stk_sensor_init(struct stk_camera *dev) { u8 idl = 0; u8 idh = 0; if (stk_camera_write_reg(dev, STK_IIC_ENABLE, STK_IIC_ENABLE_YES) || stk_camera_write_reg(dev, STK_IIC_ADDR, SENSOR_ADDRESS) || stk_sensor_outb(dev, REG_COM7, COM7_RESET)) { STK_ERROR("Sensor resetting failed\n"); return -ENODEV; } msleep(10); /* Read the manufacturer ID: ov = 0x7FA2 */ if (stk_sensor_inb(dev, REG_MIDH, &idh) || stk_sensor_inb(dev, REG_MIDL, &idl)) { STK_ERROR("Strange error reading sensor ID\n"); return -ENODEV; } if (idh != 0x7f || idl != 0xa2) { STK_ERROR("Huh? you don't have a sensor from ovt\n"); return -ENODEV; } if (stk_sensor_inb(dev, REG_PID, &idh) || stk_sensor_inb(dev, REG_VER, &idl)) { STK_ERROR("Could not read sensor model\n"); return -ENODEV; } stk_sensor_write_regvals(dev, ov_initvals); msleep(10); STK_INFO("OmniVision sensor detected, id %02X%02X" " at address %x\n", idh, idl, SENSOR_ADDRESS); return 0; }
false
false
false
false
false
0
show_help(void) #else void show_help() #endif { long long i; if(!silent) printf("iozone: help mode\n\n"); for(i=0; strlen(help[i]); i++) { if(!silent) printf("%s\n", help[i]); } }
false
false
false
false
false
0
setPosition(qint64 position) { Q_D(QMediaPlayer); if (d->control == 0 || !isSeekable()) return; d->control->setPosition(qBound(qint64(0), position, duration())); }
false
false
false
false
false
0
tail_lines (const char *pretty_filename, int fd, uintmax_t n_lines, uintmax_t *read_pos) { struct stat stats; if (fstat (fd, &stats)) { error (0, errno, _("cannot fstat %s"), quote (pretty_filename)); return false; } if (from_start) { int t = start_lines (pretty_filename, fd, n_lines, read_pos); if (t) return t < 0; *read_pos += dump_remainder (pretty_filename, fd, COPY_TO_EOF); } else { off_t start_pos = -1; off_t end_pos; /* Use file_lines only if FD refers to a regular file for which lseek (... SEEK_END) works. */ if ( ! presume_input_pipe && S_ISREG (stats.st_mode) && (start_pos = lseek (fd, 0, SEEK_CUR)) != -1 && start_pos < (end_pos = lseek (fd, 0, SEEK_END))) { *read_pos = end_pos; if (end_pos != 0 && ! file_lines (pretty_filename, fd, n_lines, start_pos, end_pos, read_pos)) return false; } else { /* Under very unlikely circumstances, it is possible to reach this point after positioning the file pointer to end of file via the 'lseek (...SEEK_END)' above. In that case, reposition the file pointer back to start_pos before calling pipe_lines. */ if (start_pos != -1) xlseek (fd, start_pos, SEEK_SET, pretty_filename); return pipe_lines (pretty_filename, fd, n_lines, read_pos); } } return true; }
false
false
false
false
false
0
qlcnic_83xx_check_vf(struct qlcnic_adapter *adapter, const struct pci_device_id *ent) { u32 op_mode, priv_level; struct qlcnic_hardware_context *ahw = adapter->ahw; ahw->fw_hal_version = 2; qlcnic_get_func_no(adapter); if (qlcnic_sriov_vf_check(adapter)) { qlcnic_sriov_vf_set_ops(adapter); return; } /* Determine function privilege level */ op_mode = QLCRDX(adapter->ahw, QLC_83XX_DRV_OP_MODE); if (op_mode == QLC_83XX_DEFAULT_OPMODE) priv_level = QLCNIC_MGMT_FUNC; else priv_level = QLC_83XX_GET_FUNC_PRIVILEGE(op_mode, ahw->pci_func); if (priv_level == QLCNIC_NON_PRIV_FUNC) { ahw->op_mode = QLCNIC_NON_PRIV_FUNC; dev_info(&adapter->pdev->dev, "HAL Version: %d Non Privileged function\n", ahw->fw_hal_version); adapter->nic_ops = &qlcnic_vf_ops; } else { if (pci_find_ext_capability(adapter->pdev, PCI_EXT_CAP_ID_SRIOV)) set_bit(__QLCNIC_SRIOV_CAPABLE, &adapter->state); adapter->nic_ops = &qlcnic_83xx_ops; } }
false
false
false
false
false
0
handle_tags_and_duplicates(struct string_list *extra_refs) { struct commit *commit; int i; for (i = extra_refs->nr - 1; i >= 0; i--) { const char *name = extra_refs->items[i].string; struct object *object = extra_refs->items[i].util; switch (object->type) { case OBJ_TAG: handle_tag(name, (struct tag *)object); break; case OBJ_COMMIT: /* create refs pointing to already seen commits */ commit = (struct commit *)object; printf("reset %s\nfrom :%d\n\n", name, get_object_mark(&commit->object)); show_progress(); break; } } }
false
false
false
false
false
0
GetComboCommandId(CommandId cmin, CommandId cmax) { CommandId combocid; ComboCidKeyData key; ComboCidEntry entry; bool found; /* * Create the hash table and array the first time we need to use combo * cids in the transaction. */ if (comboHash == NULL) { HASHCTL hash_ctl; memset(&hash_ctl, 0, sizeof(hash_ctl)); hash_ctl.keysize = sizeof(ComboCidKeyData); hash_ctl.entrysize = sizeof(ComboCidEntryData); hash_ctl.hcxt = TopTransactionContext; comboHash = hash_create("Combo CIDs", CCID_HASH_SIZE, &hash_ctl, HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); comboCids = (ComboCidKeyData *) MemoryContextAlloc(TopTransactionContext, sizeof(ComboCidKeyData) * CCID_ARRAY_SIZE); sizeComboCids = CCID_ARRAY_SIZE; usedComboCids = 0; } /* Lookup or create a hash entry with the desired cmin/cmax */ /* We assume there is no struct padding in ComboCidKeyData! */ key.cmin = cmin; key.cmax = cmax; entry = (ComboCidEntry) hash_search(comboHash, (void *) &key, HASH_ENTER, &found); if (found) { /* Reuse an existing combo cid */ return entry->combocid; } /* * We have to create a new combo cid. Check that there's room for it in * the array, and grow it if there isn't. */ if (usedComboCids >= sizeComboCids) { /* We need to grow the array */ int newsize = sizeComboCids * 2; comboCids = (ComboCidKeyData *) repalloc(comboCids, sizeof(ComboCidKeyData) * newsize); sizeComboCids = newsize; } combocid = usedComboCids; comboCids[combocid].cmin = cmin; comboCids[combocid].cmax = cmax; usedComboCids++; entry->combocid = combocid; return combocid; }
false
false
false
false
false
0
eb_load_catalog(EB_Book *book) { EB_Error_Code error_code; char catalog_file_name[EB_MAX_FILE_NAME_LENGTH + 1]; char catalog_path_name[EB_MAX_PATH_LENGTH + 1]; LOG(("in: eb_load_catalog(book=%d)", (int)book->code)); /* * Find a catalog file. */ if (eb_find_file_name(book->path, "catalog", catalog_file_name) == EB_SUCCESS) { book->disc_code = EB_DISC_EB; } else if (eb_find_file_name(book->path, "catalogs", catalog_file_name) == EB_SUCCESS) { book->disc_code = EB_DISC_EPWING; } else { error_code = EB_ERR_FAIL_OPEN_CAT; goto failed; } eb_compose_path_name(book->path, catalog_file_name, catalog_path_name); /* * Load the catalog file. */ if (book->disc_code == EB_DISC_EB) error_code = eb_load_catalog_eb(book, catalog_path_name); else error_code = eb_load_catalog_epwing(book, catalog_path_name); if (error_code != EB_SUCCESS) goto failed; /* * Fix chachacter-code of the book. */ eb_fix_misleaded_book(book); LOG(("out: eb_load_catalog() = %s", eb_error_string(EB_SUCCESS))); return EB_SUCCESS; /* * An error occurs... */ failed: if (book->subbooks != NULL) { free(book->subbooks); book->subbooks = NULL; } LOG(("out: eb_load_catalog() = %s", eb_error_string(error_code))); return error_code; }
false
false
false
false
false
0
fortyl_plot_pix(int offset) { int x,y,i,c,d1,d2; x = (offset & 0x1f)*8; y = (offset >> 5) & 0xff; if (pixram_sel) { d1 = fortyl_pixram2[offset]; d2 = fortyl_pixram2[offset + 0x2000]; } else { d1 = fortyl_pixram1[offset]; d2 = fortyl_pixram1[offset + 0x2000]; } for (i=0;i<8;i++) { c = ((d2>>i)&1) + ((d1>>i)&1)*2; if (pixram_sel) plot_pixel(pixel_bitmap2, x+i, y, fortyl_pix_color[c]); else plot_pixel(pixel_bitmap1, x+i, y, fortyl_pix_color[c]); } }
false
false
false
false
false
0
close_console_window(void) { pid_t pid = fork(); if (pid < 0) { return RC_OS_FORK_FAILURE; } if (pid == 0) /* child */ { fclose(stdin); fclose(stderr); setsid(); if (-1 == chdir("/")) { logit(LOG_WARNING, MODULE_TAG "Failed changing cwd to /: %s", strerror(errno)); } umask(0); return RC_OK; } exit(0); return RC_OK; /* Never reached. */ }
false
false
false
false
true
1
libpqrcv_connect(char *conninfo, XLogRecPtr startpoint) { char conninfo_repl[MAXCONNINFO + 37]; char *primary_sysid; char standby_sysid[32]; TimeLineID primary_tli; TimeLineID standby_tli; PGresult *res; char cmd[64]; /* * Connect using deliberately undocumented parameter: replication. The * database name is ignored by the server in replication mode, but specify * "replication" for .pgpass lookup. */ snprintf(conninfo_repl, sizeof(conninfo_repl), "%s dbname=replication replication=true", conninfo); streamConn = PQconnectdb(conninfo_repl); if (PQstatus(streamConn) != CONNECTION_OK) ereport(ERROR, (errmsg("could not connect to the primary server: %s", PQerrorMessage(streamConn)))); /* * Get the system identifier and timeline ID as a DataRow message from the * primary server. */ res = libpqrcv_PQexec("IDENTIFY_SYSTEM"); if (PQresultStatus(res) != PGRES_TUPLES_OK) { PQclear(res); ereport(ERROR, (errmsg("could not receive database system identifier and timeline ID from " "the primary server: %s", PQerrorMessage(streamConn)))); } if (PQnfields(res) != 2 || PQntuples(res) != 1) { int ntuples = PQntuples(res); int nfields = PQnfields(res); PQclear(res); ereport(ERROR, (errmsg("invalid response from primary server"), errdetail("Expected 1 tuple with 2 fields, got %d tuples with %d fields.", ntuples, nfields))); } primary_sysid = PQgetvalue(res, 0, 0); primary_tli = pg_atoi(PQgetvalue(res, 0, 1), 4, 0); /* * Confirm that the system identifier of the primary is the same as ours. */ snprintf(standby_sysid, sizeof(standby_sysid), UINT64_FORMAT, GetSystemIdentifier()); if (strcmp(primary_sysid, standby_sysid) != 0) { PQclear(res); ereport(ERROR, (errmsg("database system identifier differs between the primary and standby"), errdetail("The primary's identifier is %s, the standby's identifier is %s.", primary_sysid, standby_sysid))); } /* * Confirm that the current timeline of the primary is the same as the * recovery target timeline. */ standby_tli = GetRecoveryTargetTLI(); PQclear(res); if (primary_tli != standby_tli) ereport(ERROR, (errmsg("timeline %u of the primary does not match recovery target timeline %u", primary_tli, standby_tli))); ThisTimeLineID = primary_tli; /* Start streaming from the point requested by startup process */ snprintf(cmd, sizeof(cmd), "START_REPLICATION %X/%X", startpoint.xlogid, startpoint.xrecoff); res = libpqrcv_PQexec(cmd); if (PQresultStatus(res) != PGRES_COPY_OUT) { PQclear(res); ereport(ERROR, (errmsg("could not start WAL streaming: %s", PQerrorMessage(streamConn)))); } PQclear(res); ereport(LOG, (errmsg("streaming replication successfully connected to primary"))); return true; }
false
false
false
false
false
0
gf100_fifo_runlist_update(struct gf100_fifo *fifo) { struct gf100_fifo_chan *chan; struct nvkm_subdev *subdev = &fifo->base.engine.subdev; struct nvkm_device *device = subdev->device; struct nvkm_memory *cur; int nr = 0; mutex_lock(&subdev->mutex); cur = fifo->runlist.mem[fifo->runlist.active]; fifo->runlist.active = !fifo->runlist.active; nvkm_kmap(cur); list_for_each_entry(chan, &fifo->chan, head) { nvkm_wo32(cur, (nr * 8) + 0, chan->base.chid); nvkm_wo32(cur, (nr * 8) + 4, 0x00000004); nr++; } nvkm_done(cur); nvkm_wr32(device, 0x002270, nvkm_memory_addr(cur) >> 12); nvkm_wr32(device, 0x002274, 0x01f00000 | nr); if (wait_event_timeout(fifo->runlist.wait, !(nvkm_rd32(device, 0x00227c) & 0x00100000), msecs_to_jiffies(2000)) == 0) nvkm_error(subdev, "runlist update timeout\n"); mutex_unlock(&subdev->mutex); }
false
false
false
false
false
0
e1000_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats __always_unused *stats, u64 *data) { struct e1000_adapter *adapter = netdev_priv(netdev); struct rtnl_link_stats64 net_stats; int i; char *p = NULL; pm_runtime_get_sync(netdev->dev.parent); e1000e_get_stats64(netdev, &net_stats); pm_runtime_put_sync(netdev->dev.parent); for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { switch (e1000_gstrings_stats[i].type) { case NETDEV_STATS: p = (char *)&net_stats + e1000_gstrings_stats[i].stat_offset; break; case E1000_STATS: p = (char *)adapter + e1000_gstrings_stats[i].stat_offset; break; default: data[i] = 0; continue; } data[i] = (e1000_gstrings_stats[i].sizeof_stat == sizeof(u64)) ? *(u64 *)p : *(u32 *)p; } }
false
false
false
false
false
0
mapvue_read_group551(const guchar *p, gsize size, gpointer grpdata, GError **error) { enum { SIZE = 3*4 }; MapVueGroup551 *group = (MapVueGroup551*)grpdata; if (err_TAG_SIZE(error, group->reftag, SIZE, size)) return 0; group->magnification = gwy_get_gfloat_le(&p); group->x_frame_scale = gwy_get_gfloat_le(&p); group->y_optical_scale = gwy_get_gfloat_le(&p); gwy_debug("x_frame_scale: %g, y_optical_scale: %g", group->x_frame_scale, group->y_optical_scale); return SIZE; }
false
false
false
false
false
0
Endian_U32(uint32_g x) { if (cpu_big_endian) return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24); else return x; } }
false
false
false
false
false
0
netsnmp_access_tcpconn_container_init(u_int flags) { netsnmp_container *container1; DEBUGMSGTL(("access:tcpconn:container", "init\n")); /* * create the container */ container1 = netsnmp_container_find("access:tcpconn:table_container"); if (NULL == container1) { snmp_log(LOG_ERR, "tcpconn primary container not found\n"); return NULL; } container1->container_name = strdup("tcpConnTable"); return container1; }
false
false
false
false
false
0
BitBlt_SRCERASE_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; uint8 *srcp; uint8 *dstp; for (y = 0; y < nHeight; y++) { srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); if (dstp != 0) { for (x = 0; x < nWidth; x++) { *dstp = *srcp & ~(*dstp); srcp++; dstp++; *dstp = *srcp & ~(*dstp); srcp++; dstp++; } } } return 0; }
false
false
false
false
false
0
marker_inode_ctx_new () { marker_inode_ctx_t *ctx = NULL; ctx = GF_CALLOC (1, sizeof (marker_inode_ctx_t), gf_marker_mt_marker_inode_ctx_t); if (ctx == NULL) goto out; ctx->quota_ctx = NULL; out: return ctx; }
false
false
false
false
false
0
queueLoad() { if ( ! _onLoadCalled ) { _onLoadCalled = true; // We don't call onLoad for _root up to SWF5 if ( ! parent() && getSWFVersion(*getObject(this)) < 6 ) return; queueEvent(event_id(event_id::LOAD), movie_root::PRIORITY_DOACTION); } }
false
false
false
false
false
0
GetOption(const wxString& name, float *value, int count, const wxString& delims) const { double *nums = (double*)malloc(sizeof(double)*count); if (GetOption(name, nums, count, delims)) { for (int i=0; i < count; i++) value[i] = (float)nums[i]; free(nums); return true; } free(nums); return false; }
false
false
false
false
false
0
PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); if ( this->Input ) { os << indent << "Input: (" << this->Input << ")\n"; } else { os << indent << "Input: (none)\n"; } std::map<int, vtkSmartPointer<vtkTextProperty> >::iterator it, itEnd; it = this->Implementation->TextProperties.begin(); itEnd = this->Implementation->TextProperties.end(); for (; it != itEnd; ++it) { vtkTextProperty* prop = it->second; if (prop) { os << indent << "LabelTextProperty " << it->first << ":\n"; prop->PrintSelf(os, indent.GetNextIndent()); } else { os << indent << "LabelTextProperty " << it->first << ": (none)\n"; } } os << indent << "Label Mode: "; if ( this->LabelMode == VTK_LABEL_IDS ) { os << "Label Ids\n"; } else if ( this->LabelMode == VTK_LABEL_SCALARS ) { os << "Label Scalars\n"; } else if ( this->LabelMode == VTK_LABEL_VECTORS ) { os << "Label Vectors\n"; } else if ( this->LabelMode == VTK_LABEL_NORMALS ) { os << "Label Normals\n"; } else if ( this->LabelMode == VTK_LABEL_TCOORDS ) { os << "Label TCoords\n"; } else if ( this->LabelMode == VTK_LABEL_TENSORS ) { os << "Label Tensors\n"; } else { os << "Label Field Data\n"; } os << indent << "Label Format: " << (this->LabelFormat ? this->LabelFormat : "Null") << "\n"; os << indent << "Labeled Component: "; if ( this->LabeledComponent < 0 ) { os << "(All Components)\n"; } else { os << this->LabeledComponent << "\n"; } os << indent << "Field Data Array: " << this->FieldDataArray << "\n"; os << indent << "Field Data Name: " << (this->FieldDataName ? this->FieldDataName : "Null") << "\n"; os << indent << "Transform: " << (this->Transform ? "" : "(none)") << endl; if (this->Transform) { this->Transform->PrintSelf(os,indent.GetNextIndent()); } os << indent << "CoordinateSystem: " << this->CoordinateSystem << endl; }
false
false
false
false
false
0
DecryptBlock(uint32_t *left, uint32_t *right) const { for (int i = 0; i < 16; ++i) { *left ^= pary_[17 - i]; *right ^= Feistel(*left); std::swap(*left, *right); } std::swap(*left, *right); *right ^= pary_[1]; *left ^= pary_[0]; }
false
false
false
false
false
0
insertDescriptor(VimosDescriptor **desc, const char *name, VimosDescriptor *newDesc, int before) { VimosDescriptor *tDesc; const char modName[] = "insertDescriptor"; if ( desc == NULL) return VM_FALSE; if (*desc == NULL) return VM_FALSE; if ( newDesc == NULL) return VM_FALSE; if ( name == NULL) return VM_FALSE; if (newDesc->next != NULL || newDesc->prev != NULL) { /* * The descriptor to insert in the new list is already part of * a descriptor list. */ tDesc = findDescriptor(*desc, newDesc->descName); if (tDesc == newDesc) { /* * The descriptor to insert is from the list itself: just move it * to the insert position. Here we just extract it from the list... */ if (newDesc->prev) newDesc->prev->next = newDesc->next; if (newDesc->next) newDesc->next->prev = newDesc->prev; newDesc->prev = newDesc->next = NULL; } else { /* * The descriptor to insert belongs to another descriptor list, * make a of copy the descriptor, to avoid destroying its * original list after modification of its ->next and ->prev * pointers. */ newDesc = copyOfDescriptor(newDesc); } } /* * If a descriptor with the same name is present in the list, destroy it. */ removeDescriptor(desc, newDesc->descName); /* * Now insert the new descriptor to the right position. */ if ((tDesc = findDescriptor(*desc, name)) != NULL) { if (before) { newDesc->next = tDesc; newDesc->prev = tDesc->prev; if (tDesc->prev) tDesc->prev->next = newDesc; tDesc->prev = newDesc; if (!newDesc->prev) *desc = newDesc; } else { if (tDesc->next) { newDesc->prev = tDesc; newDesc->next = tDesc->next; if (tDesc->next) tDesc->next->prev = newDesc; tDesc->next = newDesc; } else { tDesc->next = newDesc; newDesc->prev = tDesc; } } return VM_TRUE; } else { cpl_msg_debug(modName, "Descriptor %s not found (appending).", name); return addDesc2Desc(newDesc, desc); } return VM_FALSE; }
false
false
false
false
false
0
createX86_32AsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TheTriple, StringRef CPU) { if (TheTriple.isOSBinFormatMachO()) return new DarwinX86_32AsmBackend(T, MRI, CPU); if (TheTriple.isOSWindows() && !TheTriple.isOSBinFormatELF()) return new WindowsX86AsmBackend(T, false, CPU); uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS()); if (TheTriple.isOSIAMCU()) return new ELFX86_IAMCUAsmBackend(T, OSABI, CPU); return new ELFX86_32AsmBackend(T, OSABI, CPU); }
false
false
false
false
false
0
want_to_remat (rtx x) { int num_clobbers = 0; int icode; /* If this is a valid operand, we are OK. If it's VOIDmode, we aren't. */ if (general_operand (x, GET_MODE (x))) return 1; /* Otherwise, check if we can make a valid insn from it. First initialize our test insn if we haven't already. */ if (remat_test_insn == 0) { remat_test_insn = make_insn_raw (gen_rtx_SET (VOIDmode, gen_rtx_REG (word_mode, FIRST_PSEUDO_REGISTER * 2), const0_rtx)); NEXT_INSN (remat_test_insn) = PREV_INSN (remat_test_insn) = 0; } /* Now make an insn like the one we would make when rematerializing the value X and see if valid. */ PUT_MODE (SET_DEST (PATTERN (remat_test_insn)), GET_MODE (x)); SET_SRC (PATTERN (remat_test_insn)) = x; /* XXX For now we don't allow any clobbers to be added, not just no hardreg clobbers. */ return ((icode = recog (PATTERN (remat_test_insn), remat_test_insn, &num_clobbers)) >= 0 && (num_clobbers == 0 /*|| ! added_clobbers_hard_reg_p (icode)*/)); }
false
false
false
false
false
0
pdf_set_int(pdf_obj *obj, int i) { if (!obj || obj->kind != PDF_INT) return; obj->u.i = i; }
false
false
false
false
false
0
show_all_header_cb(GtkAction *action, gpointer data) { MainWindow *mainwin = (MainWindow *)data; if (mainwin->menu_lock_count) return; prefs_common.show_all_headers = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); summary_display_msg_selected(mainwin->summaryview, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); }
false
false
false
false
false
0
generate(long long size_in_bytes) { // How many blocks are there total in the file? unsigned long long size_in_blocks = size_in_bytes/opts->block_size; if (size_in_blocks*opts->block_size < size_in_bytes) size_in_blocks++; // How many blocks will we be reading? sample_size = opts->block_count; // When sampling *without replacement* we can't request too many blocks. Trim. if (opts->without_replacement && (sample_size > size_in_blocks - opts->header_block_count)) { // The requested sample size to take is greater than the number of available blocks. // That means that the required sample is the whole file (remaining besides the header). sample_size = size_in_blocks - opts->header_block_count; if (sample_size < 0) sample_size = 0; if (sample_size > 0) { for (long i = opts->header_block_count; i < size_in_blocks; i++) { sample[i] = i; } } return; } // Maybe there's nothing to sample at all? if (opts->header_block_count >= size_in_blocks) { sample_size = 0; return; } // Generate the sample generate_sample(opts->key, sample_size, opts->header_block_count, size_in_blocks, !opts->without_replacement, sample); }
false
false
false
false
false
0
oidvectorin(PG_FUNCTION_ARGS) { char *oidString = PG_GETARG_CSTRING(0); oidvector *result; int n; result = (oidvector *) palloc0(OidVectorSize(FUNC_MAX_ARGS)); for (n = 0; n < FUNC_MAX_ARGS; n++) { while (*oidString && isspace((unsigned char) *oidString)) oidString++; if (*oidString == '\0') break; result->values[n] = oidin_subr(oidString, &oidString); } while (*oidString && isspace((unsigned char) *oidString)) oidString++; if (*oidString) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("oidvector has too many elements"))); SET_VARSIZE(result, OidVectorSize(n)); result->ndim = 1; result->dataoffset = 0; /* never any nulls */ result->elemtype = OIDOID; result->dim1 = n; result->lbound1 = 0; PG_RETURN_POINTER(result); }
false
false
false
false
true
1
khazad_crypt(uint8_t p_block[KHAZAD_BLOCK_SIZE], const uint8_t p_key_schedule[KHAZAD_KEY_SCHEDULE_SIZE]) { uint_fast8_t round; add_block(p_block, p_key_schedule); p_key_schedule += KHAZAD_BLOCK_SIZE; for (round = 0; round < (KHAZAD_NUM_ROUNDS - 1u); ++round) { round_func(p_block, p_key_schedule); p_key_schedule += KHAZAD_BLOCK_SIZE; } khazad_sbox_apply_block(p_block); add_block(p_block, p_key_schedule); }
false
false
false
false
false
0
comparebv(const Expr& e1, const Expr& e2) { int size = BVSize(e1); FatalAssert(size == BVSize(e2), "expected same size"); Theorem c1, c2; int idx1 = -1; vector<Theorem> thms1; if (d_bb_index == 0) { Expr splitter = e1.eqExpr(e2); Theorem thm = simplify(splitter); if (!thm.getRHS().isBoolConst()) { addSplitter(e1.eqExpr(e2)); return true; } // Store a dummy theorem to indicate bitblasting has begun d_bb_index = 1; d_bitblast.push_back(getCommonRules()->trueTheorem()); } for (int i = 0; i < size; ++i) { c1 = bitBlastTerm(e1, i); c1 = transitivityRule(c1, simplify(c1.getRHS())); c2 = bitBlastTerm(e2, i); c2 = transitivityRule(c2, simplify(c2.getRHS())); thms1.push_back(c1); if (!c1.getRHS().isBoolConst()) { if (idx1 == -1) idx1 = i; continue; } if (!c2.getRHS().isBoolConst()) { continue; } if (c1.getRHS() != c2.getRHS()) return false; } if (idx1 == -1) { // If e1 is known to be a constant, assert that DebugAssert(e1.getKind() != BVCONST, "Expected non-const"); assertEqualities(d_rules->bitExtractAllToConstEq(thms1)); addSplitter(e1.eqExpr(e2)); // enqueueFact(getCommonRules()->trueTheorem()); return true; } Theorem thm = bitBlastEqn(e1.eqExpr(e2)); thm = iffMP(thm, simplify(thm.getExpr())); if (!thm.getExpr().isTrue()) { enqueueFact(thm); return true; } // Nothing to assert from bitblasted equation. Best way to resolve this // problem is to split until the term can be equated with a bitvector // constant. Expr e = findAtom(thms1[idx1].getRHS()); DebugAssert(!e.isNull(), "Expected atom"); addSplitter(e); return true; }
false
false
false
false
false
0
_unique_window_input_channel_listener( const void *msg_data, void *ctx ) { const UniqueInputEvent *event = msg_data; UniqueWindow *window = ctx; D_MAGIC_ASSERT( window, UniqueWindow ); D_ASSERT( event != NULL ); D_DEBUG_AT( UniQuE_Window, "_unique_window_input_channel_listener( %p, %p )\n", event, window ); switch (event->type) { case UIET_MOTION: dispatch_motion( window, event ); break; case UIET_BUTTON: dispatch_button( window, event ); break; case UIET_WHEEL: dispatch_wheel( window, event ); break; case UIET_KEY: dispatch_key( window, event ); break; case UIET_CHANNEL: dispatch_channel( window, event ); break; default: D_ONCE( "unknown event type" ); break; } return RS_OK; }
false
false
false
false
false
0
rj54n1_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) { struct v4l2_mbus_framefmt *mf = &format->format; struct i2c_client *client = v4l2_get_subdevdata(sd); struct rj54n1 *rj54n1 = to_rj54n1(client); if (format->pad) return -EINVAL; mf->code = rj54n1->fmt->code; mf->colorspace = rj54n1->fmt->colorspace; mf->field = V4L2_FIELD_NONE; mf->width = rj54n1->width; mf->height = rj54n1->height; return 0; }
false
false
false
false
false
0
turn_error(XMPP::TurnClient::Error e) { if(debugLevel >= IceTransport::DL_Info) emit q->debugLine(QString("turn_error: ") + turn.errorString()); turnErrorCode = e; emit q->error(IceTurnTransport::ErrorTurn); }
false
false
false
false
false
0
ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) { IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32) (b), (u32) (c)); _ipw_write_reg16(a, b, c); }
false
false
false
false
false
0
_mhBuildResponse(mhResponse_t *resp) { int i; if (resp->built == YES) return; resp->built = YES; for (i = 0 ; i < resp->builders->nelts; i++) { mhResponseBldr_t *rb; rb = APR_ARRAY_IDX(resp->builders, i, mhResponseBldr_t *); rb->respbuilder(rb, resp); } }
false
false
false
false
false
0
notes_close() { p_tcl_bind_list H_temp; rem_tcl_ints(notes_ints); rem_tcl_strings(notes_strings); rem_tcl_commands(notes_tcls); if ((H_temp = find_bind_table("msg"))) rem_builtins(H_temp, notes_msgs); if ((H_temp = find_bind_table("join"))) rem_builtins(H_temp, notes_join); rem_builtins(H_dcc, notes_cmds); rem_builtins(H_chon, notes_chon); rem_builtins(H_away, notes_away); rem_builtins(H_nkch, notes_nkch); rem_builtins(H_load, notes_load); rem_help_reference("notes.help"); del_hook(HOOK_MATCH_NOTEREJ, (Function) match_note_ignore); del_hook(HOOK_HOURLY, (Function) notes_hourly); del_entry_type(&USERENTRY_FWD); del_lang_section("notes"); module_undepend(MODULE_NAME); return NULL; }
false
false
false
false
false
0
ODS_update_entry(void) { char buf[BUFFER_SIZE+1]; int response; buf[BUFFER_SIZE] = '\0'; if(do_connect((int*)&client_sockfd, server, port) != 0) { if(!(options & OPT_QUIET)) { show_message("error connecting to %s:%s\n", server, port); } return(UPDATERES_ERROR); } /* read server message */ if(ODS_read_response(buf, sizeof(buf)) != 100) { show_message("strange server response, are you connecting to the right server?\n"); close(client_sockfd); return(UPDATERES_ERROR); } /* send login command */ snprintf(buf, BUFFER_SIZE, "LOGIN %s %s\012", user_name, password); output(buf); response = ODS_read_response(buf, sizeof(buf)); if(!(response == 225 || response == 226)) { if(strlen(buf) > 4) { show_message("error talking to server: %s\n", &(buf[4])); } else { show_message("error talking to server\n"); } close(client_sockfd); return(UPDATERES_ERROR); } /* send delete command */ snprintf(buf, BUFFER_SIZE, "DELRR %s A\012", host); output(buf); if(ODS_read_response(buf, sizeof(buf)) != 901) { if(strlen(buf) > 4) { show_message("error talking to server: %s\n", &(buf[4])); } else { show_message("error talking to server\n"); } close(client_sockfd); return(UPDATERES_ERROR); } /* send address command */ snprintf(buf, BUFFER_SIZE, "ADDRR %s A %s\012", host, *address == '\0' ? "CONNIP" : address); output(buf); response = ODS_read_response(buf, sizeof(buf)); if(!(response == 795 || response == 796)) { if(strlen(buf) > 4) { show_message("error talking to server: %s\n", &(buf[4])); } else { show_message("error talking to server\n"); } close(client_sockfd); return(UPDATERES_ERROR); } if(!(options & OPT_QUIET)) { printf("request successful\n"); } close(client_sockfd); return(UPDATERES_OK); }
true
true
false
false
false
1
id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid) { int rc; struct key *sidkey; struct cifs_sid *ksid; unsigned int ksid_size; char desc[3 + 10 + 1]; /* 3 byte prefix + 10 bytes for value + NULL */ const struct cred *saved_cred; rc = snprintf(desc, sizeof(desc), "%ci:%u", sidtype == SIDOWNER ? 'o' : 'g', cid); if (rc >= sizeof(desc)) return -EINVAL; rc = 0; saved_cred = override_creds(root_cred); sidkey = request_key(&cifs_idmap_key_type, desc, ""); if (IS_ERR(sidkey)) { rc = -EINVAL; cifs_dbg(FYI, "%s: Can't map %cid %u to a SID\n", __func__, sidtype == SIDOWNER ? 'u' : 'g', cid); goto out_revert_creds; } else if (sidkey->datalen < CIFS_SID_BASE_SIZE) { rc = -EIO; cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%hu)\n", __func__, sidkey->datalen); goto invalidate_key; } /* * A sid is usually too large to be embedded in payload.value, but if * there are no subauthorities and the host has 8-byte pointers, then * it could be. */ ksid = sidkey->datalen <= sizeof(sidkey->payload) ? (struct cifs_sid *)&sidkey->payload : (struct cifs_sid *)sidkey->payload.data[0]; ksid_size = CIFS_SID_BASE_SIZE + (ksid->num_subauth * sizeof(__le32)); if (ksid_size > sidkey->datalen) { rc = -EIO; cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%hu, ksid_size=%u)\n", __func__, sidkey->datalen, ksid_size); goto invalidate_key; } cifs_copy_sid(ssid, ksid); out_key_put: key_put(sidkey); out_revert_creds: revert_creds(saved_cred); return rc; invalidate_key: key_invalidate(sidkey); goto out_key_put; }
false
false
false
false
false
0
CreateConnection(const QSharedPointer<Edge> &pedge, const Id &rem_id) { QSharedPointer<Connection> con(new Connection(pedge, _local_id, rem_id), &QObject::deleteLater); con->SetSharedPointer(con); _con_tab.AddConnection(con); qDebug() << "Handle new connection:" << con->ToString(); QObject::connect(con.data(), SIGNAL(CalledDisconnect()), this, SLOT(HandleDisconnect())); QObject::connect(con.data(), SIGNAL(Disconnected(const QString &)), this, SLOT(HandleDisconnected(const QString &))); emit NewConnection(con); }
false
false
false
false
false
0
FileAppender(const tstring& filename_, STD_NAMESPACE ios_base::openmode mode_, bool immediateFlush_) : immediateFlush(immediateFlush_) , reopenDelay(1) , bufferSize (0) , buffer (0) , out () , filename () , localeName (DCMTK_LOG4CPLUS_TEXT ("DEFAULT")) , reopen_time () { init(filename_, mode_, internal::empty_str); }
false
false
false
false
false
0
__nss_cdb_dobyid(struct nss_cdb *dbp, unsigned long id, void *result, char *buf, size_t bufl, int *errnop) { int r; unsigned len; const char *data; if ((r = cdb_find(&dbp->cdb, buf, sprintf(buf, ":%lu", id))) < 0) return *errnop = errno, NSS_STATUS_UNAVAIL; len = cdb_datalen(&dbp->cdb); if (!r || len < 2) return *errnop = ENOENT, NSS_STATUS_NOTFOUND; if (!(data = (const char*)cdb_get(&dbp->cdb, len, cdb_datapos(&dbp->cdb)))) return *errnop = errno, NSS_STATUS_UNAVAIL; return __nss_cdb_dobyname(dbp, data, len, result, buf, bufl, errnop); }
false
false
false
false
false
0