Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Chromium | third_party/libwebp/src/mux/muxinternal.c |
uint8_t *MuxEmitRiffHeader(uint8_t *const data, size_t size) {
PutLE32(data + 0, MKFOURCC('R', 'I', 'F', 'F'));
PutLE32(data + TAG_SIZE, (uint32_t)size - CHUNK_HEADER_SIZE);
assert(size == (uint32_t)size);
PutLE32(data + TAG_SIZE + CHUNK_SIZE_BYTES, MKFOURCC('W', 'E', 'B', 'P'));
return data + RIFF_HEADER_SI... | [
0,
0
] |
Chromium | third_party/libwebp/src/mux/muxread.c | int MuxImageFinalize(WebPMuxImage *const wpi) {
const WebPChunk *const img = wpi->img_;
const WebPData *const image = &img->data_;
const int is_lossless = (img->tag_ == kChunks[IDX_VP8L].tag);
int w, h;
int vp8l_has_alpha = 0;
const int ok =
is_lossless
? VP8LGetInfo(image->bytes, image->siz... | [
1,
0
] |
Chromium | third_party/libwebp/src/mux/muxread.c |
WebPMuxError WebPMuxGetCanvasSize(const WebPMux *mux, int *width, int *height) {
if (mux == NULL || width == NULL || height == NULL) {
return WEBP_MUX_INVALID_ARGUMENT;
}
return MuxGetCanvasInfo(mux, width, height, NULL);
} | [
1,
0
] |
Chromium | third_party/libwebp/src/mux/muxread.c | static int CountChunks(const WebPChunk *const chunk_list, uint32_t tag) {
int count = 0;
const WebPChunk *current;
for (current = chunk_list; current != NULL; current = current->next_) {
if (tag == NIL_TAG || current->tag_ == tag) {
count++;
}
}
return count;
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_reader_utils.c |
void VP8RemapBitReader(VP8BitReader *const br, ptrdiff_t offset) {
if (br->buf_ != NULL) {
br->buf_ += offset;
br->buf_end_ += offset;
br->buf_max_ += offset;
}
} | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/bit_reader_utils.c | void VP8LoadFinalBytes(VP8BitReader *const br) {
assert(br != NULL && br->buf_ != NULL);
if (br->buf_ < br->buf_end_) {
br->bits_ += 8;
br->value_ = (bit_t)(*br->buf_++) | (br->value_ << 8);
} else if (!br->eof_) {
br->value_ <<= 8;
br->bits_ += 8;
br->eof_ = 1;
} else {
br->bits_ = 0; ... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_reader_utils.c | void VP8LInitBitReader(VP8LBitReader *const br, const uint8_t *const start,
size_t length) {
size_t i;
vp8l_val_t value = 0;
assert(br != NULL);
assert(start != NULL);
assert(length < 0xfffffff8u);
br->len_ = length;
br->val_ = 0;
br->bit_pos_ = 0;
br->eos_ = 0;
if (length >... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_reader_utils.c | void VP8LBitReaderSetBuffer(VP8LBitReader *const br, const uint8_t *const buf,
size_t len) {
assert(br != NULL);
assert(buf != NULL);
assert(len < 0xfffffff8u);
br->buf_ = buf;
br->len_ = len;
// pos_ > len_ should be considered a param error.
br->eos_ = (br->pos_ > br->len_) |... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_reader_utils.c | static void PrintBitTraces(void) {
int i;
int scale = 1;
int total = 0;
const char *units = "bits";
#if (BITTRACE == 2)
scale = 8;
units = "bytes";
#endif
for (i = 0; i < last_label; ++i)
total += kLabels[i].size;
if (total < 1)
total = 1;
printf("=== Bit traces ===\n");
for (i = 0; i < last... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_reader_utils.c | void BitTrace(const struct VP8BitReader *const br, const char label[]) {
int i, pos;
if (!init_done) {
memset(kLabels, 0, sizeof(kLabels));
atexit(PrintBitTraces);
buf_start = br->buf_;
init_done = 1;
}
pos = (int)(br->buf_ - buf_start) * 8 - br->bits_;
if (abs(pos - last_pos) > 32) {
buf... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c | int VP8PutBit(VP8BitWriter *const bw, int bit, int prob) {
const int split = (bw->range_ * prob) >> 8;
if (bit) {
bw->value_ += split + 1;
bw->range_ -= split + 1;
} else {
bw->range_ = split;
}
if (bw->range_ < 127) {
const int shift = kNorm[bw->range_];
bw->range_ = kNewRange[bw->range_]... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c |
void VP8PutSignedBits(VP8BitWriter *const bw, int value, int nb_bits) {
if (!VP8PutBitUniform(bw, value != 0))
return;
if (value < 0) {
VP8PutBits(bw, ((-value) << 1) | 1, nb_bits + 1);
} else {
VP8PutBits(bw, value << 1, nb_bits + 1);
}
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c | int VP8BitWriterAppend(VP8BitWriter *const bw, const uint8_t *data,
size_t size) {
assert(data != NULL);
if (bw->nb_bits_ != -8)
return 0;
if (!BitWriterResize(bw, size))
return 0;
memcpy(bw->buf_ + bw->pos_, data, size);
bw->pos_ += size;
return 1;
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c | void VP8BitWriterWipeOut(VP8BitWriter *const bw) {
if (bw != NULL) {
WebPSafeFree(bw->buf_);
memset(bw, 0, sizeof(*bw));
}
}
// VP8LBitWriter
// This is the minimum amount of size the memory buffer is guaranteed to grow
// when extra space is needed. | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c | static int VP8LBitWriterResize(VP8LBitWriter *const bw, size_t extra_size) {
uint8_t *allocated_buf;
size_t allocated_size;
const size_t max_bytes = bw->end_ - bw->buf_;
const size_t current_size = bw->cur_ - bw->buf_;
const uint64_t size_required_64b = (uint64_t)current_size + extra_size;
const size_t size... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c |
int VP8LBitWriterInit(VP8LBitWriter *const bw, size_t expected_size) {
memset(bw, 0, sizeof(*bw));
return VP8LBitWriterResize(bw, expected_size);
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c |
void VP8LBitWriterReset(const VP8LBitWriter *const bw_init,
VP8LBitWriter *const bw) {
bw->bits_ = bw_init->bits_;
bw->used_ = bw_init->used_;
bw->cur_ = bw->buf_ + (bw_init->cur_ - bw_init->buf_);
assert(bw->cur_ <= bw->end_);
bw->error_ = bw_init->error_;
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c | void VP8LPutBitsFlushBits(VP8LBitWriter *const bw) {
if (bw->cur_ + VP8L_WRITER_BYTES > bw->end_) {
const uint64_t extra_size = (bw->end_ - bw->buf_) + MIN_EXTRA_SIZE;
if (extra_size != (size_t)extra_size ||
!VP8LBitWriterResize(bw, (size_t)extra_size)) {
bw->cur_ = bw->buf_;
bw->error_ =... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/bit_writer_utils.c | uint8_t *VP8LBitWriterFinish(VP8LBitWriter *const bw) {
if (VP8LBitWriterResize(bw, (bw->used_ + 7) >> 3)) {
while (bw->used_ > 0) {
*bw->cur_++ = (uint8_t)bw->bits_;
bw->bits_ >>= 8;
bw->used_ -= 8;
}
bw->used_ = 0;
}
return bw->buf_;
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/color_cache_utils.c | int VP8LColorCacheInit(VP8LColorCache *const cc, int hash_bits) {
const int hash_size = 1 << hash_bits;
assert(cc != NULL);
assert(hash_bits > 0);
cc->colors_ =
(uint32_t *)WebPSafeCalloc((uint64_t)hash_size, sizeof(*cc->colors_));
if (cc->colors_ == NULL)
return 0;
cc->hash_shift_ = 32 - hash_bit... | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/color_cache_utils.c |
void VP8LColorCacheClear(VP8LColorCache *const cc) {
if (cc != NULL) {
WebPSafeFree(cc->colors_);
cc->colors_ = NULL;
}
} | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/filters_utils.c | static WEBP_INLINE int GradientPredictor(uint8_t a, uint8_t b, uint8_t c) {
const int g = a + b - c;
return ((g & ~0xff) == 0) ? g : (g < 0) ? 0 : 255;
} | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/huffman_encode_utils.c | static int ValuesShouldBeCollapsedToStrideAverage(int a, int b) {
return abs(a - b) < 4;
} | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/huffman_encode_utils.c |
static void SetBitDepths(const HuffmanTree *const tree,
const HuffmanTree *const pool,
uint8_t *const bit_depths, int level) {
if (tree->pool_index_left_ >= 0) {
SetBitDepths(&pool[tree->pool_index_left_], pool, bit_depths, level + 1);
SetBitDepths(&pool[tree... | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/huffman_encode_utils.c | static HuffmanTreeToken *CodeRepeatedValues(int repetitions,
HuffmanTreeToken *tokens, int value,
int prev_value) {
assert(value <= MAX_ALLOWED_CODE_LENGTH);
if (value != prev_value) {
tokens->code = value;
tokens->extra... | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/huffman_encode_utils.c | static void ConvertBitDepthsToSymbols(HuffmanTreeCode *const tree) {
int i;
int len;
uint32_t next_code[MAX_ALLOWED_CODE_LENGTH + 1];
int depth_count[MAX_ALLOWED_CODE_LENGTH + 1] = {0};
assert(tree != NULL);
len = tree->num_symbols;
for (i = 0; i < len; ++i) {
const int code_length = tree->code_leng... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/huffman_utils.c |
void VP8LHtreeGroupsFree(HTreeGroup *const htree_groups) {
if (htree_groups != NULL) {
WebPSafeFree(htree_groups);
}
} | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/quant_levels_dec_utils.c | static void ApplyFilter(SmoothParams *const p) {
const uint16_t *const average = p->average_;
const int w = p->width_;
const int16_t *const correction = p->correction_;
#if defined(USE_DITHERING)
const uint8_t *const dither = kOrderedDither[p->row_ % DSIZE];
#endif
uint8_t *const dst = p->dst_;
int x;
for... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/quant_levels_dec_utils.c | static void CountLevels(SmoothParams *const p) {
int i, j, last_level;
uint8_t used_levels[256] = {0};
const uint8_t *data = p->src_;
p->min_ = 255;
p->max_ = 0;
for (j = 0; j < p->height_; ++j) {
for (i = 0; i < p->width_; ++i) {
const int v = data[i];
if (v < p->min_)
p->min_ = v;
... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/quant_levels_dec_utils.c |
static void CleanupParams(SmoothParams *const p) { WebPSafeFree(p->mem_); } | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/quant_levels_dec_utils.c | int WebPDequantizeLevels(uint8_t *const data, int width, int height, int stride,
int strength) {
int radius = 4 * strength / 100;
if (strength < 0 || strength > 100)
return 0;
if (data == NULL || width <= 0 || height <= 0)
return 0;
// limit the filter size to not exceed the i... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/random_utils.c |
void VP8InitRandom(VP8Random *const rg, float dithering) {
memcpy(rg->tab_, kRandomTable, sizeof(rg->tab_));
rg->index1_ = 0;
rg->index2_ = 31;
rg->amp_ = (dithering < 0.0) ? 0
: (dithering > 1.0)
? (1 << VP8_RANDOM_DITHER_FIX)
: (uint32_t)((1 << VP8_RANDOM_DITHER... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/rescaler_utils.c | int WebPRescalerGetScaledDimensions(int src_width, int src_height,
int *const scaled_width,
int *const scaled_height) {
assert(scaled_width != NULL);
assert(scaled_height != NULL);
{
int width = *scaled_width;
int height = *scaled_hei... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/rescaler_utils.c | int WebPRescalerImport(WebPRescaler *const wrk, int num_lines,
const uint8_t *src, int src_stride) {
int total_imported = 0;
while (total_imported < num_lines && !WebPRescalerHasPendingOutput(wrk)) {
if (wrk->y_expand) {
rescaler_t *const tmp = wrk->irow;
wrk->irow = wrk->frow... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c |
static int pthread_mutex_destroy(pthread_mutex_t *const mutex) {
DeleteCriticalSection(mutex);
return 0;
} | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c | static int pthread_cond_destroy(pthread_cond_t *const condition) {
int ok = 1;
#ifdef USE_WINDOWS_CONDITION_VARIABLE
(void)condition;
#else
ok &= (CloseHandle(condition->waiting_sem_) != 0);
ok &= (CloseHandle(condition->received_sem_) != 0);
ok &= (CloseHandle(condition->signal_event_) != 0);
#endif
return... | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c | static THREADFN ThreadLoop(void *ptr) {
WebPWorker *const worker = (WebPWorker *)ptr;
WebPWorkerImpl *const impl = (WebPWorkerImpl *)worker->impl_;
int done = 0;
while (!done) {
pthread_mutex_lock(&impl->mutex_);
while (worker->status_ == OK) {
pthread_cond_wait(&impl->condition_, &impl->mutex_);
... | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c | static void ChangeState(WebPWorker *const worker, WebPWorkerStatus new_status) {
// Checking status_ without acquiring the lock first would result in a data
// race.
WebPWorkerImpl *const impl = (WebPWorkerImpl *)worker->impl_;
if (impl == NULL)
return;
pthread_mutex_lock(&impl->mutex_);
if (worker->s... | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c | static void Init(WebPWorker *const worker) {
memset(worker, 0, sizeof(*worker));
worker->status_ = NOT_OK;
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c |
static int Reset(WebPWorker *const worker) {
int ok = 1;
worker->had_error = 0;
if (worker->status_ < OK) {
#ifdef WEBP_USE_THREAD
WebPWorkerImpl *const impl =
(WebPWorkerImpl *)WebPSafeCalloc(1, sizeof(WebPWorkerImpl));
worker->impl_ = (void *)impl;
if (worker->impl_ == NULL) {
return ... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c |
static void End(WebPWorker *const worker) {
#ifdef WEBP_USE_THREAD
if (worker->impl_ != NULL) {
WebPWorkerImpl *const impl = (WebPWorkerImpl *)worker->impl_;
ChangeState(worker, NOT_OK);
pthread_join(impl->thread_, NULL);
pthread_mutex_destroy(&impl->mutex_);
pthread_cond_destroy(&impl->condition... | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/thread_utils.c |
int WebPSetWorkerInterface(const WebPWorkerInterface *const winterface) {
if (winterface == NULL || winterface->Init == NULL ||
winterface->Reset == NULL || winterface->Sync == NULL ||
winterface->Launch == NULL || winterface->Execute == NULL ||
winterface->End == NULL) {
return 0;
}
g_work... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/utils.c |
static void PrintMemInfo(void) {
fprintf(stderr, "\nMEMORY INFO:\n");
fprintf(stderr, "num calls to: malloc = %4d\n", num_malloc_calls);
fprintf(stderr, " calloc = %4d\n", num_calloc_calls);
fprintf(stderr, " free = %4d\n", num_free_calls);
fprintf(stderr, "total_mem: %u\n", (uint... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/utils.c | static void SubMem(void *ptr) {
if (ptr != NULL) {
MemBlock **b = &all_blocks;
while (*b != NULL && (*b)->ptr_ != ptr)
b = &(*b)->next_;
if (*b == NULL) {
fprintf(stderr, "Invalid pointer free! (%p)\n", ptr);
abort();
}
{
MemBlock *const block = *b;
*b = block->next_... | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/utils.c |
void *WebPSafeCalloc(uint64_t nmemb, size_t size) {
void *ptr;
Increment(&num_calloc_calls);
if (!CheckSizeArgumentsOverflow(nmemb, size))
return NULL;
assert(nmemb * size > 0);
ptr = calloc((size_t)nmemb, size);
AddMem(ptr, (size_t)(nmemb * size));
return ptr;
} | [
1,
0
] |
Chromium | third_party/libwebp/src/utils/utils.c |
void WebPFree(void *ptr) { WebPSafeFree(ptr); } | [
0,
0
] |
Chromium | third_party/libwebp/src/utils/utils.c | void WebPCopyPlane(const uint8_t *src, int src_stride, uint8_t *dst,
int dst_stride, int width, int height) {
assert(src != NULL && dst != NULL);
assert(abs(src_stride) >= width && abs(dst_stride) >= width);
while (height-- > 0) {
memcpy(dst, src, width);
src += src_stride;
dst += d... | [
1,
0
] |
Chromium | third_party/libwebp/tests/fuzzer/fuzz_utils.h |
static WEBP_INLINE void
ExtractAndDisableOptimizations(VP8CPUInfo default_VP8GetCPUInfo,
const uint8_t data[], size_t size,
uint32_t *const bit_pos) {
GetCPUInfo = default_VP8GetCPUInfo;
const VP8CPUInfo kVP8CPUInfos[5] = {GetCPUInfoOnlyC, GetCPUInfoFor... | [
0,
0
] |
Chromium | third_party/libx11/src/xkb/XKBBind.c | uint8_t AdjustGroup(uint8_t group, uint8_t group_info) {
const uint8_t n_groups = group_info & 0x0f;
const uint8_t out_of_range_group = (group_info & 0x30) >> 4;
const auto groups_wrap = static_cast<Xkb::GroupsWrap>(group_info & 0xc0);
if (group < n_groups)
return group;
switch (groups_wrap) {
case Xk... | [
1,
0
] |
Chromium | third_party/libxml/src/buf.c | int xmlBufGetAllocationScheme(xmlBufPtr buf) {
if (buf == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufGetAllocationScheme: buf == NULL\n");
#endif
return (-1);
}
return (buf->alloc);
} | [
0,
0
] |
Chromium | third_party/libxml/src/buf.c | int xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme) {
if ((buf == NULL) || (buf->error != 0)) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufSetAllocationScheme: buf == NULL or in error\n");
#endif
return (-1);
}
if ((buf->alloc == XML_B... | [
1,
0
] |
Chromium | third_party/libxml/src/buf.c | size_t xmlBufShrink(xmlBufPtr buf, size_t len) {
if ((buf == NULL) || (buf->error != 0))
return (0);
CHECK_COMPAT(buf)
if (len == 0)
return (0);
if (len > buf->use)
return (0);
buf->use -= len;
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf-... | [
1,
0
] |
Chromium | third_party/libxml/src/buf.c | size_t xmlBufDump(FILE *file, xmlBufPtr buf) {
size_t ret;
if ((buf == NULL) || (buf->error != 0)) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
"xmlBufDump: buf == NULL or in error\n");
#endif
return (0);
}
if (buf->content == NULL) {
#ifdef DEBUG_BUFFER
xmlGene... | [
1,
0
] |
Chromium | third_party/libxml/src/buf.c | size_t xmlBufLength(const xmlBufPtr buf) {
if ((!buf) || (buf->error))
return 0;
CHECK_COMPAT(buf)
return (buf->use);
} | [
1,
0
] |
Chromium | third_party/libxml/src/buf.c | size_t xmlBufUse(const xmlBufPtr buf) {
if ((!buf) || (buf->error))
return 0;
CHECK_COMPAT(buf)
return (buf->use);
} | [
1,
0
] |
Chromium | third_party/libxml/src/buf.c | int xmlBufWriteChar(xmlBufPtr buf, const char *string) {
if ((buf == NULL) || (buf->error))
return (-1);
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
return (-1);
return (xmlBufCCat(buf, string));
} | [
0,
0
] |
Chromium | third_party/libxml/src/buf.c | int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string) {
const xmlChar *cur, *base;
if ((buf == NULL) || (buf->error))
return (-1);
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
return (-1);
if (xmlStrchr(string, '\"')) {
if (xmlStrchr(string, '\'')) {
#ifdef DEBUG_BUF... | [
0,
0
] |
Chromium | third_party/libxml/src/buf.c | int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer) {
int ret = 0;
if ((buf == NULL) || (buf->error)) {
xmlBufferFree(buffer);
return (-1);
}
CHECK_COMPAT(buf)
if ((buffer != NULL) && (buffer->content != NULL) && (buffer->use > 0)) {
ret = xmlBufAdd(buf, buffer->content, buffer->use);
}
... | [
0,
0
] |
Chromium | third_party/libxml/src/chvalid.c | int xmlIsCombining(unsigned int ch) { return (xmlIsCombiningQ(ch)); } | [
0,
0
] |
Chromium | third_party/libxml/src/chvalid.c | int xmlIsDigit(unsigned int ch) { return (xmlIsDigitQ(ch)); } | [
0,
0
] |
Chromium | third_party/libxml/src/chvalid.c | int xmlIsExtender(unsigned int ch) { return (xmlIsExtenderQ(ch)); } | [
0,
0
] |
Chromium | third_party/libxml/src/dict.c | int xmlInitializeDict(void) { return (0); } | [
0,
0
] |
Chromium | third_party/libxml/src/dict.c | int __xmlRandom(void) {
int ret;
if (xmlDictInitialized == 0)
__xmlInitializeDict();
xmlRMutexLock(xmlDictMutex);
#ifdef HAVE_RAND_R
ret = rand_r(&rand_seed);
#else
ret = rand();
#endif
xmlRMutexUnlock(xmlDictMutex);
return (ret);
}
#endif | [
0,
0
] |
Chromium | third_party/libxml/src/dict.c | static const xmlChar *xmlDictAddString(xmlDictPtr dict, const xmlChar *name,
unsigned int namelen) {
xmlDictStringsPtr pool;
const xmlChar *ret;
size_t size = 0;
size_t limit = 0;
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "-");
#endif
pool = dict->strings;
while (p... | [
1,
0
] |
Chromium | third_party/libxml/src/dict.c | static unsigned long xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
const xmlChar *name, int len,
int seed) {
uint32_t hash;
int i;
hash = seed;
for (i = 0; i < plen; i++) {
hash += prefix[i];
hash += (hash <... | [
0,
0
] |
Chromium | third_party/libxml/src/dict.c | static unsigned long xmlDictComputeFastKey(const xmlChar *name, int namelen,
int seed) {
unsigned long value = seed;
if (name == NULL)
return (0);
value += *name;
value <<= 5;
if (namelen > 10) {
value += name[namelen - 1];
namelen = 10;
}
switch (na... | [
1,
0
] |
Chromium | third_party/libxml/src/dict.c | static unsigned long xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
const xmlChar *name, int len,
int seed) {
unsigned long value = (unsigned long)seed;
if (plen == 0)
value += 30 * (unsigned long)':';
else
v... | [
0,
0
] |
Chromium | third_party/libxml/src/dict.c | xmlDictPtr xmlDictCreate(void) {
xmlDictPtr dict;
if (!xmlDictInitialized)
if (!__xmlInitializeDict())
return (NULL);
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "C");
#endif
dict = xmlMalloc(sizeof(xmlDict));
if (dict) {
dict->ref_counter = 1;
dict->limit = 0;
dict->size = MIN_DICT_S... | [
1,
0
] |
Chromium | third_party/libxml/src/dict.c | xmlDictPtr xmlDictCreateSub(xmlDictPtr sub) {
xmlDictPtr dict = xmlDictCreate();
if ((dict != NULL) && (sub != NULL)) {
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "R");
#endif
dict->seed = sub->seed;
dict->subdict = sub;
xmlDictReference(dict->subdict);
}
return (dict);
} | [
0,
0
] |
Chromium | third_party/libxml/src/dict.c | int xmlDictReference(xmlDictPtr dict) {
if (!xmlDictInitialized)
if (!__xmlInitializeDict())
return (-1);
if (dict == NULL)
return -1;
xmlRMutexLock(xmlDictMutex);
dict->ref_counter++;
xmlRMutexUnlock(xmlDictMutex);
return (0);
} | [
0,
0
] |
Chromium | third_party/libxml/src/dict.c | int xmlDictSize(xmlDictPtr dict) {
if (dict == NULL)
return (-1);
if (dict->subdict)
return (dict->nbElems + dict->subdict->nbElems);
return (dict->nbElems);
} | [
1,
0
] |
Chromium | third_party/libxml/src/dict.c | size_t xmlDictGetUsage(xmlDictPtr dict) {
xmlDictStringsPtr pool;
size_t limit = 0;
if (dict == NULL)
return (0);
pool = dict->strings;
while (pool != NULL) {
limit += pool->size;
pool = pool->next;
}
return (limit);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | static void xmlEncodingErrMemory(const char *extra) {
__xmlSimpleError(XML_FROM_I18N, XML_ERR_NO_MEMORY, NULL, NULL, extra);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | int isolat1ToUTF8(unsigned char *out, int *outlen, const unsigned char *in,
int *inlen) {
unsigned char *outstart = out;
const unsigned char *base = in;
unsigned char *outend;
const unsigned char *inend;
const unsigned char *instop;
if ((out == NULL) || (in == NULL) || (outlen == NULL) ||... | [
1,
0
] |
Chromium | third_party/libxml/src/encoding.c | int xmlAddEncodingAlias(const char *name, const char *alias) {
int i;
char upper[100];
if ((name == NULL) || (alias == NULL))
return (-1);
for (i = 0; i < 99; i++) {
upper[i] = toupper(alias[i]);
if (upper[i] == 0)
break;
}
upper[i] = 0;
if (xmlCharEncodingAliases == NULL) {
xmlCh... | [
1,
0
] |
Chromium | third_party/libxml/src/encoding.c | static int xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out,
int *outlen, const unsigned char *in, int *inlen,
int flush) {
const char *ucv_in = (const char *)in;
char *ucv_out = (char *)out;
UErrorCode err = U_ZERO_ERROR;
if ((out == NULL) ||... | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | int xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in) {
return (xmlCharEncFirstLineInt(handler, out, in, -1));
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | int xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
int ret = 0;
int tofree = 0;
int i, handler_in_list = 0;
if (handler == NULL)
return (-1);
if (handler->name == NULL)
return (-1);
if (handlers != NULL) {
for (i = 0; i < nbCharEncodingHandler; i++) {
if (handler == handlers[i]) {... | [
1,
0
] |
Chromium | third_party/libxml/src/encoding.c | static int UTF8ToISO8859_2(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return UTF8ToISO8859x(out, outlen, in, inlen, xmltranscodetable_ISO8859_2);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c |
static int ISO8859_3ToUTF8(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return ISO8859xToUTF8(out, outlen, in, inlen, xmlunicodetable_ISO8859_3);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | static int UTF8ToISO8859_6(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return UTF8ToISO8859x(out, outlen, in, inlen, xmltranscodetable_ISO8859_6);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c |
static int ISO8859_8ToUTF8(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return ISO8859xToUTF8(out, outlen, in, inlen, xmlunicodetable_ISO8859_8);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | static int UTF8ToISO8859_8(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return UTF8ToISO8859x(out, outlen, in, inlen, xmltranscodetable_ISO8859_8);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | static int UTF8ToISO8859_9(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return UTF8ToISO8859x(out, outlen, in, inlen, xmltranscodetable_ISO8859_9);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | static int UTF8ToISO8859_10(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return UTF8ToISO8859x(out, outlen, in, inlen, xmltranscodetable_ISO8859_10);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c |
static int ISO8859_11ToUTF8(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return ISO8859xToUTF8(out, outlen, in, inlen, xmlunicodetable_ISO8859_11);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c | static int UTF8ToISO8859_13(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return UTF8ToISO8859x(out, outlen, in, inlen, xmltranscodetable_ISO8859_13);
} | [
0,
0
] |
Chromium | third_party/libxml/src/encoding.c |
static int ISO8859_16ToUTF8(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen) {
return ISO8859xToUTF8(out, outlen, in, inlen, xmlunicodetable_ISO8859_16);
} | [
0,
0
] |
Chromium | third_party/libxml/src/entities.c | static xmlEntityPtr xmlCreateEntity(xmlDictPtr dict, const xmlChar *name,
int type, const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content) {
xmlEntityPtr ret;
ret = (xmlEntityPtr)xmlMall... | [
1,
0
] |
Chromium | third_party/libxml/src/entities.c | xmlEntityPtr xmlGetPredefinedEntity(const xmlChar *name) {
if (name == NULL)
return (NULL);
switch (name[0]) {
case 'l':
if (xmlStrEqual(name, BAD_CAST "lt"))
return (&xmlEntityLt);
break;
case 'g':
if (xmlStrEqual(name, BAD_CAST "gt"))
return (&xmlEntityGt);
break;
case 'a':
... | [
0,
0
] |
Chromium | third_party/libxml/src/entities.c | xmlEntityPtr xmlNewEntity(xmlDocPtr doc, const xmlChar *name, int type,
const xmlChar *ExternalID, const xmlChar *SystemID,
const xmlChar *content) {
xmlEntityPtr ret;
xmlDictPtr dict;
if ((doc != NULL) && (doc->intSubset != NULL)) {
return (xmlAddDocEntity... | [
1,
0
] |
Chromium | third_party/libxml/src/entities.c | static void *xmlCopyEntity(void *payload,
const xmlChar *name ATTRIBUTE_UNUSED) {
xmlEntityPtr ent = (xmlEntityPtr)payload;
xmlEntityPtr cur;
cur = (xmlEntityPtr)xmlMalloc(sizeof(xmlEntity));
if (cur == NULL) {
xmlEntitiesErrMemory("xmlCopyEntity:: malloc failed");
return (NU... | [
1,
0
] |
Chromium | third_party/libxml/src/error.c | void xmlParserPrintFileInfo(xmlParserInputPtr input) {
if (input != NULL) {
if (input->filename)
xmlGenericError(xmlGenericErrorContext, "%s:%d: ", input->filename,
input->line);
else
xmlGenericError(xmlGenericErrorContext, "Entity: line %d: ", input->line);
}
} | [
0,
0
] |
Chromium | third_party/libxml/src/error.c | void XMLCDECL xmlParserValidityError(void *ctx, const char *msg, ...) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
xmlParserInputPtr input = NULL;
char *str;
int len = xmlStrlen((const xmlChar *)msg);
static int had_info = 0;
if ((len > 1) && (msg[len - 2] != ':')) {
if (ctxt != NULL) {
input... | [
1,
0
] |
Chromium | third_party/libxml/src/error.c | xmlErrorPtr xmlGetLastError(void) {
if (xmlLastError.code == XML_ERR_OK)
return (NULL);
return (&xmlLastError);
} | [
0,
0
] |
Chromium | third_party/libxml/src/error.c | xmlErrorPtr xmlCtxtGetLastError(void *ctx) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
if (ctxt == NULL)
return (NULL);
if (ctxt->lastError.code == XML_ERR_OK)
return (NULL);
return (&ctxt->lastError);
} | [
0,
0
] |
Chromium | third_party/libxml/src/error.c | void xmlCtxtResetLastError(void *ctx) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
if (ctxt == NULL)
return;
ctxt->errNo = XML_ERR_OK;
if (ctxt->lastError.code == XML_ERR_OK)
return;
xmlResetError(&ctxt->lastError);
} | [
0,
0
] |
Chromium | third_party/libxml/src/fuzz/fuzz.c | const char *xmlFuzzReadString(size_t *size) {
const char *out = fuzzData.outPtr;
while (fuzzData.remaining > 0) {
int c = *fuzzData.ptr++;
fuzzData.remaining--;
if ((c == '\\') && (fuzzData.remaining > 0)) {
int c2 = *fuzzData.ptr;
if (c2 == '\n') {
fuzzData.ptr++;
fuzzDat... | [
0,
0
] |
Chromium | third_party/libxml/src/fuzz/fuzz.c | void xmlFuzzReadEntities(void) {
size_t num = 0;
while (1) {
const char *url, *entity;
size_t urlSize, entitySize;
xmlFuzzEntityInfo *entityInfo;
url = xmlFuzzReadString(&urlSize);
if (url == NULL)
break;
entity = xmlFuzzReadString(&entitySize);
if (entity == NULL)
break;
... | [
0,
0
] |
Chromium | third_party/libxml/src/fuzz/genSeed.c |
int processXPathDir(const char *testDir) {
char pattern[PATH_SIZE];
glob_t globbuf;
size_t i, size;
int ret = 0;
globalData.counter = 1;
if (processXPath(testDir, "", "expr", "<d></d>", "expr", 0) != 0)
ret = -1;
size = snprintf(pattern, sizeof(pattern), "%s/docs/*", testDir);
if (size >= PATH_SI... | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.