idx
int64
func
string
target
int64
307,863
ciInstance* ciEnv::ClassCastException_instance() { if (_ClassCastException_instance == NULL) { _ClassCastException_instance = get_or_create_exception(_ClassCastException_handle, vmSymbols::java_lang_ClassCastException()); } return _ClassCastException_instance; }
0
359,664
DEFUN (no_neighbor_route_map, no_neighbor_route_map_cmd, NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Apply route map to neighbor\n" "Name of route map\n" "Apply map to incoming routes\n" "Apply map to outbound routes\n" "Apply map to routes going into a Route-Server client's table\n" "Apply map to routes coming from a Route-Server client") { return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), argv[2]); }
0
344,747
monotime_ts(struct timespec *ts) { struct timeval tv; #if defined(HAVE_CLOCK_GETTIME) && (defined(CLOCK_BOOTTIME) || \ defined(CLOCK_MONOTONIC) || defined(CLOCK_REALTIME)) static int gettime_failed = 0; if (!gettime_failed) { # ifdef CLOCK_BOOTTIME if (clock_gettime(CLOCK_BOOTTIME, ts) == 0) return; # endif /* CLOCK_BOOTTIME */ # ifdef CLOCK_MONOTONIC if (clock_gettime(CLOCK_MONOTONIC, ts) == 0) return; # endif /* CLOCK_MONOTONIC */ # ifdef CLOCK_REALTIME /* Not monotonic, but we're almost out of options here. */ if (clock_gettime(CLOCK_REALTIME, ts) == 0) return; # endif /* CLOCK_REALTIME */ debug3("clock_gettime: %s", strerror(errno)); gettime_failed = 1; } #endif /* HAVE_CLOCK_GETTIME && (BOOTTIME || MONOTONIC || REALTIME) */ gettimeofday(&tv, NULL); ts->tv_sec = tv.tv_sec; ts->tv_nsec = (long)tv.tv_usec * 1000; }
0
488,431
static int fallback_migrate_page(struct address_space *mapping, struct page *newpage, struct page *page) { if (PageDirty(page)) return writeout(mapping, page); /* * Buffers may be managed in a filesystem specific way. * We must have no buffers or drop them. */ if (PagePrivate(page) && !try_to_release_page(page, GFP_KERNEL)) return -EAGAIN; return migrate_page(mapping, newpage, page); }
0
285,147
static void __free_resource_entry(void *entry) { r_ne_resource_entry *en = (r_ne_resource_entry *)entry; free (en->name); free (en); }
0
211,842
change_indent( int type, int amount, int round, int replaced, // replaced character, put on replace stack int call_changed_bytes) // call changed_bytes() { int vcol; int last_vcol; int insstart_less; // reduction for Insstart.col int new_cursor_col; int i; char_u *ptr; int save_p_list; int start_col; colnr_T vc; colnr_T orig_col = 0; // init for GCC char_u *new_line, *orig_line = NULL; // init for GCC // VREPLACE mode needs to know what the line was like before changing if (State & VREPLACE_FLAG) { orig_line = vim_strsave(ml_get_curline()); // Deal with NULL below orig_col = curwin->w_cursor.col; } // for the following tricks we don't want list mode save_p_list = curwin->w_p_list; curwin->w_p_list = FALSE; vc = getvcol_nolist(&curwin->w_cursor); vcol = vc; // For Replace mode we need to fix the replace stack later, which is only // possible when the cursor is in the indent. Remember the number of // characters before the cursor if it's possible. start_col = curwin->w_cursor.col; // determine offset from first non-blank new_cursor_col = curwin->w_cursor.col; beginline(BL_WHITE); new_cursor_col -= curwin->w_cursor.col; insstart_less = curwin->w_cursor.col; // If the cursor is in the indent, compute how many screen columns the // cursor is to the left of the first non-blank. if (new_cursor_col < 0) vcol = get_indent() - vcol; if (new_cursor_col > 0) // can't fix replace stack start_col = -1; // Set the new indent. The cursor will be put on the first non-blank. if (type == INDENT_SET) (void)set_indent(amount, call_changed_bytes ? SIN_CHANGED : 0); else { int save_State = State; // Avoid being called recursively. if (State & VREPLACE_FLAG) State = INSERT; shift_line(type == INDENT_DEC, round, 1, call_changed_bytes); State = save_State; } insstart_less -= curwin->w_cursor.col; // Try to put cursor on same character. // If the cursor is at or after the first non-blank in the line, // compute the cursor column relative to the column of the first // non-blank character. // If we are not in insert mode, leave the cursor on the first non-blank. // If the cursor is before the first non-blank, position it relative // to the first non-blank, counted in screen columns. if (new_cursor_col >= 0) { // When changing the indent while the cursor is touching it, reset // Insstart_col to 0. if (new_cursor_col == 0) insstart_less = MAXCOL; new_cursor_col += curwin->w_cursor.col; } else if (!(State & INSERT)) new_cursor_col = curwin->w_cursor.col; else { // Compute the screen column where the cursor should be. vcol = get_indent() - vcol; curwin->w_virtcol = (colnr_T)((vcol < 0) ? 0 : vcol); // Advance the cursor until we reach the right screen column. vcol = last_vcol = 0; new_cursor_col = -1; ptr = ml_get_curline(); while (vcol <= (int)curwin->w_virtcol) { last_vcol = vcol; if (has_mbyte && new_cursor_col >= 0) new_cursor_col += (*mb_ptr2len)(ptr + new_cursor_col); else ++new_cursor_col; vcol += lbr_chartabsize(ptr, ptr + new_cursor_col, (colnr_T)vcol); } vcol = last_vcol; // May need to insert spaces to be able to position the cursor on // the right screen column. if (vcol != (int)curwin->w_virtcol) { curwin->w_cursor.col = (colnr_T)new_cursor_col; i = (int)curwin->w_virtcol - vcol; ptr = alloc(i + 1); if (ptr != NULL) { new_cursor_col += i; ptr[i] = NUL; while (--i >= 0) ptr[i] = ' '; ins_str(ptr); vim_free(ptr); } } // When changing the indent while the cursor is in it, reset // Insstart_col to 0. insstart_less = MAXCOL; } curwin->w_p_list = save_p_list; if (new_cursor_col <= 0) curwin->w_cursor.col = 0; else curwin->w_cursor.col = (colnr_T)new_cursor_col; curwin->w_set_curswant = TRUE; changed_cline_bef_curs(); // May have to adjust the start of the insert. if (State & INSERT) { if (curwin->w_cursor.lnum == Insstart.lnum && Insstart.col != 0) { if ((int)Insstart.col <= insstart_less) Insstart.col = 0; else Insstart.col -= insstart_less; } if ((int)ai_col <= insstart_less) ai_col = 0; else ai_col -= insstart_less; } // For REPLACE mode, may have to fix the replace stack, if it's possible. // If the number of characters before the cursor decreased, need to pop a // few characters from the replace stack. // If the number of characters before the cursor increased, need to push a // few NULs onto the replace stack. if (REPLACE_NORMAL(State) && start_col >= 0) { while (start_col > (int)curwin->w_cursor.col) { replace_join(0); // remove a NUL from the replace stack --start_col; } while (start_col < (int)curwin->w_cursor.col || replaced) { replace_push(NUL); if (replaced) { replace_push(replaced); replaced = NUL; } ++start_col; } } // For VREPLACE mode, we also have to fix the replace stack. In this case // it is always possible because we backspace over the whole line and then // put it back again the way we wanted it. if (State & VREPLACE_FLAG) { // If orig_line didn't allocate, just return. At least we did the job, // even if you can't backspace. if (orig_line == NULL) return; // Save new line new_line = vim_strsave(ml_get_curline()); if (new_line == NULL) return; // We only put back the new line up to the cursor new_line[curwin->w_cursor.col] = NUL; // Put back original line ml_replace(curwin->w_cursor.lnum, orig_line, FALSE); curwin->w_cursor.col = orig_col; // Backspace from cursor to start of line backspace_until_column(0); // Insert new stuff into line again ins_bytes(new_line); vim_free(new_line); } }
1
220,221
AttrValue* Node::AddAttrHelper(const std::string& name) { MaybeCopyOnWrite(); return &((*props_->node_def.mutable_attr())[name]); }
0
336,598
static void reds_cleanup_net(SpiceServer *reds) { if (reds->listen_socket != -1) { red_watch_remove(reds->listen_watch); if (reds->config->spice_listen_socket_fd != reds->listen_socket) { socket_close(reds->listen_socket); } reds->listen_watch = NULL; reds->listen_socket = -1; } if (reds->secure_listen_socket != -1) { red_watch_remove(reds->secure_listen_watch); socket_close(reds->secure_listen_socket); reds->secure_listen_watch = NULL; reds->secure_listen_socket = -1; } }
0
197,242
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data); OpData* op_data = reinterpret_cast<OpData*>(node->user_data); int scratch_tensor_index = op_data->scratch_tensor_index; // Check we have all the inputs and outputs we need. TF_LITE_ENSURE_EQ(context, node->outputs->size, 1); TF_LITE_ENSURE_EQ(context, node->inputs->size, 5); const TfLiteTensor* input; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input)); const TfLiteTensor* weights_feature; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kWeightsFeatureTensor, &weights_feature)); const TfLiteTensor* weights_time; TF_LITE_ENSURE_OK( context, GetInputSafe(context, node, kWeightsTimeTensor, &weights_time)); TF_LITE_ENSURE(context, input->type == kTfLiteFloat32 || input->type == kTfLiteInt8); // Check all the parameters of tensor match within themselves and match the // input configuration. const int rank = params->rank; const int batch_size = input->dims->data[0]; const int num_filters = weights_feature->dims->data[0]; TF_LITE_ENSURE(context, rank != 0); TF_LITE_ENSURE_EQ(context, num_filters % rank, 0); const int num_units = num_filters / rank; const int memory_size = weights_time->dims->data[1]; TF_LITE_ENSURE_EQ(context, input->dims->data[1], weights_feature->dims->data[1]); TF_LITE_ENSURE_EQ(context, weights_time->dims->data[0], num_filters); const TfLiteTensor* bias = GetOptionalInputTensor(context, node, kBiasTensor); if (bias) { TF_LITE_ENSURE_EQ(context, bias->dims->data[0], num_units); } const TfLiteTensor* state; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kStateTensor, &state)); TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, kOutputTensor, &output)); // Check the shape of input state tensors. TF_LITE_ENSURE_EQ(context, NumDimensions(state), 2); TF_LITE_ENSURE_EQ(context, SizeOfDimension(state, 0), batch_size); TF_LITE_ENSURE_EQ(context, SizeOfDimension(state, 1), memory_size * num_filters); // Resize output. TfLiteIntArray* output_size_array = TfLiteIntArrayCreate(2); output_size_array->data[0] = batch_size; output_size_array->data[1] = num_units; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, output, output_size_array)); // The weights are of consistent type, so it suffices to check one. const bool is_hybrid_op = IsHybridOp(input, weights_feature); const bool is_full_integer = input->type == kTfLiteInt8; // Resize scratch. TfLiteIntArrayFree(node->temporaries); if (is_hybrid_op) { node->temporaries = TfLiteIntArrayCreate(6); } else if (is_full_integer) { node->temporaries = TfLiteIntArrayCreate(2); } else { node->temporaries = TfLiteIntArrayCreate(1); } node->temporaries->data[0] = scratch_tensor_index; TfLiteIntArray* scratch_size_array = TfLiteIntArrayCreate(2); scratch_size_array->data[0] = batch_size; scratch_size_array->data[1] = num_filters; TfLiteTensor* scratch_tensor; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, /*index=*/0, &scratch_tensor)); // The scratch buffer is of type int32 for full integer svdf and it's of type // float32 for hybrid and float case. if (is_full_integer) { scratch_tensor->type = kTfLiteInt32; } else { scratch_tensor->type = kTfLiteFloat32; } scratch_tensor->allocation_type = kTfLiteArenaRw; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, scratch_tensor, scratch_size_array)); if (is_hybrid_op) { op_data->compute_row_sums = true; // Tell interpreter to allocate temporary tensors to store quantized values // of input tensors. node->temporaries->data[1] = scratch_tensor_index + 1; TfLiteTensor* input_quantized; TF_LITE_ENSURE_OK(context, GetTemporarySafe(context, node, /*index=*/1, &input_quantized)); input_quantized->type = weights_feature->type; input_quantized->allocation_type = kTfLiteArenaRw; if (!TfLiteIntArrayEqual(input_quantized->dims, input->dims)) { TfLiteIntArray* input_quantized_size = TfLiteIntArrayCopy(input->dims); TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, input_quantized, input_quantized_size)); } // Tell interpreter to allocate temporary tensors to store scaling factors. node->temporaries->data[2] = scratch_tensor_index + 2; TfLiteTensor* scaling_factors; TF_LITE_ENSURE_OK(context, GetTemporarySafe(context, node, /*index=*/2, &scaling_factors)); scaling_factors->type = kTfLiteFloat32; scaling_factors->allocation_type = kTfLiteArenaRw; int scaling_dims[1] = {batch_size}; if (!TfLiteIntArrayEqualsArray(scaling_factors->dims, 1, scaling_dims)) { TfLiteIntArray* scaling_factors_size = TfLiteIntArrayCreate(1); scaling_factors_size->data[0] = batch_size; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, scaling_factors, scaling_factors_size)); } // Used to store dequantized weights_time matrix for hybrid computation of // matmul(state, weights_time), which occurs in floating point. node->temporaries->data[3] = scratch_tensor_index + 3; TfLiteTensor* float_weights_time; TF_LITE_ENSURE_OK(context, GetTemporarySafe(context, node, /*index=*/3, &float_weights_time)); float_weights_time->type = kTfLiteFloat32; // Persistent so that we can compute the dequantized weights only once. float_weights_time->allocation_type = kTfLiteArenaRwPersistent; if (!TfLiteIntArrayEqual(float_weights_time->dims, weights_time->dims)) { TfLiteIntArray* float_weights_time_size = TfLiteIntArrayCopy(weights_time->dims); TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, float_weights_time, float_weights_time_size)); } node->temporaries->data[4] = scratch_tensor_index + 4; TfLiteTensor* zero_points; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, /*index=*/4, &zero_points)); zero_points->type = kTfLiteFloat32; zero_points->allocation_type = kTfLiteArenaRw; int zero_points_dims[1] = {batch_size}; if (!TfLiteIntArrayEqualsArray(zero_points->dims, 1, zero_points_dims)) { TfLiteIntArray* zero_points_size = TfLiteIntArrayCreate(1); zero_points_size->data[0] = zero_points_dims[0]; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, zero_points, zero_points_size)); } node->temporaries->data[5] = scratch_tensor_index + 5; TfLiteTensor* row_sums; TF_LITE_ENSURE_OK(context, GetTemporarySafe(context, node, /*index=*/5, &row_sums)); row_sums->type = kTfLiteFloat32; row_sums->allocation_type = kTfLiteArenaRwPersistent; int row_sums_dims[1] = {num_filters}; if (!TfLiteIntArrayEqualsArray(row_sums->dims, 1, row_sums_dims)) { TfLiteIntArray* row_sums_size = TfLiteIntArrayCreate(1); row_sums_size->data[0] = row_sums_dims[0]; TF_LITE_ENSURE_OK( context, context->ResizeTensor(context, row_sums, row_sums_size)); } } if (is_full_integer) { // Allocated one extra tensor. TfLiteIntArray* output_temp_size_array = TfLiteIntArrayCreate(2); output_temp_size_array->data[0] = num_units; output_temp_size_array->data[1] = batch_size; node->temporaries->data[1] = scratch_tensor_index + 1; TfLiteTensor* output_temp; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, /*index=*/1, &output_temp)); output_temp->type = kTfLiteInt32; output_temp->allocation_type = kTfLiteArenaRw; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, output_temp, output_temp_size_array)); // Calculate effective scales. auto* input_params = reinterpret_cast<TfLiteAffineQuantization*>(input->quantization.params); auto* weights_feature_params = reinterpret_cast<TfLiteAffineQuantization*>( weights_feature->quantization.params); auto* state_params = reinterpret_cast<TfLiteAffineQuantization*>(state->quantization.params); auto* weight_time_params = reinterpret_cast<TfLiteAffineQuantization*>( weights_time->quantization.params); auto* output_params = reinterpret_cast<TfLiteAffineQuantization*>( output->quantization.params); const double effective_scale_1 = input_params->scale->data[0] * weights_feature_params->scale->data[0] / state_params->scale->data[0]; const double effective_scale_2 = state_params->scale->data[0] * weight_time_params->scale->data[0] / output_params->scale->data[0]; QuantizeMultiplier(effective_scale_1, &op_data->effective_scale_1_a, &op_data->effective_scale_1_b); QuantizeMultiplier(effective_scale_2, &op_data->effective_scale_2_a, &op_data->effective_scale_2_b); } return kTfLiteOk; }
1
451,884
static int jpc_enc_encodemainbody(jpc_enc_t *enc) { int tileno; jpc_sot_t *sot; jpc_enc_tcmpt_t *comp; jpc_enc_tcmpt_t *endcomps; jpc_enc_band_t *band; jpc_enc_band_t *endbands; jpc_enc_rlvl_t *lvl; unsigned rlvlno; jpc_qcc_t *qcc; jpc_cod_t *cod; int adjust; int absbandno; long tilehdrlen; long tilelen; jpc_enc_tile_t *tile; jpc_enc_cp_t *cp; double rho; unsigned cmptno; int samestepsizes; jpc_enc_ccp_t *ccps; jpc_enc_tccp_t *tccp; int bandno; int mingbits; int actualnumbps; jpc_fix_t mxmag; jpc_fix_t mag; int numgbits; cp = enc->cp; for (tileno = 0; tileno < JAS_CAST(int, cp->numtiles); ++tileno) { if (!(enc->curtile = jpc_enc_tile_create(enc->cp, enc->image, tileno))) { jas_eprintf("cannot create tile\n"); return -1; } tile = enc->curtile; if (jas_getdbglevel() >= 10) { jpc_enc_dump(enc); } endcomps = &tile->tcmpts[tile->numtcmpts]; for (cmptno = 0, comp = tile->tcmpts; cmptno < tile->numtcmpts; ++cmptno, ++comp) { if (!cp->ccps[cmptno].sgnd) { adjust = 1 << (cp->ccps[cmptno].prec - 1); for (jas_matind_t i = 0; i < jas_matrix_numrows(comp->data); ++i) { for (jas_matind_t j = 0; j < jas_matrix_numcols(comp->data); ++j) { *jas_matrix_getref(comp->data, i, j) -= adjust; } } } } if (!tile->intmode) { endcomps = &tile->tcmpts[tile->numtcmpts]; for (comp = tile->tcmpts; comp != endcomps; ++comp) { jas_matrix_asl(comp->data, JPC_FIX_FRACBITS); } } switch (tile->mctid) { case JPC_MCT_RCT: assert(jas_image_numcmpts(enc->image) == 3); jpc_rct(tile->tcmpts[0].data, tile->tcmpts[1].data, tile->tcmpts[2].data); break; case JPC_MCT_ICT: assert(jas_image_numcmpts(enc->image) == 3); jpc_ict(tile->tcmpts[0].data, tile->tcmpts[1].data, tile->tcmpts[2].data); break; default: break; } for (unsigned i = 0; i < jas_image_numcmpts(enc->image); ++i) { comp = &tile->tcmpts[i]; jpc_tsfb_analyze(comp->tsfb, comp->data); } endcomps = &tile->tcmpts[tile->numtcmpts]; for (cmptno = 0, comp = tile->tcmpts; comp != endcomps; ++cmptno, ++comp) { mingbits = 0; absbandno = 0; /* All bands must have a corresponding quantizer step size, even if they contain no samples and are never coded. */ /* Some bands may not be hit by the loop below, so we must initialize all of the step sizes to a sane value. */ memset(comp->stepsizes, 0, sizeof(comp->stepsizes)); for (rlvlno = 0, lvl = comp->rlvls; rlvlno < comp->numrlvls; ++rlvlno, ++lvl) { if (!lvl->bands) { absbandno += rlvlno ? 3 : 1; continue; } endbands = &lvl->bands[lvl->numbands]; for (band = lvl->bands; band != endbands; ++band) { if (!band->data) { ++absbandno; continue; } actualnumbps = 0; mxmag = 0; for (jas_matind_t y = 0; y < jas_matrix_numrows(band->data); ++y) { for (jas_matind_t x = 0; x < jas_matrix_numcols(band->data); ++x) { mag = JAS_ABS(jas_matrix_get(band->data, y, x)); if (mag > mxmag) { mxmag = mag; } } } if (tile->intmode) { actualnumbps = jpc_fix_firstone(mxmag) + 1; } else { actualnumbps = jpc_fix_firstone(mxmag) + 1 - JPC_FIX_FRACBITS; } numgbits = actualnumbps - (cp->ccps[cmptno].prec - 1 + band->analgain); #if 0 jas_eprintf("%d %d mag=%d actual=%d numgbits=%d\n", cp->ccps[cmptno].prec, band->analgain, mxmag, actualnumbps, numgbits); #endif if (numgbits > mingbits) { mingbits = numgbits; } if (!tile->intmode) { band->absstepsize = jpc_fix_div(jpc_inttofix(1 << (band->analgain + 1)), band->synweight); } else { band->absstepsize = jpc_inttofix(1); } const uint_fast32_t stepsize = jpc_abstorelstepsize( band->absstepsize, cp->ccps[cmptno].prec + band->analgain); if (stepsize == UINT_FAST32_MAX) return -1; band->stepsize = stepsize; band->numbps = cp->tccp.numgbits + JPC_QCX_GETEXPN(band->stepsize) - 1; if ((!tile->intmode) && band->data) { jpc_quantize(band->data, band->absstepsize); } comp->stepsizes[absbandno] = band->stepsize; ++absbandno; } } assert(JPC_FIX_FRACBITS >= JPC_NUMEXTRABITS); if (!tile->intmode) { jas_matrix_divpow2(comp->data, JPC_FIX_FRACBITS - JPC_NUMEXTRABITS); } else { jas_matrix_asl(comp->data, JPC_NUMEXTRABITS); } #if 0 jas_eprintf("mingbits %d\n", mingbits); #endif if (mingbits > cp->tccp.numgbits) { jas_eprintf("error: too few guard bits (need at least %d)\n", mingbits); return -1; } } if (!(enc->tmpstream = jas_stream_memopen(0, 0))) { jas_eprintf("cannot open tmp file\n"); return -1; } /* Write the tile header. */ if (!(enc->mrk = jpc_ms_create(JPC_MS_SOT))) { return -1; } sot = &enc->mrk->parms.sot; sot->len = 0; sot->tileno = tileno; sot->partno = 0; sot->numparts = 1; if (jpc_putms(enc->tmpstream, enc->cstate, enc->mrk)) { jas_eprintf("cannot write SOT marker\n"); return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; /************************************************************************/ /************************************************************************/ /************************************************************************/ tccp = &cp->tccp; for (cmptno = 0; cmptno < cp->numcmpts; ++cmptno) { comp = &tile->tcmpts[cmptno]; if (comp->numrlvls != tccp->maxrlvls) { if (!(enc->mrk = jpc_ms_create(JPC_MS_COD))) { return -1; } /* XXX = this is not really correct. we are using comp #0's precint sizes and other characteristics */ comp = &tile->tcmpts[0]; cod = &enc->mrk->parms.cod; cod->compparms.csty = 0; cod->compparms.numdlvls = comp->numrlvls - 1; cod->prg = tile->prg; cod->numlyrs = tile->numlyrs; cod->compparms.cblkwidthval = JPC_COX_CBLKSIZEEXPN(comp->cblkwidthexpn); cod->compparms.cblkheightval = JPC_COX_CBLKSIZEEXPN(comp->cblkheightexpn); cod->compparms.cblksty = comp->cblksty; cod->compparms.qmfbid = comp->qmfbid; cod->mctrans = (tile->mctid != JPC_MCT_NONE); for (unsigned i = 0; i < comp->numrlvls; ++i) { cod->compparms.rlvls[i].parwidthval = comp->rlvls[i].prcwidthexpn; cod->compparms.rlvls[i].parheightval = comp->rlvls[i].prcheightexpn; } if (jpc_putms(enc->tmpstream, enc->cstate, enc->mrk)) { return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; } } for (cmptno = 0, comp = tile->tcmpts; cmptno < cp->numcmpts; ++cmptno, ++comp) { ccps = &cp->ccps[cmptno]; if (JAS_CAST(int, ccps->numstepsizes) == comp->numstepsizes) { samestepsizes = 1; for (bandno = 0; bandno < JAS_CAST(int, ccps->numstepsizes); ++bandno) { if (ccps->stepsizes[bandno] != comp->stepsizes[bandno]) { samestepsizes = 0; break; } } } else { samestepsizes = 0; } if (!samestepsizes) { if (!(enc->mrk = jpc_ms_create(JPC_MS_QCC))) { return -1; } qcc = &enc->mrk->parms.qcc; qcc->compno = cmptno; qcc->compparms.numguard = cp->tccp.numgbits; qcc->compparms.qntsty = (comp->qmfbid == JPC_COX_INS) ? JPC_QCX_SEQNT : JPC_QCX_NOQNT; qcc->compparms.numstepsizes = comp->numstepsizes; qcc->compparms.stepsizes = comp->stepsizes; if (jpc_putms(enc->tmpstream, enc->cstate, enc->mrk)) { return -1; } qcc->compparms.stepsizes = 0; jpc_ms_destroy(enc->mrk); enc->mrk = 0; } } /* Write a SOD marker to indicate the end of the tile header. */ if (!(enc->mrk = jpc_ms_create(JPC_MS_SOD))) { return -1; } if (jpc_putms(enc->tmpstream, enc->cstate, enc->mrk)) { jas_eprintf("cannot write SOD marker\n"); return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; tilehdrlen = jas_stream_getrwcount(enc->tmpstream); assert(tilehdrlen >= 0); /************************************************************************/ /************************************************************************/ /************************************************************************/ if (jpc_enc_enccblks(enc)) { return -1; } cp = enc->cp; rho = (double) (tile->brx - tile->tlx) * (tile->bry - tile->tly) / ((cp->refgrdwidth - cp->imgareatlx) * (cp->refgrdheight - cp->imgareatly)); tile->rawsize = cp->rawsize * rho; for (unsigned lyrno = 0; lyrno < tile->numlyrs - 1; ++lyrno) { tile->lyrsizes[lyrno] = tile->rawsize * jpc_fixtodbl( cp->tcp.ilyrrates[lyrno]); } #if !defined(__clang__) // WARNING: // Some versions of Clang (e.g., 3.7.1 and 3.8.1) appear to generate // incorrect code for the following line. tile->lyrsizes[tile->numlyrs - 1] = (cp->totalsize != UINT_FAST32_MAX) ? (rho * enc->mainbodysize) : UINT_FAST32_MAX; #else if (cp->totalsize != UINT_FAST32_MAX) { tile->lyrsizes[tile->numlyrs - 1] = (rho * enc->mainbodysize); } else { tile->lyrsizes[tile->numlyrs - 1] = UINT_FAST32_MAX; } #endif //jas_eprintf("TESTING %ld %ld\n", cp->totalsize != UINT_FAST32_MAX, tile->lyrsizes[0]); for (unsigned lyrno = 0; lyrno < tile->numlyrs; ++lyrno) { if (tile->lyrsizes[lyrno] != UINT_FAST32_MAX) { if (JAS_CAST(uint_fast32_t, tilehdrlen) <= tile->lyrsizes[lyrno]) { tile->lyrsizes[lyrno] -= tilehdrlen; } else { tile->lyrsizes[lyrno] = 0; } } } if (rateallocate(enc, tile->numlyrs, tile->lyrsizes)) { return -1; } #if 0 jas_eprintf("ENCODE TILE DATA\n"); #endif if (jpc_enc_encodetiledata(enc)) { jas_eprintf("dotile failed\n"); return -1; } /************************************************************************/ /************************************************************************/ /************************************************************************/ /************************************************************************/ /************************************************************************/ /************************************************************************/ tilelen = jas_stream_tell(enc->tmpstream); if (jas_stream_seek(enc->tmpstream, 6, SEEK_SET) < 0) { return -1; } jpc_putuint32(enc->tmpstream, tilelen); if (jas_stream_seek(enc->tmpstream, 0, SEEK_SET) < 0) { return -1; } if (jpc_putdata(enc->out, enc->tmpstream, -1)) { return -1; } enc->len += tilelen; jas_stream_close(enc->tmpstream); enc->tmpstream = 0; jpc_enc_tile_destroy(enc->curtile); enc->curtile = 0; } return 0; }
0
257,003
static void route4_delete_filter_work(struct work_struct *work) { struct route4_filter *f = container_of(to_rcu_work(work), struct route4_filter, rwork); rtnl_lock(); __route4_delete_filter(f); rtnl_unlock(); }
0
244,112
GF_Err jp2h_box_read(GF_Box *s,GF_BitStream *bs) { return gf_isom_box_array_read(s, bs); }
0
436,056
static int __io_uring_add_tctx_node(struct io_ring_ctx *ctx) { struct io_uring_task *tctx = current->io_uring; struct io_tctx_node *node; int ret; if (unlikely(!tctx)) { ret = io_uring_alloc_task_context(current, ctx); if (unlikely(ret)) return ret; tctx = current->io_uring; } if (!xa_load(&tctx->xa, (unsigned long)ctx)) { node = kmalloc(sizeof(*node), GFP_KERNEL); if (!node) return -ENOMEM; node->ctx = ctx; node->task = current; ret = xa_err(xa_store(&tctx->xa, (unsigned long)ctx, node, GFP_KERNEL)); if (ret) { kfree(node); return ret; } mutex_lock(&ctx->uring_lock); list_add(&node->ctx_node, &ctx->tctx_list); mutex_unlock(&ctx->uring_lock); } tctx->last = ctx; return 0;
0
253,529
smb2_get_credits_field(struct TCP_Server_Info *server, const int optype) { switch (optype) { case CIFS_ECHO_OP: return &server->echo_credits; case CIFS_OBREAK_OP: return &server->oplock_credits; default: return &server->credits; } }
0
338,220
Type WasmBinaryBuilder::getType() { return getType(getS32LEB()); }
0
383,378
int gdImageNegate(gdImagePtr src) { int x, y; int r,g,b,a; int new_pxl, pxl; typedef int (*FuncPtr)(gdImagePtr, int, int); FuncPtr f; if (src==NULL) { return 0; } f = GET_PIXEL_FUNCTION(src); for (y=0; y<src->sy; ++y) { for (x=0; x<src->sx; ++x) { pxl = f (src, x, y); r = gdImageRed(src, pxl); g = gdImageGreen(src, pxl); b = gdImageBlue(src, pxl); a = gdImageAlpha(src, pxl); new_pxl = gdImageColorAllocateAlpha(src, 255-r, 255-g, 255-b, a); if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, 255-r, 255-g, 255-b, a); } if ((y >= 0) && (y < src->sy)) { gdImageSetPixel (src, x, y, new_pxl); } } } return 1; }
0
512,503
Tmp_field_src() :m_field(0), m_default_field(0), m_item_result_field(0) { }
0
225,056
PQsocket(const PGconn *conn) { if (!conn) return -1; return (conn->sock != PGINVALID_SOCKET) ? conn->sock : -1; }
0
513,030
Item_args(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e) { arg_count= 5; if (likely((args= (Item**) thd_alloc(thd, sizeof(Item*) * 5)))) { arg_count= 5; args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e; } }
0
339,711
(Bigint *a, int *e) #endif { ULong *xa, *xa0, w, y, z; int k; _double d; #ifdef VAX ULong d0, d1; #else #define d0 word0(d) #define d1 word1(d) #endif xa0 = a->x; xa = xa0 + a->wds; y = *--xa; #ifdef DEBUG if (!y) Bug("zero y in b2d"); #endif k = hi0bits(y); *e = 32 - k; #ifdef Pack_32 if (k < Ebits) { d0 = Exp_1 | y >> (Ebits - k); w = xa > xa0 ? *--xa : 0; d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); goto ret_d; } z = xa > xa0 ? *--xa : 0; if (k -= Ebits) { d0 = Exp_1 | y << k | z >> (32 - k); y = xa > xa0 ? *--xa : 0; d1 = z << k | y >> (32 - k); } else { d0 = Exp_1 | y; d1 = z; } #else if (k < Ebits + 16) { z = xa > xa0 ? *--xa : 0; d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k; w = xa > xa0 ? *--xa : 0; y = xa > xa0 ? *--xa : 0; d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k; goto ret_d; } z = xa > xa0 ? *--xa : 0; w = xa > xa0 ? *--xa : 0; k -= Ebits + 16; d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k; y = xa > xa0 ? *--xa : 0; d1 = w << k + 16 | y << k; #endif ret_d: #ifdef VAX word0(d) = d0 >> 16 | d0 << 16; word1(d) = d1 >> 16 | d1 << 16; #else #undef d0 #undef d1 #endif return value(d); }
0
232,355
GF_Err GetMediaTime(GF_TrackBox *trak, Bool force_non_empty, u64 movieTime, u64 *MediaTime, s64 *SegmentStartTime, s64 *MediaOffset, u8 *useEdit, u64 *next_edit_start_plus_one) { #if 0 GF_Err e; u32 sampleNumber, prevSampleNumber; u64 firstDTS; #endif u32 i, count; Bool last_is_empty = 0; u64 time, lastSampleTime; s64 mtime; GF_EdtsEntry *ent; Double scale_ts; GF_SampleTableBox *stbl = trak->Media->information->sampleTable; if (next_edit_start_plus_one) *next_edit_start_plus_one = 0; *useEdit = 1; *MediaTime = 0; //no segment yet... *SegmentStartTime = -1; *MediaOffset = -1; if (!trak->moov->mvhd->timeScale || !trak->Media->mediaHeader->timeScale || !stbl->SampleSize) { return GF_ISOM_INVALID_FILE; } //no samples... if (!stbl->SampleSize->sampleCount) { lastSampleTime = 0; } else { lastSampleTime = trak->Media->mediaHeader->duration; } //No edits, 1 to 1 mapping if (! trak->editBox || !trak->editBox->editList) { *MediaTime = movieTime; //check this is in our media time line if ((*MediaTime > lastSampleTime) #ifndef GPAC_DISABLE_ISOM_FRAGMENTS && !trak->moov->mov->moof #endif ) { *MediaTime = lastSampleTime; } *useEdit = 0; return GF_OK; } //browse the edit list and get the time scale_ts = trak->Media->mediaHeader->timeScale; scale_ts /= trak->moov->mvhd->timeScale; time = 0; ent = NULL; count=gf_list_count(trak->editBox->editList->entryList); for (i=0; i<count; i++) { ent = (GF_EdtsEntry *)gf_list_get(trak->editBox->editList->entryList, i); if ( (time + ent->segmentDuration) * scale_ts > movieTime) { if (!force_non_empty || (ent->mediaTime >= 0)) { if (next_edit_start_plus_one) *next_edit_start_plus_one = 1 + (u64) ((time + ent->segmentDuration) * scale_ts); goto ent_found; } } time += ent->segmentDuration; last_is_empty = ent->segmentDuration ? 0 : 1; } if (last_is_empty) { ent = (GF_EdtsEntry *)gf_list_last(trak->editBox->editList->entryList); if (ent->mediaRate == 0x10000) { *MediaTime = movieTime + ent->mediaTime; } else { ent = (GF_EdtsEntry *)gf_list_get(trak->editBox->editList->entryList, 0); if (ent->mediaRate == -0x10000) { u64 dur = (u64) (ent->segmentDuration * scale_ts); *MediaTime = (movieTime > dur) ? (movieTime-dur) : 0; } } *useEdit = 0; return GF_OK; } //we had nothing in the list (strange file but compliant...) //return the 1 to 1 mapped vale of the last media sample if (!ent) { *MediaTime = movieTime; //check this is in our media time line if (*MediaTime > lastSampleTime) *MediaTime = lastSampleTime; *useEdit = 0; return GF_OK; } //request for a bigger time that what we can give: return the last sample (undefined behavior...) *MediaTime = lastSampleTime; return GF_OK; ent_found: //OK, we found our entry, set the SegmentTime *SegmentStartTime = time; //we request an empty list, there's no media here... if (ent->mediaTime < 0) { *MediaTime = 0; return GF_OK; } //we request a dwell edit if (! ent->mediaRate) { *MediaTime = ent->mediaTime; //no media offset *MediaOffset = 0; *useEdit = 2; return GF_OK; } /*WARNING: this can be "-1" when doing searchForward mode (to prevent jumping to next entry)*/ mtime = ent->mediaTime + movieTime - (time * trak->Media->mediaHeader->timeScale / trak->moov->mvhd->timeScale); if (mtime<0) mtime = 0; *MediaTime = (u64) mtime; *MediaOffset = ent->mediaTime; #if 0 // //Sanity check: is the requested time valid ? This is to cope with wrong EditLists //we have the translated time, but we need to make sure we have a sample at this time ... //we have to find a COMPOSITION time e = stbl_findEntryForTime(stbl, (u32) *MediaTime, 1, &sampleNumber, &prevSampleNumber); if (e) return e; //first case: our time is after the last sample DTS (it's a broken editList somehow) //set the media time to the last sample if (!sampleNumber && !prevSampleNumber) { *MediaTime = lastSampleTime; return GF_OK; } //get the appropriated sample if (!sampleNumber) sampleNumber = prevSampleNumber; stbl_GetSampleDTS(stbl->TimeToSample, sampleNumber, &DTS); CTS = 0; if (stbl->CompositionOffset) stbl_GetSampleCTS(stbl->CompositionOffset, sampleNumber, &CTS); //now get the entry sample (the entry time gives the CTS, and we need the DTS e = stbl_findEntryForTime(stbl, (u32) ent->mediaTime, 0, &sampleNumber, &prevSampleNumber); if (e) return e; //oops, the mediaTime indicates a sample that is not in our media ! if (!sampleNumber && !prevSampleNumber) { *MediaTime = lastSampleTime; return GF_ISOM_INVALID_FILE; } if (!sampleNumber) sampleNumber = prevSampleNumber; stbl_GetSampleDTS(stbl->TimeToSample, sampleNumber, &firstDTS); //and store the "time offset" of the desired sample in this segment //this is weird, used to rebuild the timeStamp when reading from the track, not the //media ... *MediaOffset = firstDTS; #endif return GF_OK; }
0
312,424
qf_get_nth_valid_entry(qf_list_T *qfl, int n, int fdo) { qfline_T *qfp; int i, eidx; int prev_fnum = 0; // check if the list has valid errors if (!qf_list_has_valid_entries(qfl)) return 1; eidx = 0; FOR_ALL_QFL_ITEMS(qfl, qfp, i) { if (qfp->qf_valid) { if (fdo) { if (qfp->qf_fnum > 0 && qfp->qf_fnum != prev_fnum) { // Count the number of files eidx++; prev_fnum = qfp->qf_fnum; } } else eidx++; } if (eidx == n) break; } if (i <= qfl->qf_count) return i; else return 1; }
0
216,812
int setup_tests(void) { ADD_ALL_TESTS(call_run_cert, OSSL_NELEM(name_fns)); return 1; }
1
346,435
script_autoload( char_u *name, int reload) // load script again when already loaded { char_u *p; char_u *scriptname, *tofree; int ret = FALSE; int i; int ret_sid; // If the name starts with "<SNR>123_" then "123" is the script ID. if (name[0] == K_SPECIAL && name[1] == KS_EXTRA && name[2] == KE_SNR) { p = name + 3; ret_sid = (int)getdigits(&p); if (*p == '_' && SCRIPT_ID_VALID(ret_sid)) { may_load_script(ret_sid, &ret); return ret; } } // If there is no '#' after name[0] there is no package name. p = vim_strchr(name, AUTOLOAD_CHAR); if (p == NULL || p == name) return FALSE; tofree = scriptname = autoload_name(name); if (scriptname == NULL) return FALSE; // Find the name in the list of previously loaded package names. Skip // "autoload/", it's always the same. for (i = 0; i < ga_loaded.ga_len; ++i) if (STRCMP(((char_u **)ga_loaded.ga_data)[i] + 9, scriptname + 9) == 0) break; if (!reload && i < ga_loaded.ga_len) ret = FALSE; // was loaded already else { // Remember the name if it wasn't loaded already. if (i == ga_loaded.ga_len && ga_grow(&ga_loaded, 1) == OK) { ((char_u **)ga_loaded.ga_data)[ga_loaded.ga_len++] = scriptname; tofree = NULL; } // Try loading the package from $VIMRUNTIME/autoload/<name>.vim // Use "ret_sid" to avoid loading the same script again. if (source_in_path(p_rtp, scriptname, DIP_START, &ret_sid) == OK) ret = TRUE; } vim_free(tofree); return ret; }
0
442,818
output_expected(const char* url, const char* uploadfile) { if(!uploadfile) return TRUE; /* download */ if(checkprefix("http://", url) || checkprefix("https://", url)) return TRUE; /* HTTP(S) upload */ return FALSE; /* non-HTTP upload, probably no output should be expected */ }
0
512,623
Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) { return convert_to_basic_const_item(thd); }
0
292,244
find_unused_session (server *serv) { session *sess; GSList *list = sess_list; while (list) { sess = (session *) list->data; if (sess->type == SESS_CHANNEL && sess->channel[0] == 0 && sess->server == serv) { if (sess->waitchannel[0] == 0) return sess; } list = list->next; } return NULL; }
0
255,030
static int adts_write_header(AVFormatContext *s) { ADTSContext *adts = s->priv_data; if (adts->id3v2tag) ff_id3v2_write_simple(s, 4, ID3v2_DEFAULT_MAGIC); return 0; }
0
207,071
DeepTiledInputFile::initialize () { if (_data->partNumber == -1) if (_data->header.type() != DEEPTILE) throw IEX_NAMESPACE::ArgExc ("Expected a deep tiled file but the file is not deep tiled."); if(_data->header.version()!=1) { THROW(IEX_NAMESPACE::ArgExc, "Version " << _data->header.version() << " not supported for deeptiled images in this version of the library"); } _data->header.sanityCheck (true); // // before allocating memory for tile offsets, confirm file is large enough // to contain tile offset table // (for multipart files, the chunk offset table has already been read) // if (!isMultiPart(_data->version)) { _data->validateStreamSize(); } _data->tileDesc = _data->header.tileDescription(); _data->lineOrder = _data->header.lineOrder(); // // Save the dataWindow information // const Box2i &dataWindow = _data->header.dataWindow(); _data->minX = dataWindow.min.x; _data->maxX = dataWindow.max.x; _data->minY = dataWindow.min.y; _data->maxY = dataWindow.max.y; // // Precompute level and tile information to speed up utility functions // precalculateTileInfo (_data->tileDesc, _data->minX, _data->maxX, _data->minY, _data->maxY, _data->numXTiles, _data->numYTiles, _data->numXLevels, _data->numYLevels); // // Create all the TileBuffers and allocate their internal buffers // _data->tileOffsets = TileOffsets (_data->tileDesc.mode, _data->numXLevels, _data->numYLevels, _data->numXTiles, _data->numYTiles); for (size_t i = 0; i < _data->tileBuffers.size(); i++) _data->tileBuffers[i] = new TileBuffer (); _data->maxSampleCountTableSize = _data->tileDesc.ySize * _data->tileDesc.xSize * sizeof(int); _data->sampleCountTableBuffer.resizeErase(_data->maxSampleCountTableSize); _data->sampleCountTableComp = newCompressor(_data->header.compression(), _data->maxSampleCountTableSize, _data->header); const ChannelList & c=_data->header.channels(); _data->combinedSampleSize=0; for(ChannelList::ConstIterator i=c.begin();i!=c.end();i++) { switch( i.channel().type ) { case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF : _data->combinedSampleSize+=Xdr::size<half>(); break; case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT : _data->combinedSampleSize+=Xdr::size<float>(); break; case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT : _data->combinedSampleSize+=Xdr::size<unsigned int>(); break; default : THROW(IEX_NAMESPACE::ArgExc, "Bad type for channel " << i.name() << " initializing deepscanline reader"); } } }
1
270,397
static bool ok_inflater_compressed_block(ok_inflater *inflater) { const bool is_fixed = inflater->state == OK_INFLATER_STATE_READING_FIXED_COMPRESSED_BLOCK; const ok_inflater_huffman_tree *literal_tree = (is_fixed ? inflater->fixed_literal_huffman : inflater->literal_huffman); const ok_inflater_huffman_tree *distance_tree = (is_fixed ? inflater->fixed_distance_huffman : inflater->distance_huffman); // decode literal/length value from input stream size_t max_write = ok_inflater_can_write_total(inflater); const uint16_t *tree_lookup_table = literal_tree->lookup_table; const unsigned int tree_bits = literal_tree->bits; while (max_write > 0) { int value = ok_inflater_decode_literal(inflater, tree_lookup_table, tree_bits); if (value < 0) { // Needs input return false; } else if (value < 256) { ok_inflater_write_byte(inflater, (uint8_t)value); max_write--; } else if (value == 256) { inflater->state = OK_INFLATER_STATE_READY_FOR_NEXT_BLOCK; return true; } else if (value < 286) { inflater->huffman_code = value - 257; inflater->state_count = -1; inflater->state_distance = -1; if (ok_inflater_distance_with_tree(inflater, distance_tree)) { max_write = ok_inflater_can_write_total(inflater); } else { if (is_fixed) { inflater->state = OK_INFLATER_STATE_READING_FIXED_DISTANCE; } else { inflater->state = OK_INFLATER_STATE_READING_DYNAMIC_DISTANCE; } return false; } } else { ok_inflater_error(inflater, "Invalid inflater literal"); return false; } } // Output buffer full return false; }
0
508,785
int rr_sequential(READ_RECORD *info) { int tmp; while ((tmp= info->table->file->ha_rnd_next(info->record))) { /* rnd_next can return RECORD_DELETED for MyISAM when one thread is reading and another deleting without locks. */ if (info->thd->killed || (tmp != HA_ERR_RECORD_DELETED)) { tmp= rr_handle_error(info, tmp); break; } } return tmp; }
0
263,501
static void sco_conn_del(struct hci_conn *hcon, int err) { struct sco_conn *conn = hcon->sco_data; struct sock *sk; if (!conn) return; BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); /* Kill socket */ sco_conn_lock(conn); sk = conn->sk; sco_conn_unlock(conn); if (sk) { sock_hold(sk); lock_sock(sk); sco_sock_clear_timer(sk); sco_chan_del(sk, err); release_sock(sk); sock_put(sk); /* Ensure no more work items will run before freeing conn. */ cancel_delayed_work_sync(&conn->timeout_work); } hcon->sco_data = NULL; kfree(conn); }
0
220,454
static bool Run(OpKernelContext* ctx, const Tensor& input, const Tensor& filter, int batch, int input_rows, int input_cols, int in_depth, int filter_rows, int filter_cols, int pad_rows, int pad_cols, int out_rows, int /*out_cols*/, int /*out_depth*/, int /*dilation_rows*/, int /*dilation_cols*/, int /*stride_rows*/, int /*stride_cols*/, Tensor* /*output*/, TensorFormat /*data_format*/) { return false; }
0
310,313
dirserv_router_get_status(const routerinfo_t *router, const char **msg) { char d[DIGEST_LEN]; if (crypto_pk_get_digest(router->identity_pkey, d)) { log_warn(LD_BUG,"Error computing fingerprint"); if (msg) *msg = "Bug: Error computing fingerprint"; return FP_REJECT; } return dirserv_get_status_impl(d, router->nickname, router->address, router->addr, router->or_port, router->platform, router->contact_info, msg, 1); }
0
513,014
Item *remove_item_direct_ref() { return (*ref)->remove_item_direct_ref(); }
0
488,399
copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma, unsigned long addr, int *rss) { unsigned long vm_flags = vma->vm_flags; pte_t pte = *src_pte; struct page *page; /* pte contains position in swap or file, so copy. */ if (unlikely(!pte_present(pte))) { if (!pte_file(pte)) { swp_entry_t entry = pte_to_swp_entry(pte); swap_duplicate(entry); /* make sure dst_mm is on swapoff's mmlist. */ if (unlikely(list_empty(&dst_mm->mmlist))) { spin_lock(&mmlist_lock); if (list_empty(&dst_mm->mmlist)) list_add(&dst_mm->mmlist, &src_mm->mmlist); spin_unlock(&mmlist_lock); } if (is_write_migration_entry(entry) && is_cow_mapping(vm_flags)) { /* * COW mappings require pages in both parent * and child to be set to read. */ make_migration_entry_read(&entry); pte = swp_entry_to_pte(entry); set_pte_at(src_mm, addr, src_pte, pte); } } goto out_set_pte; } /* * If it's a COW mapping, write protect it both * in the parent and the child */ if (is_cow_mapping(vm_flags)) { ptep_set_wrprotect(src_mm, addr, src_pte); pte = pte_wrprotect(pte); } /* * If it's a shared mapping, mark it clean in * the child */ if (vm_flags & VM_SHARED) pte = pte_mkclean(pte); pte = pte_mkold(pte); page = vm_normal_page(vma, addr, pte); if (page) { get_page(page); page_dup_rmap(page, vma, addr); rss[!!PageAnon(page)]++; } out_set_pte: set_pte_at(dst_mm, addr, dst_pte, pte); }
0
309,982
main(void) { printf("This program requires the wide-ncurses library\n"); ExitProgram(EXIT_FAILURE); }
0
253,610
fill_transform_hdr(struct smb2_transform_hdr *tr_hdr, unsigned int orig_len, struct smb_rqst *old_rq, __le16 cipher_type) { struct smb2_hdr *shdr = (struct smb2_hdr *)old_rq->rq_iov[0].iov_base; memset(tr_hdr, 0, sizeof(struct smb2_transform_hdr)); tr_hdr->ProtocolId = SMB2_TRANSFORM_PROTO_NUM; tr_hdr->OriginalMessageSize = cpu_to_le32(orig_len); tr_hdr->Flags = cpu_to_le16(0x01); if ((cipher_type == SMB2_ENCRYPTION_AES128_GCM) || (cipher_type == SMB2_ENCRYPTION_AES256_GCM)) get_random_bytes(&tr_hdr->Nonce, SMB3_AES_GCM_NONCE); else get_random_bytes(&tr_hdr->Nonce, SMB3_AES_CCM_NONCE); memcpy(&tr_hdr->SessionId, &shdr->SessionId, 8); }
0
522,335
static int64_t GetFilSiz(GmfMshSct *msh) { int64_t CurPos, EndPos = 0; if(msh->typ & Bin) { #ifdef WITH_GMF_AIO CurPos = lseek(msh->FilDes, 0, 1); EndPos = lseek(msh->FilDes, 0, 2); lseek(msh->FilDes, (off_t)CurPos, 0); #else CurPos = MYFTELL(msh->hdl); if(MYFSEEK(msh->hdl, 0, SEEK_END) != 0) longjmp(msh->err, -32); EndPos = MYFTELL(msh->hdl); if(MYFSEEK(msh->hdl, (off_t)CurPos, SEEK_SET) != 0) longjmp(msh->err, -33); #endif } else { CurPos = MYFTELL(msh->hdl); if(MYFSEEK(msh->hdl, 0, SEEK_END) != 0) longjmp(msh->err, -34); EndPos = MYFTELL(msh->hdl); if(MYFSEEK(msh->hdl, (off_t)CurPos, SEEK_SET) != 0) longjmp(msh->err, -35); } return(EndPos); }
0
233,870
*/ static void php_wddx_serialize_unset(wddx_packet *packet) { php_wddx_add_chunk_static(packet, WDDX_NULL);
0
223,412
static void set_private_data_ptrs(compiler_common *common, int *private_data_start, PCRE2_SPTR ccend) { PCRE2_SPTR cc = common->start; PCRE2_SPTR alternative; PCRE2_SPTR end = NULL; int private_data_ptr = *private_data_start; int space, size, bracketlen; BOOL repeat_check = TRUE; while (cc < ccend) { space = 0; size = 0; bracketlen = 0; if (private_data_ptr > SLJIT_MAX_LOCAL_SIZE) break; /* When the bracket is prefixed by a zero iteration, skip the repeat check (at this point). */ if (repeat_check && (*cc == OP_ONCE || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND)) { if (detect_repeat(common, cc)) { /* These brackets are converted to repeats, so no global based single character repeat is allowed. */ if (cc >= end) end = bracketend(cc); } } repeat_check = TRUE; switch(*cc) { case OP_KET: if (common->private_data_ptrs[cc + 1 - common->start] != 0) { common->private_data_ptrs[cc - common->start] = private_data_ptr; private_data_ptr += sizeof(sljit_sw); cc += common->private_data_ptrs[cc + 1 - common->start]; } cc += 1 + LINK_SIZE; break; case OP_ASSERT: case OP_ASSERT_NOT: case OP_ASSERTBACK: case OP_ASSERTBACK_NOT: case OP_ASSERT_NA: case OP_ASSERTBACK_NA: case OP_ONCE: case OP_SCRIPT_RUN: case OP_BRAPOS: case OP_SBRA: case OP_SBRAPOS: case OP_SCOND: common->private_data_ptrs[cc - common->start] = private_data_ptr; private_data_ptr += sizeof(sljit_sw); bracketlen = 1 + LINK_SIZE; break; case OP_CBRAPOS: case OP_SCBRAPOS: common->private_data_ptrs[cc - common->start] = private_data_ptr; private_data_ptr += sizeof(sljit_sw); bracketlen = 1 + LINK_SIZE + IMM2_SIZE; break; case OP_COND: /* Might be a hidden SCOND. */ common->private_data_ptrs[cc - common->start] = 0; alternative = cc + GET(cc, 1); if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN) { common->private_data_ptrs[cc - common->start] = private_data_ptr; private_data_ptr += sizeof(sljit_sw); } bracketlen = 1 + LINK_SIZE; break; case OP_BRA: bracketlen = 1 + LINK_SIZE; break; case OP_CBRA: case OP_SCBRA: bracketlen = 1 + LINK_SIZE + IMM2_SIZE; break; case OP_BRAZERO: case OP_BRAMINZERO: case OP_BRAPOSZERO: size = 1; repeat_check = FALSE; break; CASE_ITERATOR_PRIVATE_DATA_1 size = -2; space = 1; break; CASE_ITERATOR_PRIVATE_DATA_2A size = -2; space = 2; break; CASE_ITERATOR_PRIVATE_DATA_2B size = -(2 + IMM2_SIZE); space = 2; break; CASE_ITERATOR_TYPE_PRIVATE_DATA_1 size = 1; space = 1; break; CASE_ITERATOR_TYPE_PRIVATE_DATA_2A size = 1; if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI) space = 2; break; case OP_TYPEUPTO: size = 1 + IMM2_SIZE; if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI) space = 2; break; case OP_TYPEMINUPTO: size = 1 + IMM2_SIZE; space = 2; break; case OP_CLASS: case OP_NCLASS: size = 1 + 32 / sizeof(PCRE2_UCHAR); space = get_class_iterator_size(cc + size); break; #if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH != 8 case OP_XCLASS: size = GET(cc, 1); space = get_class_iterator_size(cc + size); break; #endif default: cc = next_opcode(common, cc); SLJIT_ASSERT(cc != NULL); break; } /* Character iterators, which are not inside a repeated bracket, gets a private slot instead of allocating it on the stack. */ if (space > 0 && cc >= end) { common->private_data_ptrs[cc - common->start] = private_data_ptr; private_data_ptr += sizeof(sljit_sw) * space; } if (size != 0) { if (size < 0) { cc += -size; #ifdef SUPPORT_UNICODE if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]); #endif } else cc += size; } if (bracketlen > 0) { if (cc >= end) { end = bracketend(cc); if (end[-1 - LINK_SIZE] == OP_KET) end = NULL; } cc += bracketlen; } } *private_data_start = private_data_ptr; }
0
313,814
nv_hat(cmdarg_T *cap) { if (!checkclearopq(cap->oap)) (void)buflist_getfile((int)cap->count0, (linenr_T)0, GETF_SETMARK|GETF_ALT, FALSE); }
0
261,218
int wm_SemInit(wm_Sem *s){ /* dispatch_release() fails hard, with Trace/BPT trap signal, if the * sem's internal count is less than the value passed in with * dispatch_semaphore_create(). work around this by initing * with 0, then incrementing it afterwards. */ *s = dispatch_semaphore_create(0); if (*s == NULL) return MQTT_CODE_ERROR_MEMORY; if (dispatch_semaphore_signal(*s) < 0) { dispatch_release(*s); return MQTT_CODE_ERROR_SYSTEM; } return 0; }
0
224,184
void Compute(OpKernelContext* ctx) override { StagingMap<Ordered>* map = nullptr; OP_REQUIRES_OK(ctx, GetStagingMap(ctx, def(), &map)); core::ScopedUnref scope(map); // Allocate size output tensor Tensor* size = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &size)); // Set it to the actual size size->scalar<int32>().setConstant(map->size()); }
0
276,989
virtual AP4_Result ReadPartial(void* , AP4_Size, AP4_Size&) { return AP4_ERROR_NOT_SUPPORTED; }
0
222,884
std::size_t operator()(const Handle& h) const { return h.Handle(); }
0
254,897
intrusive_ptr<Expression> parseIdExpression(const intrusive_ptr<ExpressionContext>& expCtx, BSONElement groupField, const VariablesParseState& vps) { if (groupField.type() == Object) { // {_id: {}} is treated as grouping on a constant, not an expression if (groupField.Obj().isEmpty()) { return ExpressionConstant::create(expCtx, Value(groupField)); } const BSONObj idKeyObj = groupField.Obj(); if (idKeyObj.firstElementFieldName()[0] == '$') { // grouping on a $op expression return Expression::parseObject(expCtx, idKeyObj, vps); } else { for (auto&& field : idKeyObj) { uassert(17390, "$group does not support inclusion-style expressions", !field.isNumber() && field.type() != Bool); } return ExpressionObject::parse(expCtx, idKeyObj, vps); } } else { return Expression::parseOperand(expCtx, groupField, vps); } }
0
226,325
GF_Err trun_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_TrackFragmentRunBox *ptr = (GF_TrackFragmentRunBox *) s; if (!s) return GF_BAD_PARAM; #ifdef GF_ENABLE_CTRN if (ptr->use_ctrn) return ctrn_box_write(s, bs); #endif e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->sample_count); //The rest depends on the flags if (ptr->flags & GF_ISOM_TRUN_DATA_OFFSET) { gf_bs_write_u32(bs, ptr->data_offset); } if (ptr->flags & GF_ISOM_TRUN_FIRST_FLAG) { gf_bs_write_u32(bs, ptr->first_sample_flags); } if (ptr->flags & (GF_ISOM_TRUN_DURATION | GF_ISOM_TRUN_SIZE | GF_ISOM_TRUN_FLAGS | GF_ISOM_TRUN_CTS_OFFSET) ) { for (i=0; i<ptr->nb_samples; i++) { GF_TrunEntry *p = &ptr->samples[i]; if (ptr->flags & GF_ISOM_TRUN_DURATION) { gf_bs_write_u32(bs, p->Duration); } if (ptr->flags & GF_ISOM_TRUN_SIZE) { gf_bs_write_u32(bs, p->size); } //SHOULDN'T BE USED IF GF_ISOM_TRUN_FIRST_FLAG IS DEFINED if (ptr->flags & GF_ISOM_TRUN_FLAGS) { gf_bs_write_u32(bs, p->flags); } if (ptr->flags & GF_ISOM_TRUN_CTS_OFFSET) { if (ptr->version==0) { gf_bs_write_u32(bs, p->CTS_Offset); } else { gf_bs_write_u32(bs, (u32) p->CTS_Offset); } } } } if (ptr->sample_order) { u32 nb_bits = 8; if (ptr->sample_count>0xFFFFFF) nb_bits = 32; else if (ptr->sample_count>0xFFFF) nb_bits = 24; else if (ptr->sample_count>0xFF) nb_bits = 16; for (i=0; i<ptr->sample_count; i++) { gf_bs_write_int(bs, ptr->sample_order[i], nb_bits); } } return GF_OK;
0
249,979
static GF_Err WriteMoovAndMeta(GF_ISOFile *movie, GF_List *writers, GF_BitStream *bs) { u32 i; TrackWriter *writer; GF_Err e; GF_Box *stco; GF_SampleToChunkBox *stsc; if (movie->meta) { //write the moov box... e = gf_isom_box_size((GF_Box *)movie->meta); if (e) return e; e = gf_isom_box_write((GF_Box *)movie->meta, bs); if (e) return e; } if (movie->moov) { Bool prevent_dispatch = GF_FALSE; //switch all our tables i=0; while ((writer = (TrackWriter*)gf_list_enum(writers, &i))) { //don't delete them !!! stsc = writer->stbl->SampleToChunk; stco = writer->stbl->ChunkOffset; s32 stsc_pos = gf_list_del_item(writer->stbl->child_boxes, stsc); s32 stco_pos = gf_list_del_item(writer->stbl->child_boxes, stco); writer->stbl->SampleToChunk = writer->stsc; writer->stbl->ChunkOffset = writer->stco; gf_list_insert(writer->stbl->child_boxes, writer->stsc, stsc_pos); gf_list_insert(writer->stbl->child_boxes, writer->stco, stco_pos); writer->stco = stco; writer->stsc = stsc; if (writer->prevent_dispatch) prevent_dispatch = GF_TRUE; } if (prevent_dispatch) { gf_bs_prevent_dispatch(bs, GF_TRUE); } //write the moov box... e = gf_isom_box_size((GF_Box *)movie->moov); if (e) return e; if ((movie->compress_mode==GF_ISO_COMP_ALL) || (movie->compress_mode==GF_ISO_COMP_MOOV)) { e = gf_isom_write_compressed_box(movie, (GF_Box *) movie->moov, GF_4CC('!', 'm', 'o', 'v'), bs, NULL); } else { e = gf_isom_box_write((GF_Box *)movie->moov, bs); } if (prevent_dispatch) { gf_bs_prevent_dispatch(bs, GF_FALSE); } //and re-switch our table. We have to do it that way because it is //needed when the moov is written first i=0; while ((writer = (TrackWriter*)gf_list_enum(writers, &i))) { //don't delete them !!! stsc = writer->stsc; stco = writer->stco; writer->stsc = writer->stbl->SampleToChunk; writer->stco = writer->stbl->ChunkOffset; s32 stsc_pos = gf_list_del_item(writer->stbl->child_boxes, writer->stsc); s32 stco_pos = gf_list_del_item(writer->stbl->child_boxes, writer->stco); writer->stbl->SampleToChunk = stsc; writer->stbl->ChunkOffset = stco; gf_list_insert(writer->stbl->child_boxes, stsc, stsc_pos); gf_list_insert(writer->stbl->child_boxes, stco, stco_pos); } if (e) return e; } return GF_OK; }
0
415,206
cmd_getinfo (assuan_context_t ctx, char *line) { int rc = 0; if (!strcmp (line, "version")) { const char *s = VERSION; rc = assuan_send_data (ctx, s, strlen (s)); } else if (!strcmp (line, "pid")) { char numbuf[50]; snprintf (numbuf, sizeof numbuf, "%lu", (unsigned long)getpid ()); rc = assuan_send_data (ctx, numbuf, strlen (numbuf)); } else if (!strcmp (line, "socket_name")) { const char *s = scd_get_socket_name (); if (s) rc = assuan_send_data (ctx, s, strlen (s)); else rc = gpg_error (GPG_ERR_NO_DATA); } else if (!strcmp (line, "status")) { ctrl_t ctrl = assuan_get_pointer (ctx); int vrdr = ctrl->server_local->vreader_idx; char flag = 'r'; if (!ctrl->server_local->card_removed && vrdr != -1) { struct vreader_s *vr; if (!(vrdr >= 0 && vrdr < DIM(vreader_table))) BUG (); vr = &vreader_table[vrdr]; if (vr->valid && vr->any && (vr->status & 1)) flag = 'u'; } rc = assuan_send_data (ctx, &flag, 1); } else if (!strcmp (line, "reader_list")) { #ifdef HAVE_LIBUSB char *s = ccid_get_reader_list (); #else char *s = NULL; #endif if (s) rc = assuan_send_data (ctx, s, strlen (s)); else rc = gpg_error (GPG_ERR_NO_DATA); xfree (s); } else if (!strcmp (line, "deny_admin")) rc = opt.allow_admin? gpg_error (GPG_ERR_GENERAL) : 0; else if (!strcmp (line, "app_list")) { char *s = get_supported_applications (); if (s) rc = assuan_send_data (ctx, s, strlen (s)); else rc = 0; xfree (s); } else rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT"); return rc; }
0
274,712
check_align_files_possibility (gerbv_selection_info_t *sel_info) { gerbv_fileinfo_t **f = mainProject->file; GtkMenuItem **menu_items = (GtkMenuItem **) screen.win.curEditAlingItem; gerbv_selection_item_t si[2]; int id[2] = {-1, -1}; int i; /* If has two objects, then can do files aligning */ if (selection_length (sel_info) == 2) { si[0] = selection_get_item_by_index(sel_info, 0); si[1] = selection_get_item_by_index(sel_info, 1); for (i = 0; i <= mainProject->last_loaded; i++) { if (f[i]->image == si[0].image) id[0] = i; if (f[i]->image == si[1].image) id[1] = i; } /* Can align if on different files */ if (id[0]*id[1] >= 0 && id[0] != id[1]) { gchar *str; /* TODO: add color boxes for layers as hint */ /* Update align menu items */ str = g_strdup_printf (_("#_%i %s > #%i %s"), id[0]+1, f[id[0]]->name, id[1]+1, f[id[1]]->name); gtk_menu_item_set_label (menu_items[0], str); g_free (str); str = g_strdup_printf (_("#_%i %s > #%i %s"), id[1]+1, f[id[1]]->name, id[0]+1, f[id[0]]->name); gtk_menu_item_set_label (menu_items[1], str); g_free (str); gtk_widget_set_sensitive ( screen.win.curEditAlingMenuItem, TRUE); return TRUE; } } /* Can't align, disable align menu */ gtk_widget_set_sensitive (screen.win.curEditAlingMenuItem, FALSE); gtk_menu_item_set_label (menu_items[0], ""); gtk_menu_item_set_label (menu_items[1], ""); return FALSE; }
0
289,248
static int __init alsa_pcm_oss_init(void) { int i; int err; /* check device map table */ for (i = 0; i < SNDRV_CARDS; i++) { if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) { pr_err("ALSA: pcm_oss: invalid dsp_map[%d] = %d\n", i, dsp_map[i]); dsp_map[i] = 0; } if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) { pr_err("ALSA: pcm_oss: invalid adsp_map[%d] = %d\n", i, adsp_map[i]); adsp_map[i] = 1; } } err = snd_pcm_notify(&snd_pcm_oss_notify, 0); if (err < 0) return err; return 0; }
0
243,004
int mbedtls_ssl_parse_change_cipher_spec( mbedtls_ssl_context *ssl ) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse change cipher spec" ) ); if( ( ret = mbedtls_ssl_read_record( ssl, 1 ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret ); return( ret ); } if( ssl->in_msgtype != MBEDTLS_SSL_MSG_CHANGE_CIPHER_SPEC ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad change cipher spec message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } /* CCS records are only accepted if they have length 1 and content '1', * so we don't need to check this here. */ /* * Switch to our negotiated transform and session parameters for inbound * data. */ MBEDTLS_SSL_DEBUG_MSG( 3, ( "switching to new transform spec for inbound data" ) ); ssl->transform_in = ssl->transform_negotiate; ssl->session_in = ssl->session_negotiate; #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) { #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) mbedtls_ssl_dtls_replay_reset( ssl ); #endif /* Increment epoch */ if( ++ssl->in_epoch == 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "DTLS epoch would wrap" ) ); /* This is highly unlikely to happen for legitimate reasons, so treat it as an attack and don't send an alert. */ return( MBEDTLS_ERR_SSL_COUNTER_WRAPPING ); } } else #endif /* MBEDTLS_SSL_PROTO_DTLS */ memset( ssl->in_ctr, 0, 8 ); mbedtls_ssl_update_in_pointers( ssl ); #if defined(MBEDTLS_SSL_HW_RECORD_ACCEL) if( mbedtls_ssl_hw_record_activate != NULL ) { if( ( ret = mbedtls_ssl_hw_record_activate( ssl, MBEDTLS_SSL_CHANNEL_INBOUND ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_hw_record_activate", ret ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR ); return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED ); } } #endif ssl->state++; MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse change cipher spec" ) ); return( 0 ); }
0
219,022
void ConstantFolding::ReplaceDivisionOfOnesByReciprocal(NodeDef* node, GraphDef* graph) { node->set_op("Reciprocal"); node->mutable_input()->SwapElements(0, 1); const string ctrl_dep = AddControlDependency(node->input(1), graph, node_map_.get()); node_map_->UpdateInput(node->name(), node->input(1), ctrl_dep); node->set_input(1, ctrl_dep); graph_modified_ = true; }
0
273,879
static int close_data_connection(ctrl_t *ctrl) { int ret = 0; DBG("Closing data connection ..."); /* PASV server listening socket */ if (ctrl->data_listen_sd > 0) { shutdown(ctrl->data_listen_sd, SHUT_RDWR); close(ctrl->data_listen_sd); ctrl->data_listen_sd = -1; ret++; } /* PASV client socket */ if (ctrl->data_sd > 0) { shutdown(ctrl->data_sd, SHUT_RDWR); close(ctrl->data_sd); ctrl->data_sd = -1; ret++; } /* PORT */ if (ctrl->data_address[0]) { ctrl->data_address[0] = 0; ctrl->data_port = 0; } return ret; }
0
289,295
static int snd_interval_refine_min(struct snd_interval *i, unsigned int min, int openmin) { int changed = 0; if (i->min < min) { i->min = min; i->openmin = openmin; changed = 1; } else if (i->min == min && !i->openmin && openmin) { i->openmin = 1; changed = 1; } if (i->integer) { if (i->openmin) { i->min++; i->openmin = 0; } } if (snd_interval_checkempty(i)) { snd_interval_none(i); return -EINVAL; } return changed; }
0
344,809
get_rdomain(int fd) { #if defined(HAVE_SYS_GET_RDOMAIN) return sys_get_rdomain(fd); #elif defined(__OpenBSD__) int rtable; char *ret; socklen_t len = sizeof(rtable); if (getsockopt(fd, SOL_SOCKET, SO_RTABLE, &rtable, &len) == -1) { error("Failed to get routing domain for fd %d: %s", fd, strerror(errno)); return NULL; } xasprintf(&ret, "%d", rtable); return ret; #else /* defined(__OpenBSD__) */ return NULL; #endif }
0
225,724
GF_Err stsz_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_SampleSizeBox *ptr = (GF_SampleSizeBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; //in both versions this is still valid if (ptr->type == GF_ISOM_BOX_TYPE_STSZ) { gf_bs_write_u32(bs, ptr->sampleSize); } else { gf_bs_write_u24(bs, 0); gf_bs_write_u8(bs, ptr->sampleSize); } gf_bs_write_u32(bs, ptr->sampleCount); if (ptr->type == GF_ISOM_BOX_TYPE_STSZ) { if (! ptr->sampleSize) { for (i = 0; i < ptr->sampleCount; i++) { gf_bs_write_u32(bs, ptr->sizes ? ptr->sizes[i] : 0); } } } else { for (i = 0; i < ptr->sampleCount; ) { switch (ptr->sampleSize) { case 4: gf_bs_write_int(bs, ptr->sizes[i], 4); if (i+1 < ptr->sampleCount) { gf_bs_write_int(bs, ptr->sizes[i+1], 4); } else { //0 padding in odd sample count gf_bs_write_int(bs, 0, 4); } i += 2; break; default: gf_bs_write_int(bs, ptr->sizes[i], ptr->sampleSize); i += 1; break; } } } return GF_OK; }
0
409,449
scroll_region_reset(void) { OUT_STR(tgoto((char *)T_CS, (int)Rows - 1, 0)); if (*T_CSV != NUL) OUT_STR(tgoto((char *)T_CSV, (int)Columns - 1, 0)); screen_start(); // don't know where cursor is now }
0
509,501
bool ha_maria::auto_repair(int error) const { /* Always auto-repair moved tables (error == HA_ERR_OLD_FILE) */ return ((MY_TEST(maria_recover_options & HA_RECOVER_ANY) && error == HA_ERR_CRASHED_ON_USAGE) || error == HA_ERR_OLD_FILE); }
0
424,950
void iwl_trans_pcie_dump_regs(struct iwl_trans *trans) { #define PCI_DUMP_SIZE 352 #define PCI_MEM_DUMP_SIZE 64 #define PCI_PARENT_DUMP_SIZE 524 #define PREFIX_LEN 32 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct pci_dev *pdev = trans_pcie->pci_dev; u32 i, pos, alloc_size, *ptr, *buf; char *prefix; if (trans_pcie->pcie_dbg_dumped_once) return; /* Should be a multiple of 4 */ BUILD_BUG_ON(PCI_DUMP_SIZE > 4096 || PCI_DUMP_SIZE & 0x3); BUILD_BUG_ON(PCI_MEM_DUMP_SIZE > 4096 || PCI_MEM_DUMP_SIZE & 0x3); BUILD_BUG_ON(PCI_PARENT_DUMP_SIZE > 4096 || PCI_PARENT_DUMP_SIZE & 0x3); /* Alloc a max size buffer */ alloc_size = PCI_ERR_ROOT_ERR_SRC + 4 + PREFIX_LEN; alloc_size = max_t(u32, alloc_size, PCI_DUMP_SIZE + PREFIX_LEN); alloc_size = max_t(u32, alloc_size, PCI_MEM_DUMP_SIZE + PREFIX_LEN); alloc_size = max_t(u32, alloc_size, PCI_PARENT_DUMP_SIZE + PREFIX_LEN); buf = kmalloc(alloc_size, GFP_ATOMIC); if (!buf) return; prefix = (char *)buf + alloc_size - PREFIX_LEN; IWL_ERR(trans, "iwlwifi transaction failed, dumping registers\n"); /* Print wifi device registers */ sprintf(prefix, "iwlwifi %s: ", pci_name(pdev)); IWL_ERR(trans, "iwlwifi device config registers:\n"); for (i = 0, ptr = buf; i < PCI_DUMP_SIZE; i += 4, ptr++) if (pci_read_config_dword(pdev, i, ptr)) goto err_read; print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0); IWL_ERR(trans, "iwlwifi device memory mapped registers:\n"); for (i = 0, ptr = buf; i < PCI_MEM_DUMP_SIZE; i += 4, ptr++) *ptr = iwl_read32(trans, i); print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0); pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); if (pos) { IWL_ERR(trans, "iwlwifi device AER capability structure:\n"); for (i = 0, ptr = buf; i < PCI_ERR_ROOT_COMMAND; i += 4, ptr++) if (pci_read_config_dword(pdev, pos + i, ptr)) goto err_read; print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0); } /* Print parent device registers next */ if (!pdev->bus->self) goto out; pdev = pdev->bus->self; sprintf(prefix, "iwlwifi %s: ", pci_name(pdev)); IWL_ERR(trans, "iwlwifi parent port (%s) config registers:\n", pci_name(pdev)); for (i = 0, ptr = buf; i < PCI_PARENT_DUMP_SIZE; i += 4, ptr++) if (pci_read_config_dword(pdev, i, ptr)) goto err_read; print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0); /* Print root port AER registers */ pos = 0; pdev = pcie_find_root_port(pdev); if (pdev) pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR); if (pos) { IWL_ERR(trans, "iwlwifi root port (%s) AER cap structure:\n", pci_name(pdev)); sprintf(prefix, "iwlwifi %s: ", pci_name(pdev)); for (i = 0, ptr = buf; i <= PCI_ERR_ROOT_ERR_SRC; i += 4, ptr++) if (pci_read_config_dword(pdev, pos + i, ptr)) goto err_read; print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0); } goto out; err_read: print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0); IWL_ERR(trans, "Read failed at 0x%X\n", i); out: trans_pcie->pcie_dbg_dumped_once = 1; kfree(buf); }
0
336,807
lprn_is_black(gx_device_printer * pdev, int r, int h, int bx) { gx_device_lprn *const lprn = (gx_device_lprn *) pdev; int bh = lprn->nBh; int bpl = gdev_mem_bytes_per_scan_line(pdev); int x, y, y0; byte *p; int maxY = lprn->BlockLine / lprn->nBh * lprn->nBh; y0 = (r + h - bh) % maxY; for (y = 0; y < bh; y++) { p = &lprn->ImageBuf[(y0 + y) * bpl + bx * lprn->nBw]; for (x = 0; x < lprn->nBw; x++) { /* bpl isn't necessarily a multiple of lprn->nBw, so we need to explicitly stop after the last byte in this line to avoid accessing either the next line's data or going off the end of our buffer completely. This avoids https://bugs.ghostscript.com/show_bug.cgi?id=701785. */ if (bx * lprn->nBw + x >= bpl) break; if (p[x] != 0) return 1; } } return 0; }
0
513,071
bool Arg_comparator::set_cmp_func_int() { THD *thd= current_thd; func= is_owner_equal_func() ? &Arg_comparator::compare_e_int : &Arg_comparator::compare_int_signed; if ((*a)->field_type() == MYSQL_TYPE_YEAR && (*b)->field_type() == MYSQL_TYPE_YEAR) { func= is_owner_equal_func() ? &Arg_comparator::compare_e_datetime : &Arg_comparator::compare_datetime; } else if (func == &Arg_comparator::compare_int_signed) { if ((*a)->unsigned_flag) func= (((*b)->unsigned_flag)? &Arg_comparator::compare_int_unsigned : &Arg_comparator::compare_int_unsigned_signed); else if ((*b)->unsigned_flag) func= &Arg_comparator::compare_int_signed_unsigned; } else if (func== &Arg_comparator::compare_e_int) { if ((*a)->unsigned_flag ^ (*b)->unsigned_flag) func= &Arg_comparator::compare_e_int_diff_signedness; } a= cache_converted_constant(thd, a, &a_cache, compare_type_handler()); b= cache_converted_constant(thd, b, &b_cache, compare_type_handler()); return false; }
0
522,336
char *GmfReadByteFlow(int64_t MshIdx, int *NmbByt) { int cod, *WrdTab; size_t i, NmbWrd; GmfMshSct *msh = (GmfMshSct *)MshIdx; // Read and allocate the number of 4-byte words in the byteflow if(!(NmbWrd = GmfStatKwd(MshIdx, GmfByteFlow))) return(NULL); if(!(WrdTab = malloc(NmbWrd * WrdSiz))) return(NULL); // Disable the endianess conversion cod = msh->cod; msh->cod = 1; // Read the exact number of bytes in the byteflow GmfGotoKwd(MshIdx, GmfByteFlow); GmfGetLin(MshIdx, GmfByteFlow, NmbByt); // Read the byteflow as 4-byte blocks for(i=0;i<NmbWrd;i++) GmfGetLin(MshIdx, GmfByteFlow, &WrdTab[i]); // Enable endianess convertion msh->cod = cod; return((char *)WrdTab); }
0
245,146
Status ModelWeights::Initialize(OpKernelContext* const context) { OpInputList sparse_indices_inputs; TF_RETURN_IF_ERROR( context->input_list("sparse_indices", &sparse_indices_inputs)); OpInputList sparse_weights_inputs; TF_RETURN_IF_ERROR( context->input_list("sparse_weights", &sparse_weights_inputs)); if (sparse_indices_inputs.size() != sparse_weights_inputs.size()) return errors::InvalidArgument( "sparse_indices and sparse_weights must have the same length, got ", sparse_indices_inputs.size(), " and ", sparse_weights_inputs.size()); OpInputList dense_weights_inputs; TF_RETURN_IF_ERROR( context->input_list("dense_weights", &dense_weights_inputs)); OpOutputList sparse_weights_outputs; TF_RETURN_IF_ERROR(context->output_list("out_delta_sparse_weights", &sparse_weights_outputs)); if (sparse_weights_outputs.size() != sparse_weights_inputs.size()) return errors::InvalidArgument( "out_delta_sparse_weights and sparse_weights must have the same " "length, got ", sparse_weights_outputs.size(), " and ", sparse_weights_inputs.size()); OpOutputList dense_weights_outputs; TF_RETURN_IF_ERROR( context->output_list("out_delta_dense_weights", &dense_weights_outputs)); if (dense_weights_outputs.size() != dense_weights_inputs.size()) return errors::InvalidArgument( "out_delta_dense_weights and dense_weights must have the same length, " "got ", dense_weights_outputs.size(), " and ", dense_weights_inputs.size()); for (int i = 0; i < sparse_weights_inputs.size(); ++i) { Tensor* delta_t; TF_RETURN_IF_ERROR(sparse_weights_outputs.allocate( i, sparse_weights_inputs[i].shape(), &delta_t)); // Convert the input vector to a row matrix in internal representation. auto deltas = delta_t->shaped<float, 2>({1, delta_t->NumElements()}); deltas.setZero(); sparse_weights_.emplace_back(FeatureWeightsSparseStorage{ sparse_indices_inputs[i].flat<int64>(), sparse_weights_inputs[i].shaped<float, 2>( {1, sparse_weights_inputs[i].NumElements()}), deltas}); } // Reads in the weights, and allocates and initializes the delta weights. const auto initialize_weights = [&](const OpInputList& weight_inputs, OpOutputList* const weight_outputs, std::vector<FeatureWeightsDenseStorage>* const feature_weights) { for (int i = 0; i < weight_inputs.size(); ++i) { Tensor* delta_t; TF_RETURN_IF_ERROR( weight_outputs->allocate(i, weight_inputs[i].shape(), &delta_t)); // Convert the input vector to a row matrix in internal // representation. auto deltas = delta_t->shaped<float, 2>({1, delta_t->NumElements()}); deltas.setZero(); feature_weights->emplace_back(FeatureWeightsDenseStorage{ weight_inputs[i].shaped<float, 2>( {1, weight_inputs[i].NumElements()}), deltas}); } return Status::OK(); }; return initialize_weights(dense_weights_inputs, &dense_weights_outputs, &dense_weights_); }
0
301,414
static int vfswrap_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) { int result; START_PROFILE(syscall_lchown); result = lchown(path, uid, gid); END_PROFILE(syscall_lchown); return result; }
0
383,947
cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info, size_t count, const uint64_t clsid[2]) { size_t i; cdf_timestamp_t tp; struct timespec ts; char buf[64]; const char *str = NULL; const char *s; int len; if (!NOTMIME(ms)) str = cdf_clsid_to_mime(clsid, clsid2mime); for (i = 0; i < count; i++) { cdf_print_property_name(buf, sizeof(buf), info[i].pi_id); switch (info[i].pi_type) { case CDF_NULL: break; case CDF_SIGNED16: if (NOTMIME(ms) && file_printf(ms, ", %s: %hd", buf, info[i].pi_s16) == -1) return -1; break; case CDF_SIGNED32: if (NOTMIME(ms) && file_printf(ms, ", %s: %d", buf, info[i].pi_s32) == -1) return -1; break; case CDF_UNSIGNED32: if (NOTMIME(ms) && file_printf(ms, ", %s: %u", buf, info[i].pi_u32) == -1) return -1; break; case CDF_FLOAT: if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf, info[i].pi_f) == -1) return -1; break; case CDF_DOUBLE: if (NOTMIME(ms) && file_printf(ms, ", %s: %g", buf, info[i].pi_d) == -1) return -1; break; case CDF_LENGTH32_STRING: case CDF_LENGTH32_WSTRING: len = info[i].pi_str.s_len; if (len > 1) { char vbuf[1024]; size_t j, k = 1; if (info[i].pi_type == CDF_LENGTH32_WSTRING) k++; s = info[i].pi_str.s_buf; for (j = 0; j < sizeof(vbuf) && len--; j++, s += k) { if (*s == '\0') break; if (isprint((unsigned char)*s)) vbuf[j] = *s; } if (j == sizeof(vbuf)) --j; vbuf[j] = '\0'; if (NOTMIME(ms)) { if (vbuf[0]) { if (file_printf(ms, ", %s: %s", buf, vbuf) == -1) return -1; } } else if (str == NULL && info[i].pi_id == CDF_PROPERTY_NAME_OF_APPLICATION) { str = cdf_app_to_mime(vbuf, app2mime); } } break; case CDF_FILETIME: tp = info[i].pi_tp; if (tp != 0) { char tbuf[64]; if (tp < 1000000000000000LL) { cdf_print_elapsed_time(tbuf, sizeof(tbuf), tp); if (NOTMIME(ms) && file_printf(ms, ", %s: %s", buf, tbuf) == -1) return -1; } else { char *c, *ec; cdf_timestamp_to_timespec(&ts, tp); c = cdf_ctime(&ts.tv_sec, tbuf); if (c != NULL && (ec = strchr(c, '\n')) != NULL) *ec = '\0'; if (NOTMIME(ms) && file_printf(ms, ", %s: %s", buf, c) == -1) return -1; } } break; case CDF_CLIPBOARD: break; default: return -1; } } if (!NOTMIME(ms)) { if (str == NULL) return 0; if (file_printf(ms, "application/%s", str) == -1) return -1; } return 1; }
0
95,909
void AppendUninstallCommandLineFlags(const InstallerState& installer_state, const Product& product, CommandLine* uninstall_cmd) { DCHECK(uninstall_cmd); uninstall_cmd->AppendSwitch(installer::switches::kUninstall); product.AppendUninstallFlags(uninstall_cmd); if (installer_state.is_msi()) { uninstall_cmd->AppendSwitch(installer::switches::kMsi); if (product.is_chrome_frame()) { uninstall_cmd->AppendSwitch(installer::switches::kDeleteProfile); } } if (installer_state.system_install()) uninstall_cmd->AppendSwitch(installer::switches::kSystemLevel); if (installer_state.verbose_logging()) uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging); }
0
317,348
static int selinux_task_getioprio(struct task_struct *p) { return avc_has_perm(&selinux_state, current_sid(), task_sid_obj(p), SECCLASS_PROCESS, PROCESS__GETSCHED, NULL); }
0
197,499
GF_Err BD_DecMFFieldVec(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field, Bool is_mem_com) { GF_Err e; u32 NbBits, nbFields; u32 i; GF_ChildNodeItem *last; u8 qp_local, qp_on, initial_qp; GF_FieldInfo sffield; memset(&sffield, 0, sizeof(GF_FieldInfo)); sffield.fieldIndex = field->fieldIndex; sffield.fieldType = gf_sg_vrml_get_sf_type(field->fieldType); sffield.NDTtype = field->NDTtype; sffield.name = field->name; initial_qp = qp_local = qp_on = 0; //vector description - alloc the MF size before NbBits = gf_bs_read_int(bs, 5); nbFields = gf_bs_read_int(bs, NbBits); if (codec->ActiveQP) { initial_qp = 1; /*this is for QP 14*/ gf_bifs_dec_qp14_set_length(codec, nbFields); } if (field->fieldType != GF_SG_VRML_MFNODE) { e = gf_sg_vrml_mf_alloc(field->far_ptr, field->fieldType, nbFields); if (e) return e; for (i=0; i<nbFields; i++) { e = gf_sg_vrml_mf_get_item(field->far_ptr, field->fieldType, & sffield.far_ptr, i); if (e) return e; e = gf_bifs_dec_sf_field(codec, bs, node, &sffield, GF_FALSE); if (e) return e; } } else { last = NULL; for (i=0; i<nbFields; i++) { GF_Node *new_node = gf_bifs_dec_node(codec, bs, field->NDTtype); if (new_node) { e = gf_node_register(new_node, is_mem_com ? NULL : node); if (e) return e; if (node) { /*special case for QP, register as the current QP*/ if (gf_node_get_tag(new_node) == TAG_MPEG4_QuantizationParameter) { qp_local = ((M_QuantizationParameter *)new_node)->isLocal; /*we have a QP in the same scope, remove previous NB: we assume this is the right behavior, the spec doesn't say whether QP is cumulative or not*/ if (qp_on) gf_bifs_dec_qp_remove(codec, GF_FALSE); e = gf_bifs_dec_qp_set(codec, new_node); if (e) return e; qp_on = 1; if (qp_local) qp_local = 2; if (codec->force_keep_qp) { e = gf_node_list_add_child_last(field->far_ptr, new_node, &last); if (e) return e; } else { gf_node_register(new_node, NULL); gf_node_unregister(new_node, node); } } else { e = gf_node_list_add_child_last(field->far_ptr, new_node, &last); if (e) return e; } } /*proto coding*/ else if (codec->pCurrentProto) { /*TO DO: what happens if this is a QP node on the interface ?*/ e = gf_node_list_add_child_last( (GF_ChildNodeItem **)field->far_ptr, new_node, &last); if (e) return e; } } else { return codec->LastError ? codec->LastError : GF_NON_COMPLIANT_BITSTREAM; } } /*according to the spec, the QP applies to the current node itself, not just children. If IsLocal is TRUE remove the node*/ if (qp_on && qp_local) { if (qp_local == 2) { // qp_local = 1; } else { //ask to get rid of QP and reactivate if we had a QP when entering the node gf_bifs_dec_qp_remove(codec, initial_qp); // qp_local = 0; } } } /*finally delete the QP if any (local or not) as we get out of this node*/ if (qp_on) gf_bifs_dec_qp_remove(codec, GF_TRUE); return GF_OK; }
1
307,846
ciKlass* ciEnv::get_klass_by_index(constantPoolHandle cpool, int index, bool& is_accessible, ciInstanceKlass* accessor) { GUARDED_VM_ENTRY(return get_klass_by_index_impl(cpool, index, is_accessible, accessor);) }
0
379,703
R_API void r_anal_function_vars_cache_fini(RAnalFcnVarsCache *cache) { if (!cache) { return; } r_list_free (cache->bvars); r_list_free (cache->rvars); r_list_free (cache->svars); }
0
459,010
http_findhdr(const struct http *hp, unsigned l, const char *hdr) { unsigned u; for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { Tcheck(hp->hd[u]); if (hp->hd[u].e < hp->hd[u].b + l + 1) continue; if (hp->hd[u].b[l] != ':') continue; if (!http_hdr_at(hdr, hp->hd[u].b, l)) continue; return (u); } return (0); }
0
247,355
pgpArmor pgpReadPkts(const char * fn, uint8_t ** pkt, size_t * pktlen) { uint8_t * b = NULL; ssize_t blen; pgpArmor ec = PGPARMOR_ERR_NO_BEGIN_PGP; /* XXX assume failure */ int rc = rpmioSlurp(fn, &b, &blen); if (rc == 0 && b != NULL && blen > 0) { ec = decodePkts(b, pkt, pktlen); } free(b); return ec; }
0
317,042
static int selinux_mmap_file(struct file *file, unsigned long reqprot, unsigned long prot, unsigned long flags) { struct common_audit_data ad; int rc; if (file) { ad.type = LSM_AUDIT_DATA_FILE; ad.u.file = file; rc = inode_has_perm(current_cred(), file_inode(file), FILE__MAP, &ad); if (rc) return rc; } if (checkreqprot_get(&selinux_state)) prot = reqprot; return file_map_prot_check(file, prot, (flags & MAP_TYPE) == MAP_SHARED); }
0
230,381
PJ_DEF(pj_xml_node*) pj_xml_clone( pj_pool_t *pool, const pj_xml_node *rhs) { pj_xml_node *node; const pj_xml_attr *r_attr; const pj_xml_node *child; node = alloc_node(pool); pj_strdup(pool, &node->name, &rhs->name); pj_strdup(pool, &node->content, &rhs->content); /* Clone all attributes */ r_attr = rhs->attr_head.next; while (r_attr != &rhs->attr_head) { pj_xml_attr *attr; attr = alloc_attr(pool); pj_strdup(pool, &attr->name, &r_attr->name); pj_strdup(pool, &attr->value, &r_attr->value); pj_list_push_back(&node->attr_head, attr); r_attr = r_attr->next; } /* Clone all child nodes. */ child = rhs->node_head.next; while (child != (pj_xml_node*) &rhs->node_head) { pj_xml_node *new_child; new_child = pj_xml_clone(pool, child); pj_list_push_back(&node->node_head, new_child); child = child->next; } return node; }
0
359,665
DEFUN (show_ip_bgp_community_info, show_ip_bgp_community_info_cmd, "show ip bgp community-info", SHOW_STR IP_STR BGP_STR "List all bgp community information\n") { vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); hash_iterate (community_hash (), (void (*) (struct hash_backet *, void *)) community_show_all_iterator, vty); return CMD_SUCCESS; }
0
238,632
void bpf_free_kfunc_btf_tab(struct bpf_kfunc_btf_tab *tab) { if (!tab) return; while (tab->nr_descs--) { module_put(tab->descs[tab->nr_descs].module); btf_put(tab->descs[tab->nr_descs].btf); } kfree(tab); }
0
513,345
static void clear_tables(JOIN *join) { /* must clear only the non-const tables, as const tables are not re-calculated. */ for (uint i= 0 ; i < join->table_count ; i++) { if (!(join->table[i]->map & join->const_table_map)) mark_as_null_row(join->table[i]); // All fields are NULL } }
0
386,530
void DL_Dxf::writeKnot(DL_WriterA& dw, const DL_KnotData& data) { dw.dxfReal(40, data.k); }
0
488,354
static void remove_anon_migration_ptes(struct page *old, struct page *new) { struct anon_vma *anon_vma; struct vm_area_struct *vma; unsigned long mapping; mapping = (unsigned long)new->mapping; if (!mapping || (mapping & PAGE_MAPPING_ANON) == 0) return; /* * We hold the mmap_sem lock. So no need to call page_lock_anon_vma. */ anon_vma = (struct anon_vma *) (mapping - PAGE_MAPPING_ANON); spin_lock(&anon_vma->lock); list_for_each_entry(vma, &anon_vma->head, anon_vma_node) remove_migration_pte(vma, old, new); spin_unlock(&anon_vma->lock); }
0
225,938
GF_Box *tfhd_box_new() { ISOM_DECL_BOX_ALLOC(GF_TrackFragmentHeaderBox, GF_ISOM_BOX_TYPE_TFHD); //NO FLAGS SET BY DEFAULT return (GF_Box *)tmp; }
0
331,763
void QPaintEngineEx::drawLines(const QLineF *lines, int lineCount) { int elementCount = lineCount << 1; while (elementCount > 0) { int count = qMin(elementCount, 32); QVectorPath path((const qreal *) lines, count, qpaintengineex_line_types_16, QVectorPath::LinesHint); stroke(path, state()->pen); elementCount -= 32; lines += 16; } }
0
294,604
d_complex_new_internal(VALUE klass, VALUE nth, int jd, int df, VALUE sf, int of, double sg, int y, int m, int d, int h, int min, int s, unsigned flags) { struct ComplexDateData *dat; VALUE obj; obj = TypedData_Make_Struct(klass, struct ComplexDateData, &d_lite_type, dat); set_to_complex(obj, dat, nth, jd, df, sf, of, sg, y, m, d, h, min, s, flags); assert(have_jd_p(dat) || have_civil_p(dat)); assert(have_df_p(dat) || have_time_p(dat)); return obj; }
0
274,767
static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs, runlist_element **rl, VCN *update_from) { s64 to_write; s64 need; ntfs_volume *vol = na->ni->vol; int eo, ret = -1; runlist *rlc; LCN lcn_seek_from = -1; VCN cur_vcn, from_vcn; if (na->ni->mft_no == FILE_Bitmap) { /* * Filling a hole in the main bitmap implies allocating * clusters, which is likely to imply updating the * bitmap in a cluster being allocated. * Not supported now, could lead to endless recursions. */ ntfs_log_error("Corrupt $BitMap not fully allocated\n"); errno = EIO; goto err_out; } to_write = min(count, ((*rl)->length << vol->cluster_size_bits) - *ofs); cur_vcn = (*rl)->vcn; from_vcn = (*rl)->vcn + (*ofs >> vol->cluster_size_bits); ntfs_log_trace("count: %lld, cur_vcn: %lld, from: %lld, to: %lld, ofs: " "%lld\n", (long long)count, (long long)cur_vcn, (long long)from_vcn, (long long)to_write, (long long)*ofs); /* Map the runlist to be able to update mapping pairs later. */ #if PARTIAL_RUNLIST_UPDATING if (!na->rl) { if (ntfs_attr_map_whole_runlist(na)) goto err_out; } else { /* make sure the run ahead of hole is mapped */ if ((*rl)->lcn == LCN_HOLE) { if (ntfs_attr_map_partial_runlist(na, (cur_vcn ? cur_vcn - 1 : cur_vcn))) goto err_out; } } #else if (ntfs_attr_map_whole_runlist(na)) goto err_out; #endif /* Restore @*rl, it probably get lost during runlist mapping. */ *rl = ntfs_attr_find_vcn(na, cur_vcn); if (!*rl) { ntfs_log_error("Failed to find run after mapping runlist. " "Please report to %s.\n", NTFS_DEV_LIST); errno = EIO; goto err_out; } /* Search backwards to find the best lcn to start seek from. */ rlc = *rl; while (rlc->vcn) { rlc--; if (rlc->lcn >= 0) { /* * avoid fragmenting a compressed file * Windows does not do that, and that may * not be desirable for files which can * be updated */ if (na->data_flags & ATTR_COMPRESSION_MASK) lcn_seek_from = rlc->lcn + rlc->length; else lcn_seek_from = rlc->lcn + (from_vcn - rlc->vcn); break; } } if (lcn_seek_from == -1) { /* Backwards search failed, search forwards. */ rlc = *rl; while (rlc->length) { rlc++; if (rlc->lcn >= 0) { lcn_seek_from = rlc->lcn - (rlc->vcn - from_vcn); if (lcn_seek_from < -1) lcn_seek_from = -1; break; } } } need = ((*ofs + to_write - 1) >> vol->cluster_size_bits) + 1 + (*rl)->vcn - from_vcn; if ((na->data_flags & ATTR_COMPRESSION_MASK) && (need < na->compression_block_clusters)) { /* * for a compressed file, be sure to allocate the full * compression block, as we may need space to decompress * existing compressed data. * So allocate the space common to compression block * and existing hole. */ VCN alloc_vcn; if ((from_vcn & -na->compression_block_clusters) <= (*rl)->vcn) alloc_vcn = (*rl)->vcn; else alloc_vcn = from_vcn & -na->compression_block_clusters; need = (alloc_vcn | (na->compression_block_clusters - 1)) + 1 - alloc_vcn; if (need > (*rl)->length) { ntfs_log_error("Cannot allocate %lld clusters" " within a hole of %lld\n", (long long)need, (long long)(*rl)->length); errno = EIO; goto err_out; } rlc = ntfs_cluster_alloc(vol, alloc_vcn, need, lcn_seek_from, DATA_ZONE); } else rlc = ntfs_cluster_alloc(vol, from_vcn, need, lcn_seek_from, DATA_ZONE); if (!rlc) goto err_out; if (na->data_flags & (ATTR_COMPRESSION_MASK | ATTR_IS_SPARSE)) na->compressed_size += need << vol->cluster_size_bits; *rl = ntfs_runlists_merge(na->rl, rlc); NAttrSetRunlistDirty(na); /* * For a compressed attribute, we must be sure there are two * available entries, so reserve them before it gets too late. */ if (*rl && (na->data_flags & ATTR_COMPRESSION_MASK)) { runlist_element *oldrl = na->rl; na->rl = *rl; *rl = ntfs_rl_extend(na,*rl,2); if (!*rl) na->rl = oldrl; /* restore to original if failed */ } if (!*rl) { eo = errno; ntfs_log_perror("Failed to merge runlists"); if (ntfs_cluster_free_from_rl(vol, rlc)) { ntfs_log_perror("Failed to free hot clusters. " "Please run chkdsk /f"); } errno = eo; goto err_out; } na->unused_runs = 2; na->rl = *rl; if ((*update_from == -1) || (from_vcn < *update_from)) *update_from = from_vcn; *rl = ntfs_attr_find_vcn(na, cur_vcn); if (!*rl) { /* * It's definitely a BUG, if we failed to find @cur_vcn, because * we missed it during instantiating of the hole. */ ntfs_log_error("Failed to find run after hole instantiation. " "Please report to %s.\n", NTFS_DEV_LIST); errno = EIO; goto err_out; } /* If leaved part of the hole go to the next run. */ if ((*rl)->lcn < 0) (*rl)++; /* Now LCN shoudn't be less than 0. */ if ((*rl)->lcn < 0) { ntfs_log_error("BUG! LCN is lesser than 0. " "Please report to the %s.\n", NTFS_DEV_LIST); errno = EIO; goto err_out; } if (*ofs) { /* Clear non-sparse region from @cur_vcn to @*ofs. */ if (ntfs_attr_fill_zero(na, cur_vcn << vol->cluster_size_bits, *ofs)) goto err_out; } if ((*rl)->vcn < cur_vcn) { /* * Clusters that replaced hole are merged with * previous run, so we need to update offset. */ *ofs += (cur_vcn - (*rl)->vcn) << vol->cluster_size_bits; } if ((*rl)->vcn > cur_vcn) { /* * We left part of the hole, so we need to update offset */ *ofs -= ((*rl)->vcn - cur_vcn) << vol->cluster_size_bits; } ret = 0; err_out: return ret; }
0
446,079
static void atusb_xmit_complete(struct urb *urb) { dev_dbg(&urb->dev->dev, "atusb_xmit urb completed"); }
0
309,850
compare_part(const char *part, const char *full) { const char *next_part; const char *next_full; unsigned used_full = 0; unsigned used_delay = 0; while (*part != 0) { if (*part != *full) { used_full = 0; break; } /* * Adjust the return-value to allow the rare case of * string<delay>string * to remove the whole piece. The most common case is a delay at the * end of the string. The adjusted string will retain the delay, which * is conservative. */ if (used_delay != 0) { used_full += used_delay; used_delay = 0; } if (*part == '$' && *full == '$') { next_part = skip_delay(part); next_full = skip_delay(full); if (next_part != part && next_full != full) { used_delay += (unsigned) (next_full - full); full = next_full; part = next_part; continue; } } ++used_full; ++part; ++full; } return used_full; }
0
387,803
void InstanceKlass::collect_statistics(KlassSizeStats *sz) const { Klass::collect_statistics(sz); sz->_inst_size = wordSize * size_helper(); sz->_vtab_bytes = wordSize * vtable_length(); sz->_itab_bytes = wordSize * itable_length(); sz->_nonstatic_oopmap_bytes = wordSize * nonstatic_oop_map_size(); int n = 0; n += (sz->_methods_array_bytes = sz->count_array(methods())); n += (sz->_method_ordering_bytes = sz->count_array(method_ordering())); n += (sz->_local_interfaces_bytes = sz->count_array(local_interfaces())); n += (sz->_transitive_interfaces_bytes = sz->count_array(transitive_interfaces())); n += (sz->_fields_bytes = sz->count_array(fields())); n += (sz->_inner_classes_bytes = sz->count_array(inner_classes())); n += (sz->_nest_members_bytes = sz->count_array(nest_members())); sz->_ro_bytes += n; const ConstantPool* cp = constants(); if (cp) { cp->collect_statistics(sz); } const Annotations* anno = annotations(); if (anno) { anno->collect_statistics(sz); } const Array<Method*>* methods_array = methods(); if (methods()) { for (int i = 0; i < methods_array->length(); i++) { Method* method = methods_array->at(i); if (method) { sz->_method_count ++; method->collect_statistics(sz); } } } }
0
235,655
static void copy_rr(pj_pool_t *pool, pj_dns_parsed_rr *dst, const pj_dns_parsed_rr *src, unsigned *nametable_count, pj_str_t nametable[]) { pj_memcpy(dst, src, sizeof(*src)); apply_name_table(nametable_count, nametable, &src->name, pool, &dst->name); if (src->data) { dst->data = pj_pool_alloc(pool, src->rdlength); pj_memcpy(dst->data, src->data, src->rdlength); } if (src->type == PJ_DNS_TYPE_SRV) { apply_name_table(nametable_count, nametable, &src->rdata.srv.target, pool, &dst->rdata.srv.target); } else if (src->type == PJ_DNS_TYPE_A) { dst->rdata.a.ip_addr.s_addr = src->rdata.a.ip_addr.s_addr; } else if (src->type == PJ_DNS_TYPE_AAAA) { pj_memcpy(&dst->rdata.aaaa.ip_addr, &src->rdata.aaaa.ip_addr, sizeof(pj_in6_addr)); } else if (src->type == PJ_DNS_TYPE_CNAME) { pj_strdup(pool, &dst->rdata.cname.name, &src->rdata.cname.name); } else if (src->type == PJ_DNS_TYPE_NS) { pj_strdup(pool, &dst->rdata.ns.name, &src->rdata.ns.name); } else if (src->type == PJ_DNS_TYPE_PTR) { pj_strdup(pool, &dst->rdata.ptr.name, &src->rdata.ptr.name); } }
0
338,235
void WasmBinaryBuilder::visitBlock(Block* curr) { BYN_TRACE("zz node: Block\n"); startControlFlow(curr); // special-case Block and de-recurse nested blocks in their first position, as // that is a common pattern that can be very highly nested. std::vector<Block*> stack; while (1) { curr->type = getType(); curr->name = getNextLabel(); breakStack.push_back({curr->name, curr->type}); stack.push_back(curr); if (more() && input[pos] == BinaryConsts::Block) { // a recursion readNextDebugLocation(); curr = allocator.alloc<Block>(); startControlFlow(curr); pos++; if (debugLocation.size()) { requireFunctionContext("block-debugLocation"); currFunction->debugLocations[curr] = *debugLocation.begin(); } continue; } else { // end of recursion break; } } Block* last = nullptr; while (stack.size() > 0) { curr = stack.back(); stack.pop_back(); // everything after this, that is left when we see the marker, is ours size_t start = expressionStack.size(); if (last) { // the previous block is our first-position element pushExpression(last); } last = curr; processExpressions(); size_t end = expressionStack.size(); if (end < start) { throwError("block cannot pop from outside"); } pushBlockElements(curr, curr->type, start); curr->finalize(curr->type, breakTargetNames.find(curr->name) != breakTargetNames.end() ? Block::HasBreak : Block::NoBreak); breakStack.pop_back(); breakTargetNames.erase(curr->name); } }
0
442,817
static void free_config_fields(struct Configurable *config) { if(config->random_file) free(config->random_file); if(config->egd_file) free(config->egd_file); if(config->trace_dump) free(config->trace_dump); if(config->cipher_list) free(config->cipher_list); if(config->userpwd) free(config->userpwd); if(config->postfields) free(config->postfields); if(config->proxy) free(config->proxy); if(config->proxyuserpwd) free(config->proxyuserpwd); if(config->cookie) free(config->cookie); if(config->cookiefile) free(config->cookiefile); if(config->krb4level) free(config->krb4level); if(config->headerfile) free(config->headerfile); if(config->ftpport) free(config->ftpport); if(config->range) free(config->range); if(config->customrequest) free(config->customrequest); if(config->writeout) free(config->writeout); if(config->httppost) curl_formfree(config->httppost); if (config->cert) free(config->cert); if(config->cacert) free(config->cacert); if (config->cert_type) free(config->cert_type); if(config->capath) free(config->capath); if(config->cookiejar) free(config->cookiejar); if(config->ftp_account) free(config->ftp_account); if(config->ftp_alternative_to_user) free(config->ftp_alternative_to_user); if(config->iface) free(config->iface); if(config->socksproxy) free(config->socksproxy); if(config->libcurl) free(config->libcurl); if (config->key_passwd) free(config->key_passwd); if (config->key) free(config->key); if (config->key_type) free(config->key_type); if (config->pubkey) free(config->pubkey); if (config->referer) free(config->referer); curl_slist_free_all(config->quote); /* checks for config->quote == NULL */ curl_slist_free_all(config->prequote); curl_slist_free_all(config->postquote); curl_slist_free_all(config->headers); curl_slist_free_all(config->telnet_options); }
0
484,044
START_TEST(SecureChannel_sendAsymmetricOPNMessage_withoutConnection) { UA_OpenSecureChannelResponse dummyResponse; createDummyResponse(&dummyResponse); testChannel.securityMode = UA_MESSAGESECURITYMODE_NONE; // Remove connection to provoke error UA_Connection_detachSecureChannel(testChannel.connection); testChannel.connection = NULL; UA_StatusCode retval = UA_SecureChannel_sendAsymmetricOPNMessage(&testChannel, 42, &dummyResponse, &UA_TYPES[UA_TYPES_OPENSECURECHANNELRESPONSE]); ck_assert_msg(retval != UA_STATUSCODE_GOOD, "Expected failure without a connection"); }END_TEST
0
293,778
static void symbols_from_stubs(RList *ret, HtPP *kernel_syms_by_addr, RKernelCacheObj *obj, RBinFile *bf, RKext *kext, int ordinal) { RStubsInfo *stubs_info = get_stubs_info(kext->mach0, kext->range.offset, obj); if (!stubs_info) { return; } ut64 stubs_cursor = stubs_info->stubs.offset; ut64 stubs_end = stubs_cursor + stubs_info->stubs.size; for (; stubs_cursor < stubs_end; stubs_cursor += 12) { ut8 arm64_code[8]; if (r_buf_read_at (obj->cache_buf, stubs_cursor, arm64_code, 8) < 8) { break; } ut64 vaddr = stubs_cursor + obj->pa2va_exec; ut64 addr_in_got = extract_addr_from_code (arm64_code, vaddr); bool found = false; int level = 3; ut64 target_addr = UT64_MAX; while (!found && level-- > 0) { ut64 offset_in_got = addr_in_got - obj->pa2va_exec; ut64 addr; if (r_buf_read_at (obj->cache_buf, offset_in_got, (ut8*) &addr, 8) < 8) { break; } if (level == 2) { target_addr = addr; } r_strf_var (key, 32, "%"PFMT64x, addr); const char *name = sdb_ht_find (kernel_syms_by_addr, key, &found); if (found) { RBinSymbol *sym = R_NEW0 (RBinSymbol); if (!sym) { break; } sym->name = r_str_newf ("stub.%s", name); sym->vaddr = vaddr; sym->paddr = stubs_cursor; sym->size = 12; sym->forwarder = "NONE"; sym->bind = "LOCAL"; sym->type = "FUNC"; sym->ordinal = ordinal ++; r_list_append (ret, sym); break; } addr_in_got = addr; } if (found || target_addr == UT64_MAX) { continue; } ensure_kexts_initialized (obj, bf); RKext *remote_kext = r_kext_index_vget (obj->kexts, target_addr); if (!remote_kext) { continue; } RBinSymbol *remote_sym = R_NEW0 (RBinSymbol); if (!remote_sym) { break; } remote_sym->name = r_str_newf ("exp.%s.0x%"PFMT64x, kext_short_name (remote_kext), target_addr); remote_sym->vaddr = target_addr; remote_sym->paddr = target_addr - obj->pa2va_exec; remote_sym->size = 0; remote_sym->forwarder = "NONE"; remote_sym->bind = "GLOBAL"; remote_sym->type = "FUNC"; remote_sym->ordinal = ordinal ++; r_list_append (ret, remote_sym); RBinSymbol *local_sym = R_NEW0 (RBinSymbol); if (!local_sym) { break; } local_sym->name = r_str_newf ("stub.%s.0x%"PFMT64x, kext_short_name (remote_kext), target_addr); local_sym->vaddr = vaddr; local_sym->paddr = stubs_cursor; local_sym->size = 12; local_sym->forwarder = "NONE"; local_sym->bind = "GLOBAL"; local_sym->type = "FUNC"; local_sym->ordinal = ordinal ++; r_list_append (ret, local_sym); } R_FREE (stubs_info); }
0
294,573
test_civil(int from, int to, double sg) { int j; fprintf(stderr, "test_civil: %d...%d (%d) - %.0f\n", from, to, to - from, sg); for (j = from; j <= to; j++) { int y, m, d, rj, ns; c_jd_to_civil(j, sg, &y, &m, &d); c_civil_to_jd(y, m, d, sg, &rj, &ns); if (j != rj) { fprintf(stderr, "%d != %d\n", j, rj); return 0; } } return 1; }
0
317,135
static void smack_cred_transfer(struct cred *new, const struct cred *old) { struct task_smack *old_tsp = smack_cred(old); struct task_smack *new_tsp = smack_cred(new); new_tsp->smk_task = old_tsp->smk_task; new_tsp->smk_forked = old_tsp->smk_task; mutex_init(&new_tsp->smk_rules_lock); INIT_LIST_HEAD(&new_tsp->smk_rules); /* cbs copy rule list */ }
0
400,731
size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i) { __wsum sum, next; sum = *csum; if (unlikely(iov_iter_is_pipe(i) || iov_iter_is_discard(i))) { WARN_ON(1); return 0; } iterate_and_advance(i, bytes, base, len, off, ({ next = csum_and_copy_from_user(base, addr + off, len); sum = csum_block_add(sum, next, off); next ? 0 : len; }), ({ sum = csum_and_memcpy(addr + off, base, len, sum, off); }) ) *csum = sum; return bytes; }
0
474,049
murmur(st_index_t h, st_index_t k, int r) { const st_index_t m = MurmurMagic; #if MURMUR == 1 h += k; h *= m; h ^= h >> r; #elif MURMUR == 2 k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; #endif return h; }
0
194,963
static MagickBooleanType GetEXIFProperty(const Image *image, const char *property) { #define MaxDirectoryStack 16 #define EXIF_DELIMITER "\n" #define EXIF_NUM_FORMATS 12 #define EXIF_FMT_BYTE 1 #define EXIF_FMT_STRING 2 #define EXIF_FMT_USHORT 3 #define EXIF_FMT_ULONG 4 #define EXIF_FMT_URATIONAL 5 #define EXIF_FMT_SBYTE 6 #define EXIF_FMT_UNDEFINED 7 #define EXIF_FMT_SSHORT 8 #define EXIF_FMT_SLONG 9 #define EXIF_FMT_SRATIONAL 10 #define EXIF_FMT_SINGLE 11 #define EXIF_FMT_DOUBLE 12 #define TAG_EXIF_OFFSET 0x8769 #define TAG_GPS_OFFSET 0x8825 #define TAG_INTEROP_OFFSET 0xa005 #define EXIFMultipleValues(size,format,arg) \ { \ ssize_t \ component; \ \ size_t \ length; \ \ unsigned char \ *p1; \ \ length=0; \ p1=p; \ for (component=0; component < components; component++) \ { \ length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \ format", ",arg); \ if (length >= (MaxTextExtent-1)) \ length=MaxTextExtent-1; \ p1+=size; \ } \ if (length > 1) \ buffer[length-2]='\0'; \ value=AcquireString(buffer); \ } #define EXIFMultipleFractions(size,format,arg1,arg2) \ { \ ssize_t \ component; \ \ size_t \ length; \ \ unsigned char \ *p1; \ \ length=0; \ p1=p; \ for (component=0; component < components; component++) \ { \ length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \ format", ",(arg1),(arg2)); \ if (length >= (MaxTextExtent-1)) \ length=MaxTextExtent-1; \ p1+=size; \ } \ if (length > 1) \ buffer[length-2]='\0'; \ value=AcquireString(buffer); \ } typedef struct _DirectoryInfo { const unsigned char *directory; size_t entry; ssize_t offset; } DirectoryInfo; typedef struct _TagInfo { size_t tag; const char description[36]; } TagInfo; static const TagInfo EXIFTag[] = { { 0x001, "exif:InteroperabilityIndex" }, { 0x002, "exif:InteroperabilityVersion" }, { 0x100, "exif:ImageWidth" }, { 0x101, "exif:ImageLength" }, { 0x102, "exif:BitsPerSample" }, { 0x103, "exif:Compression" }, { 0x106, "exif:PhotometricInterpretation" }, { 0x10a, "exif:FillOrder" }, { 0x10d, "exif:DocumentName" }, { 0x10e, "exif:ImageDescription" }, { 0x10f, "exif:Make" }, { 0x110, "exif:Model" }, { 0x111, "exif:StripOffsets" }, { 0x112, "exif:Orientation" }, { 0x115, "exif:SamplesPerPixel" }, { 0x116, "exif:RowsPerStrip" }, { 0x117, "exif:StripByteCounts" }, { 0x11a, "exif:XResolution" }, { 0x11b, "exif:YResolution" }, { 0x11c, "exif:PlanarConfiguration" }, { 0x11d, "exif:PageName" }, { 0x11e, "exif:XPosition" }, { 0x11f, "exif:YPosition" }, { 0x118, "exif:MinSampleValue" }, { 0x119, "exif:MaxSampleValue" }, { 0x120, "exif:FreeOffsets" }, { 0x121, "exif:FreeByteCounts" }, { 0x122, "exif:GrayResponseUnit" }, { 0x123, "exif:GrayResponseCurve" }, { 0x124, "exif:T4Options" }, { 0x125, "exif:T6Options" }, { 0x128, "exif:ResolutionUnit" }, { 0x12d, "exif:TransferFunction" }, { 0x131, "exif:Software" }, { 0x132, "exif:DateTime" }, { 0x13b, "exif:Artist" }, { 0x13e, "exif:WhitePoint" }, { 0x13f, "exif:PrimaryChromaticities" }, { 0x140, "exif:ColorMap" }, { 0x141, "exif:HalfToneHints" }, { 0x142, "exif:TileWidth" }, { 0x143, "exif:TileLength" }, { 0x144, "exif:TileOffsets" }, { 0x145, "exif:TileByteCounts" }, { 0x14a, "exif:SubIFD" }, { 0x14c, "exif:InkSet" }, { 0x14d, "exif:InkNames" }, { 0x14e, "exif:NumberOfInks" }, { 0x150, "exif:DotRange" }, { 0x151, "exif:TargetPrinter" }, { 0x152, "exif:ExtraSample" }, { 0x153, "exif:SampleFormat" }, { 0x154, "exif:SMinSampleValue" }, { 0x155, "exif:SMaxSampleValue" }, { 0x156, "exif:TransferRange" }, { 0x157, "exif:ClipPath" }, { 0x158, "exif:XClipPathUnits" }, { 0x159, "exif:YClipPathUnits" }, { 0x15a, "exif:Indexed" }, { 0x15b, "exif:JPEGTables" }, { 0x15f, "exif:OPIProxy" }, { 0x200, "exif:JPEGProc" }, { 0x201, "exif:JPEGInterchangeFormat" }, { 0x202, "exif:JPEGInterchangeFormatLength" }, { 0x203, "exif:JPEGRestartInterval" }, { 0x205, "exif:JPEGLosslessPredictors" }, { 0x206, "exif:JPEGPointTransforms" }, { 0x207, "exif:JPEGQTables" }, { 0x208, "exif:JPEGDCTables" }, { 0x209, "exif:JPEGACTables" }, { 0x211, "exif:YCbCrCoefficients" }, { 0x212, "exif:YCbCrSubSampling" }, { 0x213, "exif:YCbCrPositioning" }, { 0x214, "exif:ReferenceBlackWhite" }, { 0x2bc, "exif:ExtensibleMetadataPlatform" }, { 0x301, "exif:Gamma" }, { 0x302, "exif:ICCProfileDescriptor" }, { 0x303, "exif:SRGBRenderingIntent" }, { 0x320, "exif:ImageTitle" }, { 0x5001, "exif:ResolutionXUnit" }, { 0x5002, "exif:ResolutionYUnit" }, { 0x5003, "exif:ResolutionXLengthUnit" }, { 0x5004, "exif:ResolutionYLengthUnit" }, { 0x5005, "exif:PrintFlags" }, { 0x5006, "exif:PrintFlagsVersion" }, { 0x5007, "exif:PrintFlagsCrop" }, { 0x5008, "exif:PrintFlagsBleedWidth" }, { 0x5009, "exif:PrintFlagsBleedWidthScale" }, { 0x500A, "exif:HalftoneLPI" }, { 0x500B, "exif:HalftoneLPIUnit" }, { 0x500C, "exif:HalftoneDegree" }, { 0x500D, "exif:HalftoneShape" }, { 0x500E, "exif:HalftoneMisc" }, { 0x500F, "exif:HalftoneScreen" }, { 0x5010, "exif:JPEGQuality" }, { 0x5011, "exif:GridSize" }, { 0x5012, "exif:ThumbnailFormat" }, { 0x5013, "exif:ThumbnailWidth" }, { 0x5014, "exif:ThumbnailHeight" }, { 0x5015, "exif:ThumbnailColorDepth" }, { 0x5016, "exif:ThumbnailPlanes" }, { 0x5017, "exif:ThumbnailRawBytes" }, { 0x5018, "exif:ThumbnailSize" }, { 0x5019, "exif:ThumbnailCompressedSize" }, { 0x501a, "exif:ColorTransferFunction" }, { 0x501b, "exif:ThumbnailData" }, { 0x5020, "exif:ThumbnailImageWidth" }, { 0x5021, "exif:ThumbnailImageHeight" }, { 0x5022, "exif:ThumbnailBitsPerSample" }, { 0x5023, "exif:ThumbnailCompression" }, { 0x5024, "exif:ThumbnailPhotometricInterp" }, { 0x5025, "exif:ThumbnailImageDescription" }, { 0x5026, "exif:ThumbnailEquipMake" }, { 0x5027, "exif:ThumbnailEquipModel" }, { 0x5028, "exif:ThumbnailStripOffsets" }, { 0x5029, "exif:ThumbnailOrientation" }, { 0x502a, "exif:ThumbnailSamplesPerPixel" }, { 0x502b, "exif:ThumbnailRowsPerStrip" }, { 0x502c, "exif:ThumbnailStripBytesCount" }, { 0x502d, "exif:ThumbnailResolutionX" }, { 0x502e, "exif:ThumbnailResolutionY" }, { 0x502f, "exif:ThumbnailPlanarConfig" }, { 0x5030, "exif:ThumbnailResolutionUnit" }, { 0x5031, "exif:ThumbnailTransferFunction" }, { 0x5032, "exif:ThumbnailSoftwareUsed" }, { 0x5033, "exif:ThumbnailDateTime" }, { 0x5034, "exif:ThumbnailArtist" }, { 0x5035, "exif:ThumbnailWhitePoint" }, { 0x5036, "exif:ThumbnailPrimaryChromaticities" }, { 0x5037, "exif:ThumbnailYCbCrCoefficients" }, { 0x5038, "exif:ThumbnailYCbCrSubsampling" }, { 0x5039, "exif:ThumbnailYCbCrPositioning" }, { 0x503A, "exif:ThumbnailRefBlackWhite" }, { 0x503B, "exif:ThumbnailCopyRight" }, { 0x5090, "exif:LuminanceTable" }, { 0x5091, "exif:ChrominanceTable" }, { 0x5100, "exif:FrameDelay" }, { 0x5101, "exif:LoopCount" }, { 0x5110, "exif:PixelUnit" }, { 0x5111, "exif:PixelPerUnitX" }, { 0x5112, "exif:PixelPerUnitY" }, { 0x5113, "exif:PaletteHistogram" }, { 0x1000, "exif:RelatedImageFileFormat" }, { 0x1001, "exif:RelatedImageLength" }, { 0x1002, "exif:RelatedImageWidth" }, { 0x800d, "exif:ImageID" }, { 0x80e3, "exif:Matteing" }, { 0x80e4, "exif:DataType" }, { 0x80e5, "exif:ImageDepth" }, { 0x80e6, "exif:TileDepth" }, { 0x828d, "exif:CFARepeatPatternDim" }, { 0x828e, "exif:CFAPattern2" }, { 0x828f, "exif:BatteryLevel" }, { 0x8298, "exif:Copyright" }, { 0x829a, "exif:ExposureTime" }, { 0x829d, "exif:FNumber" }, { 0x83bb, "exif:IPTC/NAA" }, { 0x84e3, "exif:IT8RasterPadding" }, { 0x84e5, "exif:IT8ColorTable" }, { 0x8649, "exif:ImageResourceInformation" }, { 0x8769, "exif:ExifOffset" }, /* specs as "Exif IFD Pointer"? */ { 0x8773, "exif:InterColorProfile" }, { 0x8822, "exif:ExposureProgram" }, { 0x8824, "exif:SpectralSensitivity" }, { 0x8825, "exif:GPSInfo" }, /* specs as "GPSInfo IFD Pointer"? */ { 0x8827, "exif:PhotographicSensitivity" }, { 0x8828, "exif:OECF" }, { 0x8829, "exif:Interlace" }, { 0x882a, "exif:TimeZoneOffset" }, { 0x882b, "exif:SelfTimerMode" }, { 0x8830, "exif:SensitivityType" }, { 0x8831, "exif:StandardOutputSensitivity" }, { 0x8832, "exif:RecommendedExposureIndex" }, { 0x8833, "exif:ISOSpeed" }, { 0x8834, "exif:ISOSpeedLatitudeyyy" }, { 0x8835, "exif:ISOSpeedLatitudezzz" }, { 0x9000, "exif:ExifVersion" }, { 0x9003, "exif:DateTimeOriginal" }, { 0x9004, "exif:DateTimeDigitized" }, { 0x9010, "exif:OffsetTime" }, { 0x9011, "exif:OffsetTimeOriginal" }, { 0x9012, "exif:OffsetTimeDigitized" }, { 0x9101, "exif:ComponentsConfiguration" }, { 0x9102, "exif:CompressedBitsPerPixel" }, { 0x9201, "exif:ShutterSpeedValue" }, { 0x9202, "exif:ApertureValue" }, { 0x9203, "exif:BrightnessValue" }, { 0x9204, "exif:ExposureBiasValue" }, { 0x9205, "exif:MaxApertureValue" }, { 0x9206, "exif:SubjectDistance" }, { 0x9207, "exif:MeteringMode" }, { 0x9208, "exif:LightSource" }, { 0x9209, "exif:Flash" }, { 0x920a, "exif:FocalLength" }, { 0x920b, "exif:FlashEnergy" }, { 0x920c, "exif:SpatialFrequencyResponse" }, { 0x920d, "exif:Noise" }, { 0x9214, "exif:SubjectArea" }, { 0x9290, "exif:SubSecTime" }, { 0x9291, "exif:SubSecTimeOriginal" }, { 0x9292, "exif:SubSecTimeDigitized" }, { 0x9211, "exif:ImageNumber" }, { 0x9212, "exif:SecurityClassification" }, { 0x9213, "exif:ImageHistory" }, { 0x9214, "exif:SubjectArea" }, { 0x9215, "exif:ExposureIndex" }, { 0x9216, "exif:TIFF-EPStandardID" }, { 0x927c, "exif:MakerNote" }, { 0x9286, "exif:UserComment" }, { 0x9290, "exif:SubSecTime" }, { 0x9291, "exif:SubSecTimeOriginal" }, { 0x9292, "exif:SubSecTimeDigitized" }, { 0x9400, "exif:Temperature" }, { 0x9401, "exif:Humidity" }, { 0x9402, "exif:Pressure" }, { 0x9403, "exif:WaterDepth" }, { 0x9404, "exif:Acceleration" }, { 0x9405, "exif:CameraElevationAngle" }, { 0x9C9b, "exif:WinXP-Title" }, { 0x9C9c, "exif:WinXP-Comments" }, { 0x9C9d, "exif:WinXP-Author" }, { 0x9C9e, "exif:WinXP-Keywords" }, { 0x9C9f, "exif:WinXP-Subject" }, { 0xa000, "exif:FlashPixVersion" }, { 0xa001, "exif:ColorSpace" }, { 0xa002, "exif:PixelXDimension" }, { 0xa003, "exif:PixelYDimension" }, { 0xa004, "exif:RelatedSoundFile" }, { 0xa005, "exif:InteroperabilityOffset" }, { 0xa20b, "exif:FlashEnergy" }, { 0xa20c, "exif:SpatialFrequencyResponse" }, { 0xa20d, "exif:Noise" }, { 0xa20e, "exif:FocalPlaneXResolution" }, { 0xa20f, "exif:FocalPlaneYResolution" }, { 0xa210, "exif:FocalPlaneResolutionUnit" }, { 0xa214, "exif:SubjectLocation" }, { 0xa215, "exif:ExposureIndex" }, { 0xa216, "exif:TIFF/EPStandardID" }, { 0xa217, "exif:SensingMethod" }, { 0xa300, "exif:FileSource" }, { 0xa301, "exif:SceneType" }, { 0xa302, "exif:CFAPattern" }, { 0xa401, "exif:CustomRendered" }, { 0xa402, "exif:ExposureMode" }, { 0xa403, "exif:WhiteBalance" }, { 0xa404, "exif:DigitalZoomRatio" }, { 0xa405, "exif:FocalLengthIn35mmFilm" }, { 0xa406, "exif:SceneCaptureType" }, { 0xa407, "exif:GainControl" }, { 0xa408, "exif:Contrast" }, { 0xa409, "exif:Saturation" }, { 0xa40a, "exif:Sharpness" }, { 0xa40b, "exif:DeviceSettingDescription" }, { 0xa40c, "exif:SubjectDistanceRange" }, { 0xa420, "exif:ImageUniqueID" }, { 0xa430, "exif:CameraOwnerName" }, { 0xa431, "exif:BodySerialNumber" }, { 0xa432, "exif:LensSpecification" }, { 0xa433, "exif:LensMake" }, { 0xa434, "exif:LensModel" }, { 0xa435, "exif:LensSerialNumber" }, { 0xc4a5, "exif:PrintImageMatching" }, { 0xa500, "exif:Gamma" }, { 0xc640, "exif:CR2Slice" }, { 0x10000, "exif:GPSVersionID" }, { 0x10001, "exif:GPSLatitudeRef" }, { 0x10002, "exif:GPSLatitude" }, { 0x10003, "exif:GPSLongitudeRef" }, { 0x10004, "exif:GPSLongitude" }, { 0x10005, "exif:GPSAltitudeRef" }, { 0x10006, "exif:GPSAltitude" }, { 0x10007, "exif:GPSTimeStamp" }, { 0x10008, "exif:GPSSatellites" }, { 0x10009, "exif:GPSStatus" }, { 0x1000a, "exif:GPSMeasureMode" }, { 0x1000b, "exif:GPSDop" }, { 0x1000c, "exif:GPSSpeedRef" }, { 0x1000d, "exif:GPSSpeed" }, { 0x1000e, "exif:GPSTrackRef" }, { 0x1000f, "exif:GPSTrack" }, { 0x10010, "exif:GPSImgDirectionRef" }, { 0x10011, "exif:GPSImgDirection" }, { 0x10012, "exif:GPSMapDatum" }, { 0x10013, "exif:GPSDestLatitudeRef" }, { 0x10014, "exif:GPSDestLatitude" }, { 0x10015, "exif:GPSDestLongitudeRef" }, { 0x10016, "exif:GPSDestLongitude" }, { 0x10017, "exif:GPSDestBearingRef" }, { 0x10018, "exif:GPSDestBearing" }, { 0x10019, "exif:GPSDestDistanceRef" }, { 0x1001a, "exif:GPSDestDistance" }, { 0x1001b, "exif:GPSProcessingMethod" }, { 0x1001c, "exif:GPSAreaInformation" }, { 0x1001d, "exif:GPSDateStamp" }, { 0x1001e, "exif:GPSDifferential" }, { 0x1001f, "exif:GPSHPositioningError" }, { 0x00000, "" } }; /* http://www.cipa.jp/std/documents/e/DC-008-Translation-2016-E.pdf */ const StringInfo *profile; const unsigned char *directory, *exif; DirectoryInfo directory_stack[MaxDirectoryStack]; EndianType endian; MagickBooleanType status; ssize_t i; size_t entry, length, number_entries, tag, tag_value; SplayTreeInfo *exif_resources; ssize_t all, id, level, offset, tag_offset; static int tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8}; /* If EXIF data exists, then try to parse the request for a tag. */ profile=GetImageProfile(image,"exif"); if (profile == (const StringInfo *) NULL) return(MagickFalse); if ((property == (const char *) NULL) || (*property == '\0')) return(MagickFalse); while (isspace((int) ((unsigned char) *property)) != 0) property++; if (strlen(property) <= 5) return(MagickFalse); all=0; tag=(~0UL); switch (*(property+5)) { case '*': { /* Caller has asked for all the tags in the EXIF data. */ tag=0; all=1; /* return the data in description=value format */ break; } case '!': { tag=0; all=2; /* return the data in tagid=value format */ break; } case '#': case '@': { int c; size_t n; /* Check for a hex based tag specification first. */ tag=(*(property+5) == '@') ? 1UL : 0UL; property+=6; n=strlen(property); if (n != 4) return(MagickFalse); /* Parse tag specification as a hex number. */ n/=4; do { for (i=(ssize_t) n-1L; i >= 0; i--) { c=(*property++); tag<<=4; if ((c >= '0') && (c <= '9')) tag|=(c-'0'); else if ((c >= 'A') && (c <= 'F')) tag|=(c-('A'-10)); else if ((c >= 'a') && (c <= 'f')) tag|=(c-('a'-10)); else return(MagickFalse); } } while (*property != '\0'); break; } default: { /* Try to match the text with a tag name instead. */ for (i=0; ; i++) { if (EXIFTag[i].tag == 0) break; if (LocaleCompare(EXIFTag[i].description,property) == 0) { tag=(size_t) EXIFTag[i].tag; break; } } break; } } if (tag == (~0UL)) return(MagickFalse); length=GetStringInfoLength(profile); if (length < 6) return(MagickFalse); exif=GetStringInfoDatum(profile); while (length != 0) { if (ReadPropertyByte(&exif,&length) != 0x45) continue; if (ReadPropertyByte(&exif,&length) != 0x78) continue; if (ReadPropertyByte(&exif,&length) != 0x69) continue; if (ReadPropertyByte(&exif,&length) != 0x66) continue; if (ReadPropertyByte(&exif,&length) != 0x00) continue; if (ReadPropertyByte(&exif,&length) != 0x00) continue; break; } if (length < 16) return(MagickFalse); id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif); endian=LSBEndian; if (id == 0x4949) endian=LSBEndian; else if (id == 0x4D4D) endian=MSBEndian; else return(MagickFalse); if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a) return(MagickFalse); /* This the offset to the first IFD. */ offset=(ssize_t) ReadPropertySignedLong(endian,exif+4); if ((offset < 0) || (size_t) offset >= length) return(MagickFalse); /* Set the pointer to the first IFD and follow it were it leads. */ status=MagickFalse; directory=exif+offset; level=0; entry=0; tag_offset=0; exif_resources=NewSplayTree((int (*)(const void *,const void *)) NULL, (void *(*)(void *)) NULL,(void *(*)(void *)) NULL); do { /* If there is anything on the stack then pop it off. */ if (level > 0) { level--; directory=directory_stack[level].directory; entry=directory_stack[level].entry; tag_offset=directory_stack[level].offset; } if ((directory < exif) || (directory > (exif+length-2))) break; /* Determine how many entries there are in the current IFD. */ number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory); for ( ; entry < number_entries; entry++) { unsigned char *p, *q; size_t format; ssize_t number_bytes, components; q=(unsigned char *) (directory+(12*entry)+2); if (q > (exif+length-12)) break; /* corrupt EXIF */ if (GetValueFromSplayTree(exif_resources,q) == q) break; (void) AddValueToSplayTree(exif_resources,q,q); tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset; format=(size_t) ReadPropertyUnsignedShort(endian,q+2); if (format >= (sizeof(tag_bytes)/sizeof(*tag_bytes))) break; if (format == 0) break; /* corrupt EXIF */ components=(ssize_t) ReadPropertySignedLong(endian,q+4); if (components < 0) break; /* corrupt EXIF */ number_bytes=(size_t) components*tag_bytes[format]; if (number_bytes < components) break; /* prevent overflow */ if (number_bytes <= 4) p=q+8; else { ssize_t dir_offset; /* The directory entry contains an offset. */ dir_offset=(ssize_t) ReadPropertySignedLong(endian,q+8); if ((dir_offset < 0) || (size_t) dir_offset >= length) continue; if (((size_t) dir_offset+number_bytes) < (size_t) dir_offset) continue; /* prevent overflow */ if (((size_t) dir_offset+number_bytes) > length) continue; p=(unsigned char *) (exif+dir_offset); } if ((all != 0) || (tag == (size_t) tag_value)) { char buffer[MaxTextExtent], *value; if ((p < exif) || (p > (exif+length-tag_bytes[format]))) break; value=(char *) NULL; *buffer='\0'; switch (format) { case EXIF_FMT_BYTE: case EXIF_FMT_UNDEFINED: { value=(char *) NULL; if (~((size_t) number_bytes) >= 1) value=(char *) AcquireQuantumMemory((size_t) number_bytes+1UL, sizeof(*value)); if (value != (char *) NULL) { for (i=0; i < (ssize_t) number_bytes; i++) { value[i]='.'; if (isprint((int) p[i]) != 0) value[i]=(char) p[i]; } value[i]='\0'; } break; } case EXIF_FMT_SBYTE: { EXIFMultipleValues(1,"%.20g",(double) (*(signed char *) p1)); break; } case EXIF_FMT_SSHORT: { EXIFMultipleValues(2,"%hd",ReadPropertySignedShort(endian,p1)); break; } case EXIF_FMT_USHORT: { EXIFMultipleValues(2,"%hu",ReadPropertyUnsignedShort(endian,p1)); break; } case EXIF_FMT_ULONG: { EXIFMultipleValues(4,"%.20g",(double) ReadPropertyUnsignedLong(endian,p1)); break; } case EXIF_FMT_SLONG: { EXIFMultipleValues(4,"%.20g",(double) ReadPropertySignedLong(endian,p1)); break; } case EXIF_FMT_URATIONAL: { EXIFMultipleFractions(8,"%.20g/%.20g",(double) ReadPropertyUnsignedLong(endian,p1),(double) ReadPropertyUnsignedLong(endian,p1+4)); break; } case EXIF_FMT_SRATIONAL: { EXIFMultipleFractions(8,"%.20g/%.20g",(double) ReadPropertySignedLong(endian,p1),(double) ReadPropertySignedLong(endian,p1+4)); break; } case EXIF_FMT_SINGLE: { EXIFMultipleValues(4,"%f",(double) *(float *) p1); break; } case EXIF_FMT_DOUBLE: { EXIFMultipleValues(8,"%f",*(double *) p1); break; } case EXIF_FMT_STRING: default: { if ((p < exif) || (p > (exif+length-number_bytes))) break; value=(char *) NULL; if (~((size_t) number_bytes) >= 1) value=(char *) AcquireQuantumMemory((size_t) number_bytes+1UL, sizeof(*value)); if (value != (char *) NULL) { ssize_t i; for (i=0; i < (ssize_t) number_bytes; i++) { value[i]='.'; if ((isprint((int) p[i]) != 0) || (p[i] == '\0')) value[i]=(char) p[i]; } value[i]='\0'; } break; } } if (value != (char *) NULL) { char *key; const char *p; key=AcquireString(property); switch (all) { case 1: { const char *description; ssize_t i; description="unknown"; for (i=0; ; i++) { if (EXIFTag[i].tag == 0) break; if (EXIFTag[i].tag == tag_value) { description=EXIFTag[i].description; break; } } (void) FormatLocaleString(key,MaxTextExtent,"%s", description); if (level == 2) (void) SubstituteString(&key,"exif:","exif:thumbnail:"); break; } case 2: { if (tag_value < 0x10000) (void) FormatLocaleString(key,MaxTextExtent,"#%04lx", (unsigned long) tag_value); else if (tag_value < 0x20000) (void) FormatLocaleString(key,MaxTextExtent,"@%04lx", (unsigned long) (tag_value & 0xffff)); else (void) FormatLocaleString(key,MaxTextExtent,"unknown"); break; } default: { if (level == 2) (void) SubstituteString(&key,"exif:","exif:thumbnail:"); } } p=(const char *) NULL; if (image->properties != (void *) NULL) p=(const char *) GetValueFromSplayTree((SplayTreeInfo *) image->properties,key); if (p == (const char *) NULL) (void) SetImageProperty((Image *) image,key,value); value=DestroyString(value); key=DestroyString(key); status=MagickTrue; } } if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET) || (tag_value == TAG_GPS_OFFSET)) { ssize_t offset; offset=(ssize_t) ReadPropertySignedLong(endian,p); if (((size_t) offset < length) && (level < (MaxDirectoryStack-2))) { ssize_t tag_offset1; tag_offset1=(ssize_t) ((tag_value == TAG_GPS_OFFSET) ? 0x10000 : 0); directory_stack[level].directory=directory; entry++; directory_stack[level].entry=entry; directory_stack[level].offset=tag_offset; level++; /* Check for duplicate tag. */ for (i=0; i < level; i++) if (directory_stack[i].directory == (exif+tag_offset1)) break; if (i < level) break; /* duplicate tag */ directory_stack[level].directory=exif+offset; directory_stack[level].offset=tag_offset1; directory_stack[level].entry=0; level++; if ((directory+2+(12*number_entries)+4) > (exif+length)) break; offset=(ssize_t) ReadPropertySignedLong(endian,directory+2+(12* number_entries)); if ((offset != 0) && ((size_t) offset < length) && (level < (MaxDirectoryStack-2))) { directory_stack[level].directory=exif+offset; directory_stack[level].entry=0; directory_stack[level].offset=tag_offset1; level++; } } break; } } } while (level > 0); exif_resources=DestroySplayTree(exif_resources); return(status); }
1
314,510
static void parse_connection_info(pj_scanner *scanner, pjmedia_sdp_conn *conn, volatile parse_context *ctx) { ctx->last_error = PJMEDIA_SDP_EINCONN; /* c= */ pj_scan_advance_n(scanner, 2, SKIP_WS); /* network-type */ pj_scan_get_until_ch(scanner, ' ', &conn->net_type); pj_scan_get_char(scanner); /* addr-type */ pj_scan_get_until_ch(scanner, ' ', &conn->addr_type); pj_scan_get_char(scanner); /* address. */ pj_scan_get_until_chr(scanner, "/ \t\r\n", &conn->addr); PJ_TODO(PARSE_SDP_CONN_ADDRESS_SUBFIELDS); /* We've got what we're looking for, skip anything until newline */ pj_scan_skip_line(scanner); }
0
217,176
static void do_viewlog(HttpRequest req, HttpResponse res) { if (is_readonly(req)) { send_error(req, res, SC_FORBIDDEN, "You do not have sufficient privileges to access this page"); return; } do_head(res, "_viewlog", "View log", 100); if ((Run.flags & Run_Log) && ! (Run.flags & Run_UseSyslog)) { FILE *f = fopen(Run.files.log, "r"); if (f) { size_t n; char buf[512]; StringBuffer_append(res->outputbuffer, "<br><p><form><textarea cols=120 rows=30 readonly>"); while ((n = fread(buf, sizeof(char), sizeof(buf) - 1, f)) > 0) { buf[n] = 0; StringBuffer_append(res->outputbuffer, "%s", buf); } fclose(f); StringBuffer_append(res->outputbuffer, "</textarea></form>"); } else { StringBuffer_append(res->outputbuffer, "Error opening logfile: %s", STRERROR); } } else { StringBuffer_append(res->outputbuffer, "<b>Cannot view logfile:</b><br>"); if (! (Run.flags & Run_Log)) StringBuffer_append(res->outputbuffer, "Monit was started without logging"); else StringBuffer_append(res->outputbuffer, "Monit uses syslog"); } do_foot(res); }
1