processed_func string | target int64 | flaw_line string | flaw_line_index int64 | commit_url string | language class label |
|---|---|---|---|---|---|
static int proc_single_open(struct inode *inode, struct file *filp)
{
return single_open(filp, proc_single_show, inode);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/8148a73c9901a8794a50f950083c00ccf97d43b3 | 0CCPP |
MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,
ExceptionInfo *exception)
{
#define ComplexImageTag "Complex/Image"
CacheView
*Ai_view,
*Ar_view,
*Bi_view,
*Br_view,
*Ci_view,
*Cr_view;
const char
*artifact;
const Image
*Ai_image,
*Ar_image,
*Bi_image,
*Br_image;
double
snr;
Image
*Ci_image,
*complex_images,
*Cr_image,
*image;
MagickBooleanType
status;
MagickOffsetType
progress;
ssize_t
y;
assert(images != (Image *) NULL);
assert(images->signature == MagickCoreSignature);
if (images->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
if (images->next == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),ImageError,
"ImageSequenceRequired","`%s'",images->filename);
return((Image *) NULL);
}
image=CloneImage(images,0,0,MagickTrue,exception);
if (image == (Image *) NULL)
return((Image *) NULL);
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
{
image=DestroyImageList(image);
return(image);
}
image->depth=32UL;
complex_images=NewImageList();
AppendImageToList(&complex_images,image);
image=CloneImage(images,0,0,MagickTrue,exception);
if (image == (Image *) NULL)
{
complex_images=DestroyImageList(complex_images);
return(complex_images);
}
AppendImageToList(&complex_images,image);
artifact=GetImageArtifact(image,"complex:snr");
snr=0.0;
if (artifact != (const char *) NULL)
snr=StringToDouble(artifact,(char **) NULL);
Ar_image=images;
Ai_image=images->next;
Br_image=images;
Bi_image=images->next;
if ((images->next->next != (Image *) NULL) &&
(images->next->next->next != (Image *) NULL))
{
Br_image=images->next->next;
Bi_image=images->next->next->next;
}
Cr_image=complex_images;
Ci_image=complex_images->next;
Ar_view=AcquireVirtualCacheView(Ar_image,exception);
Ai_view=AcquireVirtualCacheView(Ai_image,exception);
Br_view=AcquireVirtualCacheView(Br_image,exception);
Bi_view=AcquireVirtualCacheView(Bi_image,exception);
Cr_view=AcquireAuthenticCacheView(Cr_image,exception);
Ci_view=AcquireAuthenticCacheView(Ci_image,exception);
status=MagickTrue;
progress=0;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(progress,status) \
magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L)
#endif
for (y=0; y < (ssize_t) Cr_image->rows; y++)
{
register const Quantum
*magick_restrict Ai,
*magick_restrict Ar,
*magick_restrict Bi,
*magick_restrict Br;
register Quantum
*magick_restrict Ci,
*magick_restrict Cr;
register ssize_t
x;
if (status == MagickFalse)
continue;
Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception);
Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception);
Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception);
Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception);
Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception);
Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception);
if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) ||
(Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) ||
(Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL))
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) Cr_image->columns; x++)
{
register ssize_t
i;
for (i=0; i < (ssize_t) GetPixelChannels(Cr_image); i++)
{
switch (op)
{
case AddComplexOperator:
{
Cr[i]=Ar[i]+Br[i];
Ci[i]=Ai[i]+Bi[i];
break;
}
case ConjugateComplexOperator:
default:
{
Cr[i]=Ar[i];
Ci[i]=(-Bi[i]);
break;
}
case DivideComplexOperator:
{
double
gamma;
gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr);
Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]);
Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]);
break;
}
case MagnitudePhaseComplexOperator:
{
Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]);
Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5;
break;
}
case MultiplyComplexOperator:
{
Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]);
Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]);
break;
}
case RealImaginaryComplexOperator:
{
Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5));
Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5));
break;
}
case SubtractComplexOperator:
{
Cr[i]=Ar[i]-Br[i];
Ci[i]=Ai[i]-Bi[i];
break;
}
}
}
Ar+=GetPixelChannels(Ar_image);
Ai+=GetPixelChannels(Ai_image);
Br+=GetPixelChannels(Br_image);
Bi+=GetPixelChannels(Bi_image);
Cr+=GetPixelChannels(Cr_image);
Ci+=GetPixelChannels(Ci_image);
}
if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse)
status=MagickFalse;
if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse)
status=MagickFalse;
if (images->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp atomic
#endif
progress++;
proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
Cr_view=DestroyCacheView(Cr_view);
Ci_view=DestroyCacheView(Ci_view);
Br_view=DestroyCacheView(Br_view);
Bi_view=DestroyCacheView(Bi_view);
Ar_view=DestroyCacheView(Ar_view);
Ai_view=DestroyCacheView(Ai_view);
if (status == MagickFalse)
complex_images=DestroyImageList(complex_images);
return(complex_images);
} | 1 | 120 | -1 | https://github.com/ImageMagick/ImageMagick/commit/d5089971bd792311aaab5cb73460326d7ef7f32d | 0CCPP |
static inline int armv7_pmnc_counter_has_overflowed(unsigned long pmnc,
enum armv7_counters counter)
{
int ret = 0;
if (counter == ARMV7_CYCLE_COUNTER)
ret = pmnc & ARMV7_FLAG_C;
else if ((counter >= ARMV7_COUNTER0) && (counter <= ARMV7_COUNTER_LAST))
ret = pmnc & ARMV7_FLAG_P(counter);
else
pr_err("CPU%u checking wrong counter %d overflow status\n",
smp_processor_id(), counter);
return ret;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 0CCPP |
void cgtime(struct timeval *tv)
{
gettimeofday(tv, NULL);
} | 0 | null | -1 | https://github.com/ckolivas/cgminer/commit/e1c5050734123973b99d181c45e74b2cbb00272e | 0CCPP |
static void __add_hash_entry(struct ftrace_hash *hash,
struct ftrace_func_entry *entry)
{
struct hlist_head *hhd;
unsigned long key;
if (hash->size_bits)
key = hash_long(entry->ip, hash->size_bits);
else
key = 0;
hhd = &hash->buckets[key];
hlist_add_head(&entry->hlist, hhd);
hash->count++;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/6a76f8c0ab19f215af2a3442870eeb5f0e81998d | 0CCPP |
static long ext4_zero_range(struct file *file, loff_t offset,
loff_t len, int mode)
{
struct inode *inode = file_inode(file);
handle_t *handle = NULL;
unsigned int max_blocks;
loff_t new_size = 0;
int ret = 0;
int flags;
int credits;
int partial_begin, partial_end;
loff_t start, end;
ext4_lblk_t lblk;
struct address_space *mapping = inode->i_mapping;
unsigned int blkbits = inode->i_blkbits;
trace_ext4_zero_range(inode, offset, len, mode);
if (!S_ISREG(inode->i_mode))
return -EINVAL;
if (ext4_should_journal_data(inode)) {
ret = ext4_force_commit(inode->i_sb);
if (ret)
return ret;
}
/*
* Write out all dirty pages to avoid race conditions
* Then release them.
*/
if (mapping->nrpages && mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
ret = filemap_write_and_wait_range(mapping, offset,
offset + len - 1);
if (ret)
return ret;
}
start = round_up(offset, 1 << blkbits);
end = round_down((offset + len), 1 << blkbits);
if (start < offset || end > offset + len)
return -EINVAL;
partial_begin = offset & ((1 << blkbits) - 1);
partial_end = (offset + len) & ((1 << blkbits) - 1);
lblk = start >> blkbits;
max_blocks = (end >> blkbits);
if (max_blocks < lblk)
max_blocks = 0;
else
max_blocks -= lblk;
mutex_lock(&inode->i_mutex);
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
ret = -EOPNOTSUPP;
goto out_mutex;
}
if (!(mode & FALLOC_FL_KEEP_SIZE) &&
offset + len > i_size_read(inode)) {
new_size = offset + len;
ret = inode_newsize_ok(inode, new_size);
if (ret)
goto out_mutex;
}
flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT;
if (mode & FALLOC_FL_KEEP_SIZE)
flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
if (partial_begin || partial_end) {
ret = ext4_alloc_file_blocks(file,
round_down(offset, 1 << blkbits) >> blkbits,
(round_up((offset + len), 1 << blkbits) -
round_down(offset, 1 << blkbits)) >> blkbits,
new_size, flags, mode);
if (ret)
goto out_mutex;
}
if (max_blocks > 0) {
flags |= (EXT4_GET_BLOCKS_CONVERT_UNWRITTEN |
EXT4_EX_NOCACHE);
/* Now release the pages and zero block aligned part of pages*/
truncate_pagecache_range(inode, start, end - 1);
inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
ext4_inode_block_unlocked_dio(inode);
inode_dio_wait(inode);
ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size,
flags, mode);
if (ret)
goto out_dio;
}
if (!partial_begin && !partial_end)
goto out_dio;
credits = (2 * ext4_ext_index_trans_blocks(inode, 2)) + 1;
if (ext4_should_journal_data(inode))
credits += 2;
handle = ext4_journal_start(inode, EXT4_HT_MISC, credits);
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
ext4_std_error(inode->i_sb, ret);
goto out_dio;
}
inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
if (new_size) {
ext4_update_inode_size(inode, new_size);
} else {
if ((offset + len) > i_size_read(inode))
ext4_set_inode_flag(inode, EXT4_INODE_EOFBLOCKS);
}
ext4_mark_inode_dirty(handle, inode);
ret = ext4_zero_partial_blocks(handle, inode, offset, len);
if (file->f_flags & O_SYNC)
ext4_handle_sync(handle);
ext4_journal_stop(handle);
out_dio:
ext4_inode_resume_unlocked_dio(inode);
out_mutex:
mutex_unlock(&inode->i_mutex);
return ret;
} | 1 | 13,23,24,25,26,27,28,29,30,31,32,72,73,74 | -1 | https://github.com/torvalds/linux/commit/ea3d7209ca01da209cda6f0dea8be9cc4b7a933b | 0CCPP |
port::Status CudnnSupport::DoBatchNormalizationBackwardImpl(
Stream* stream, int cudnn_input_type, int cudnn_scale_type,
const DeviceMemory<T>& y_backprop, const DeviceMemory<T>& x,
const DeviceMemory<U>& scale, const DeviceMemory<U>& mean,
const DeviceMemory<U>& inv_var, const dnn::BatchDescriptor& x_desc,
const dnn::BatchDescriptor& scale_offset_desc, const double epsilon,
DeviceMemory<T>* x_backprop, DeviceMemory<U>* scale_backprop,
DeviceMemory<U>* offset_backprop, DeviceMemory<uint8>* reserve_space_data,
ScratchAllocator* workspace_allocator) {
CudnnTensorDescriptor x_descriptor(
x_desc, static_cast<cudnnDataType_t>(cudnn_input_type));
CudnnTensorDescriptor scale_offset_descriptor(
scale_offset_desc, static_cast<cudnnDataType_t>(cudnn_scale_type));
cudnnBatchNormMode_t mode = CUDNN_BATCHNORM_SPATIAL;
if (BatchnormSpatialPersistentEnabled()) {
mode = CUDNN_BATCHNORM_SPATIAL_PERSISTENT;
}
float one = 1.0;
float zero = 0.0;
auto cudnn = cudnn_->GetHandle(parent_, stream);
bool called = false;
#if CUDNN_VERSION >= 7402
if (reserve_space_data != nullptr && workspace_allocator != nullptr) {
called = true;
const cudnnBatchNormOps_t bn_ops = CUDNN_BATCHNORM_OPS_BN;
SE_ASSIGN_OR_RETURN(DeviceMemory<uint8> workspace,
CreateBatchNormBackwardWorkspace(
stream, cudnn, mode, bn_ops, x_descriptor,
scale_offset_descriptor, workspace_allocator))
RETURN_IF_CUDNN_ERROR(cudnnBatchNormalizationBackwardEx(
cudnn.handle(),
mode,
bn_ops,
&one,
&zero,
&one,
&zero,
x_descriptor.handle(),
x.opaque(),
nullptr,
nullptr,
x_descriptor.handle(),
y_backprop.opaque(),
nullptr,
nullptr,
x_descriptor.handle(),
x_backprop->opaque(),
scale_offset_descriptor.handle(),
scale.opaque(),
nullptr,
scale_backprop->opaque(),
offset_backprop->opaque(),
epsilon,
mean.opaque(),
inv_var.opaque(),
nullptr,
workspace.opaque(),
workspace.size(),
reserve_space_data->opaque(),
reserve_space_data->size()));
}
#endif
if (!called) {
RETURN_IF_CUDNN_ERROR(cudnnBatchNormalizationBackward(
cudnn.handle(), mode, &one, &zero, &one, &zero, x_descriptor.handle(),
x.opaque(), x_descriptor.handle(), y_backprop.opaque(),
x_descriptor.handle(), x_backprop->opaque(),
scale_offset_descriptor.handle(), scale.opaque(),
scale_backprop->opaque(), offset_backprop->opaque(), epsilon,
mean.opaque(), inv_var.opaque()));
}
return port::Status::OK();
} | 0 | null | -1 | https://github.com/tensorflow/tensorflow/commit/14755416e364f17fb1870882fa778c7fec7f16e3 | 0CCPP |
snmp_oid_print(uint32_t *oid)
{
uint8_t i;
i = 0;
LOG_DBG("{");
while(oid[i] != ((uint32_t)-1)) {
LOG_DBG_("%lu", (unsigned long)oid[i]);
i++;
if(oid[i] != ((uint32_t)-1)) {
LOG_DBG_(".");
}
}
LOG_DBG_("}\n");
} | 1 | 0,1,2,3,4,5,6,7,8,9,10,11,12,13 | -1 | https://github.com/contiki-ng/contiki-ng/commit/12c824386ab60de757de5001974d73b32e19ad71 | 0CCPP |
static bool sign_set_key(struct sign_info **sign, uint8_t key[16],
bt_att_counter_func_t func, void *user_data)
{
if (!(*sign))
*sign = new0(struct sign_info, 1);
(*sign)->counter = func;
(*sign)->user_data = user_data;
memcpy((*sign)->key, key, 16);
return true;
} | 0 | null | -1 | https://github.com/bluez/bluez/commit/1cd644db8c23a2f530ddb93cebed7dacc5f5721a | 0CCPP |
static inline bool should_fail_request(struct hd_struct *part,
unsigned int bytes)
{
return false;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/54648cf1ec2d7f4b6a71767799c45676a138ca24 | 0CCPP |
void mpc57xxEthInitGpio(NetInterface *interface)
{
SIUL2->MSCR[94] = SIUL2_MSCR_SRC(3) | SIUL2_MSCR_OBE_MASK |
SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_IBE_MASK | SIUL2_MSCR_PUS_MASK |
SIUL2_MSCR_PUE_MASK | SIUL2_MSCR_SSS(4);
SIUL2->IMCR[450] = SIUL2_IMCR_SSS(1);
SIUL2->MSCR[96] = SIUL2_MSCR_SRC(3) | SIUL2_MSCR_OBE_MASK |
SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_SSS(3);
SIUL2->MSCR[113] = SIUL2_MSCR_SRC(3) | SIUL2_MSCR_OBE_MASK |
SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_SSS(4);
SIUL2->MSCR[112] = SIUL2_MSCR_SRC(3) | SIUL2_MSCR_OBE_MASK |
SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_SSS(3);
SIUL2->MSCR[114] = SIUL2_MSCR_SRC(3) | SIUL2_MSCR_OBE_MASK |
SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_SSS(4);
SIUL2->MSCR[97] = SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_IBE_MASK;
SIUL2->IMCR[449] = SIUL2_IMCR_SSS(1);
SIUL2->MSCR[9] = SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_IBE_MASK;
SIUL2->IMCR[451] = SIUL2_IMCR_SSS(1);
SIUL2->MSCR[8] = SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_IBE_MASK;
SIUL2->IMCR[452] = SIUL2_IMCR_SSS(1);
SIUL2->MSCR[11] = SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_IBE_MASK;
SIUL2->IMCR[455] = SIUL2_IMCR_SSS(1);
SIUL2->MSCR[95] = SIUL2_MSCR_SMC_MASK | SIUL2_MSCR_IBE_MASK;
SIUL2->IMCR[457] = SIUL2_IMCR_SSS(1);
} | 0 | null | -1 | https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366 | 0CCPP |
void Compute(OpKernelContext* context) override {
ReshapeSparseTensor<Device>(context, context->input(0), context->input(1),
context->input(2), 0 ,
1 );
} | 1 | null | -1 | https://github.com/tensorflow/tensorflow/commit/1d04d7d93f4ed3854abf75d6b712d72c3f70d6b6 | 0CCPP |
def enable_sharing(path):
if path == "None":
path = None
app.interface.config["share_url"] = path
return jsonify(success=True)
| 0 | null | -1 | https://github.com/gradio-app/gradio.git/commit/41bd3645bdb616e1248b2167ca83636a2653f781 | 4Python |
eval_js(WebKitWebView * web_view, gchar *script, GString *result) {
WebKitWebFrame *frame;
JSGlobalContextRef context;
JSObjectRef globalobject;
JSStringRef var_name;
JSStringRef js_script;
JSValueRef js_result;
JSStringRef js_result_string;
size_t js_result_size;
js_init();
frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(web_view));
context = webkit_web_frame_get_global_context(frame);
globalobject = JSContextGetGlobalObject(context);
/* uzbl javascript namespace */
var_name = JSStringCreateWithUTF8CString("Uzbl");
JSObjectSetProperty(context, globalobject, var_name,
JSObjectMake(context, uzbl.js.classref, NULL),
kJSClassAttributeNone, NULL);
js_script = JSStringCreateWithUTF8CString(script);
js_result = JSEvaluateScript(context, js_script, globalobject, NULL, 0, NULL);
if (js_result && !JSValueIsUndefined(context, js_result)) {
js_result_string = JSValueToStringCopy(context, js_result, NULL);
js_result_size = JSStringGetMaximumUTF8CStringSize(js_result_string);
if (js_result_size) {
char js_result_utf8[js_result_size];
JSStringGetUTF8CString(js_result_string, js_result_utf8, js_result_size);
g_string_assign(result, js_result_utf8);
}
JSStringRelease(js_result_string);
}
JSObjectDeleteProperty(context, globalobject, var_name, NULL);
JSStringRelease(var_name);
JSStringRelease(js_script);
} | 1 | 4,13,14,15,16,17,30,31 | -1 | https://github.com/uzbl/uzbl/commit/1958b52d41cba96956dc1995660de49525ed1047 | 0CCPP |
static inline int __filemap_fdatawrite(struct address_space *mapping,
int sync_mode)
{
return __filemap_fdatawrite_range(mapping, 0, LLONG_MAX, sync_mode);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/124d3b7041f9a0ca7c43a6293e1cae4576c32fd5 | 0CCPP |
static int camellia_set_key(struct crypto_tfm *tfm, const u8 *_in_key,
unsigned int key_len)
{
struct camellia_sparc64_ctx *ctx = crypto_tfm_ctx(tfm);
const u32 *in_key = (const u32 *) _in_key;
u32 *flags = &tfm->crt_flags;
if (key_len != 16 && key_len != 24 && key_len != 32) {
*flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL;
}
ctx->key_len = key_len;
camellia_sparc64_key_expand(in_key, &ctx->encrypt_key[0],
key_len, &ctx->decrypt_key[0]);
return 0;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b | 0CCPP |
void ftpServerProcessPbsz(FtpClientConnection *connection, char_t *param)
{
#if (FTP_SERVER_TLS_SUPPORT == ENABLED)
FtpServerContext *context;
context = connection->context;
if((context->settings.mode & FTP_SERVER_MODE_IMPLICIT_TLS) != 0 ||
(context->settings.mode & FTP_SERVER_MODE_EXPLICIT_TLS) != 0)
{
if(*param != '\0')
{
osStrcpy(connection->response, "200 PBSZ=0\r\n");
}
else
{
osStrcpy(connection->response, "501 Missing parameter\r\n");
}
}
else
#endif
{
osStrcpy(connection->response, "502 Command not implemented\r\n");
}
} | 0 | null | -1 | https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366 | 0CCPP |
static void TreeTest(Jsi_Interp* interp) {
Jsi_Tree *st, *wt, *mt;
Jsi_TreeEntry *hPtr, *hPtr2;
bool isNew, i;
Jsi_TreeSearch srch;
struct tdata {
int n;
int m;
} t1, t2;
char nbuf[100];
wt = Jsi_TreeNew(interp, JSI_KEYS_ONEWORD, NULL);
mt = Jsi_TreeNew(interp, sizeof(struct tdata), NULL);
Jsi_TreeSet(wt, wt,(void*)0x88);
Jsi_TreeSet(wt, mt,(void*)0x99);
printf("WT: %p\n", Jsi_TreeGet(wt, mt));
printf("WT2: %p\n", Jsi_TreeGet(wt, wt));
Jsi_TreeDelete(wt);
t1.n = 0; t1.m = 1;
t2.n = 1; t2.m = 2;
Jsi_TreeSet(mt, &t1,(void*)0x88);
Jsi_TreeSet(mt, &t2,(void*)0x99);
Jsi_TreeSet(mt, &t2,(void*)0x98);
printf("CT: %p\n", Jsi_TreeGet(mt, &t1));
printf("CT2: %p\n", Jsi_TreeGet(mt, &t2));
Jsi_TreeDelete(mt);
st = Jsi_TreeNew(interp, JSI_KEYS_STRING, NULL);
hPtr = Jsi_TreeEntryNew(st, "bob", &isNew);
Jsi_TreeValueSet(hPtr, (void*)99);
Jsi_TreeSet(st, "zoe",(void*)77);
hPtr2 = Jsi_TreeSet(st, "ted",(void*)55);
Jsi_TreeSet(st, "philip",(void*)66);
Jsi_TreeSet(st, "alice",(void*)77);
puts("SRCH");
for (hPtr=Jsi_TreeSearchFirst(st,&srch, JSI_TREE_ORDER_IN, NULL); hPtr; hPtr=Jsi_TreeSearchNext(&srch))
mycall(st, hPtr, NULL);
Jsi_TreeSearchDone(&srch);
puts("IN");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_IN);
puts("PRE");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_PRE);
puts("POST");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_POST);
puts("LEVEL");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_LEVEL);
Jsi_TreeEntryDelete(hPtr2);
puts("INDEL");
Jsi_TreeWalk(st, mycall, NULL, 0);
for (i=0; i<1000; i++) {
snprintf(nbuf, sizeof(nbuf), "name%d", i);
Jsi_TreeSet(st, nbuf,(void*)i);
}
Jsi_TreeWalk(st, mycall, NULL, 0);
for (i=0; i<1000; i++) {
Jsi_TreeEntryDelete(st->root);
}
puts("OK");
Jsi_TreeWalk(st, mycall, NULL, 0);
Jsi_TreeDelete(st);
} | 1 | 9 | -1 | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | 0CCPP |
this.user&&this.updateUser(this.emptyFn,this.emptyFn,!0),f(g)):n||401!==g.getStatus()&&400!==g.getStatus()?c(this.parseRequestText(g)):this.authenticate(function(){m(!0)},c,n))}),mxUtils.bind(this,function(g){window.clearTimeout(d);v&&c(g)}))});null==b||6E4>this.tokenExpiresOn-Date.now()?this.authenticate(function(){m(!0)},c):m(!1)};OneDriveClient.prototype.checkToken=function(e){null==b||null==this.tokenRefreshThread||6E4>this.tokenExpiresOn-Date.now()?this.authenticate(e,this.emptyFn):e()};OneDriveClient.prototype.getItemRef= | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
select: function (context, sign, version) {
var nodeVersions = jsReleases.filter(function (i) {
return i.name === 'nodejs'
}).map(function (i) {
return i.version
})
return nodeVersions
.filter(generateSemverFilter(sign, version))
.map(function (v) {
return 'node ' + v
})
} | 1 | 1,2,3,4,5 | -1 | https://github.com/browserslist/browserslist/commit/c091916910dfe0b5fd61caad96083c6709b02d98 | 3JavaScript |
u8 gf_isom_is_track_in_root_od(GF_ISOFile *movie, u32 trackNumber)
{
u32 i;
GF_ISOTrackID trackID;
GF_Descriptor *desc;
GF_ES_ID_Inc *inc;
GF_List *inc_list;
if (!movie) return 2;
if (!movie->moov || !movie->moov->iods) return 0;
desc = movie->moov->iods->descriptor;
switch (desc->tag) {
case GF_ODF_ISOM_IOD_TAG:
inc_list = ((GF_IsomInitialObjectDescriptor *)desc)->ES_ID_IncDescriptors;
break;
case GF_ODF_ISOM_OD_TAG:
inc_list = ((GF_IsomObjectDescriptor *)desc)->ES_ID_IncDescriptors;
break;
default:
return 0;
}
trackID = gf_isom_get_track_id(movie, trackNumber);
if (!trackID) return 2;
i=0;
while ((inc = (GF_ES_ID_Inc*)gf_list_enum(inc_list, &i))) {
if (inc->trackID == (u32) trackID) return 1;
}
return 0;
} | 0 | null | -1 | https://github.com/gpac/gpac/commit/984787de3d414a5f7d43d0b4584d9469dff2a5a5 | 0CCPP |
graph.getModel().endUpdate();
}
}
resultFn(cells);
}
}); | 0 | null | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
T){var N=Graph.customFontElements[T];null!=N&&N.url!=E&&(N.elt.parentNode.removeChild(N.elt),N=null);null==N?(N=E,"http:"==E.substring(0,5)&&(N=PROXY_URL+"?url="+encodeURIComponent(E)),N={name:u,url:E,elt:Graph.createFontElement(u,N)},Graph.customFontElements[T]=N,Graph.recentCustomFonts[T]=N,E=document.getElementsByTagName("head")[0],null!=J&&("link"==N.elt.nodeName.toLowerCase()?(N.elt.onload=J,N.elt.onerror=J):J()),null!=E&&E.appendChild(N.elt)):null!=J&&J()}else null!=J&&J()}else null!=J&&J();
return u};Graph.getFontUrl=function(u,E){u=Graph.customFontElements[u.toLowerCase()];null!=u&&(E=u.url);return E};Graph.processFontAttributes=function(u){u=u.getElementsByTagName("*");for(var E=0;E<u.length;E++){var J=u[E].getAttribute("data-font-src");if(null!=J){var T="FONT"==u[E].nodeName?u[E].getAttribute("face"):u[E].style.fontFamily;null!=T&&Graph.addFont(T,J)}}};Graph.processFontStyle=function(u){if(null!=u){var E=mxUtils.getValue(u,"fontSource",null);if(null!=E){var J=mxUtils.getValue(u,mxConstants.STYLE_FONTFAMILY, | 1 | 0,1 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
public static boolean defaultToTrue(Boolean b) {
if(b==null) return true;
return b;
} | 0 | null | -1 | https://github.com/jenkinsci/jenkins/commit/bf539198564a1108b7b71a973bf7de963a6213ef | 2Java |
function getStringValue(name) {
// Property names must be strings. This means that non-string objects cannot be used
// as keys in an object. Any non-string object, including a number, is typecasted
// into a string via the toString method.
// -- MDN, https://
//
// So, to ensure that we are checking the same `name` that JavaScript would use, we cast it
// to a string. It's not always possible. If `name` is an object and its `toString` method is
// 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown:
//
// TypeError: Cannot convert object to primitive value
//
// For performance reasons, we don't catch this error here and allow it to propagate up the call
// stack. Note that you'll get the same error in JavaScript if you try to access a property using
// such a 'broken' object as a key.
return name + '';
} | 1 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 | -1 | https://github.com/peerigon/angular-expressions/commit/061addfb9a9e932a970e5fcb913d020038e65667 | 3JavaScript |
not: function(expression) {
return '!(' + expression + ')';
}, | 1 | 0,1,2 | -1 | https://github.com/peerigon/angular-expressions/commit/061addfb9a9e932a970e5fcb913d020038e65667 | 3JavaScript |
static bool need_full_stripe(enum btrfs_map_op op)
{
return (op == BTRFS_MAP_WRITE || op == BTRFS_MAP_GET_READ_MIRRORS);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/e4571b8c5e9ffa1e85c0c671995bd4dcc5c75091 | 0CCPP |
static bool bpf_map_ptr_poisoned(const struct bpf_insn_aux_data *aux)
{
return BPF_MAP_PTR(aux->map_state) == BPF_MAP_PTR_POISON;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/b799207e1e1816b09e7a5920fbb2d5fcf6edd681 | 0CCPP |
cib_remote_dispatch(gpointer user_data)
{
cib_t *cib = user_data;
cib_remote_opaque_t *private = cib->variant_opaque;
xmlNode *msg = NULL;
const char *type = NULL;
crm_info("Message on callback channel");
msg = crm_recv_remote_msg(private->callback.session, private->callback.encrypted);
type = crm_element_value(msg, F_TYPE);
crm_trace("Activating %s callbacks...", type);
if (safe_str_eq(type, T_CIB)) {
cib_native_callback(cib, msg, 0, 0);
} else if (safe_str_eq(type, T_CIB_NOTIFY)) {
g_list_foreach(cib->notify_list, cib_native_notify, msg);
} else {
crm_err("Unknown message type: %s", type);
}
if (msg != NULL) {
free_xml(msg);
return 0;
}
return -1;
} | 1 | 0,5,7,8,9,10,11,12,13,14,15,16,17,19,21 | -1 | https://github.com/ClusterLabs/pacemaker/commit/564f7cc2a51dcd2f28ab12a13394f31be5aa3c93 | 0CCPP |
void splice_from_pipe_begin(struct splice_desc *sd)
{
sd->num_spliced = 0;
sd->need_wakeup = false;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/8d0207652cbe27d1f962050737848e5ad4671958 | 0CCPP |
"",ea=0;ea<g.length;ea++)aa=document.createElement("option"),mxUtils.write(aa,g[ea].getAttribute("name")||mxResources.get("pageWithNumber",[ea+1])),aa.setAttribute("value",ea),ea==k&&aa.setAttribute("selected","selected"),Q.appendChild(aa);W=function(){try{var Fa=parseInt(Q.value);k=e=Fa;la(g[Fa])}catch(xa){Q.value=e,b.handleError(xa)}}}else Aa(ua);ea=R.lastModifyingUserName;null!=ea&&20<ea.length&&(ea=ea.substring(0,20)+"...");H.innerHTML="";mxUtils.write(H,(null!=ea?ea+" ":"")+Y.toLocaleDateString()+ | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
jsi_wscallback_websock(struct lws *wsi,
enum lws_callback_reasons reason,
void *user, void *in, size_t len)
{
struct lws_context *context = lws_get_context(wsi);
jsi_wsPss *pss = NULL;
jsi_wsCmdObj *cmdPtr = (jsi_wsCmdObj *)lws_context_user(context);
if (!cmdPtr) {
fprintf(stderr, "null ws context\n");
return -1;
}
Jsi_Interp *interp = cmdPtr->interp;
char *inPtr = (char*)in;
int sLen, n, rc =0;
WSSIGASSERT(cmdPtr, OBJ);
if (Jsi_InterpGone(interp))
cmdPtr->deleted = 1;
if (cmdPtr->debug>=32) {
switch (reason) {
case LWS_CALLBACK_SERVER_WRITEABLE:
case LWS_CALLBACK_CLIENT_WRITEABLE:
break;
default:
fprintf(stderr, "WS CALLBACK: len=%d, %p %d:%s\n", (int)len, user, reason, jsw_getReasonStr(reason));
}
}
switch (reason) {
case LWS_CALLBACK_PROTOCOL_INIT:
if (cmdPtr->noWebsock)
return 1;
break;
case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION:
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 1);
Jsi_DSSet(&pss->url, inPtr);
if (cmdPtr->instCtx == context && (cmdPtr->clientName[0] || cmdPtr->clientIP[0])) {
pss->clientName = cmdPtr->clientName;
pss->clientIP = cmdPtr->clientIP;
}
if (cmdPtr->onFilter && !cmdPtr->deleted) {
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 0);
int killcon = 0, n = 0;
Jsi_Obj *oarg1;
Jsi_Value *vpargs, *vargs[10], *ret = Jsi_ValueNew1(interp);
vargs[n++] = Jsi_ValueNewObj(interp, cmdPtr->fobj);
vargs[n++] = Jsi_ValueNewNumber(interp, (Jsi_Number)(pss->wid));
vargs[n++] = Jsi_ValueNewBlob(interp, (uchar*)in, len);
vargs[n++] = Jsi_ValueNewBoolean(interp, 0);
vpargs = Jsi_ValueMakeObject(interp, NULL, oarg1 = Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
Jsi_ValueMakeUndef(interp, &ret);
rc = Jsi_FunctionInvoke(interp, cmdPtr->onFilter, vpargs, &ret, NULL);
if (rc == JSI_OK && Jsi_ValueIsFalse(interp, ret)) {
if (cmdPtr->debug>1)
fprintf(stderr, "WS:KILLING CONNECTION: %p\n", user);
killcon = 1;
}
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK) {
Jsi_LogError("websock bad rcv eval");
return 1;
}
if (killcon)
return 1;
}
break;
case LWS_CALLBACK_CLIENT_ESTABLISHED:
case LWS_CALLBACK_ESTABLISHED:
if (cmdPtr->bufferPwr2>0) {
char nbuf[100];
snprintf(nbuf, sizeof(nbuf), "%d", cmdPtr->bufferPwr2);
lws_set_extension_option(wsi, "permessage-deflate", "rx_buf_size", nbuf);
lws_set_extension_option(wsi, "permessage-deflate", "tx_buf_size", nbuf);
}
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 0);
if (cmdPtr->onOpen && !cmdPtr->deleted) {
Jsi_Obj *oarg1;
Jsi_Value *vpargs, *vargs[10];
int n = 0;
vargs[n++] = Jsi_ValueNewObj(interp, cmdPtr->fobj);
vargs[n++] = Jsi_ValueNewNumber(interp, (Jsi_Number)(pss->wid));
vpargs = Jsi_ValueMakeObject(interp, NULL, oarg1 = Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
Jsi_Value *ret = Jsi_ValueNew1(interp);
Jsi_ValueMakeUndef(interp, &ret);
rc = Jsi_FunctionInvoke(interp, cmdPtr->onOpen, vpargs, &ret, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK)
return Jsi_LogError("websock bad rcv eval");
}
break;
case LWS_CALLBACK_WSI_DESTROY:
break;
case LWS_CALLBACK_CLOSED:
case LWS_CALLBACK_PROTOCOL_DESTROY:
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 0);
if (!pss) break;
if (cmdPtr->onClose || pss->onClose) {
rc = jsi_wsrecv_callback(interp, cmdPtr, pss, inPtr, len, 1);
if (rc != JSI_OK)
return Jsi_LogError("websock bad rcv eval");
}
jsi_wsdeletePss(pss);
if (cmdPtr->stats.connectCnt<=0 && cmdPtr->onCloseLast && !Jsi_InterpGone(interp)) {
Jsi_RC jrc;
Jsi_Value *retStr = Jsi_ValueNew1(interp);
Jsi_Value *vpargs, *vargs[10];
int n = 0;
vargs[n++] = (cmdPtr->deleted?Jsi_ValueNewNull(interp):Jsi_ValueNewObj(interp, cmdPtr->fobj));
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
jrc = Jsi_FunctionInvoke(interp, cmdPtr->onCloseLast, vpargs, &retStr, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, retStr);
if (Jsi_InterpGone(interp))
return JSI_ERROR;
return jrc;
}
break;
case LWS_CALLBACK_CLIENT_WRITEABLE:
case LWS_CALLBACK_SERVER_WRITEABLE: {
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 0);
if (!pss || !pss->stack) break;
if (pss->lastData)
Jsi_Free(pss->lastData);
n=0;
char *data = pss->lastData = (char*)Jsi_StackUnshift(pss->stack);
unsigned char *p;
if (data == NULL)
break;
pss->stats.msgQLen--;
pss->state = PWS_SENT;
p = (unsigned char *)data+LWS_PRE;
sLen = Jsi_Strlen((char*)p);
n = jsi_wswrite(pss, wsi, p, sLen, (pss->stats.isBinary?LWS_WRITE_BINARY:LWS_WRITE_TEXT));
if (cmdPtr->debug>=10)
fprintf(stderr, "WS:CLIENT WRITE(%p): %d=>%d\n", pss, sLen, n);
if (n >= 0) {
cmdPtr->stats.sentCnt++;
cmdPtr->stats.sentLast = time(NULL);
pss->stats.sentCnt++;
pss->stats.sentLast = time(NULL);
} else {
lwsl_err("ERROR %d writing to socket\n", n);
pss->state = PWS_SENDERR;
pss->stats.sentErrCnt++;
pss->stats.sentErrLast = time(NULL);
cmdPtr->stats.sentErrCnt++;
cmdPtr->stats.sentErrLast = time(NULL);
rc = 1;
}
break;
}
case LWS_CALLBACK_CLIENT_RECEIVE:
case LWS_CALLBACK_RECEIVE:
{
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 0);
if (!pss) break;
pss->stats.recvCnt++;
pss->stats.recvLast = time(NULL);
cmdPtr->stats.recvCnt++;
cmdPtr->stats.recvLast = time(NULL);
if (cmdPtr->onRecv || pss->onRecv) {
int nlen = len;
if (nlen<=0)
return 0;
int rblen = Jsi_DSLength(&pss->recvBuf),
bmax = cmdPtr->recvBufMax,
isfin = pss->stats.isFinal = lws_is_final_fragment(wsi);
pss->stats.isBinary = lws_frame_is_binary(wsi);
if (rblen) {
if (bmax && rblen>bmax) {
fprintf(stderr, "WS: Recv exceeds recvBufMax: %d>%d\n", rblen, bmax);
rc = 1;
break;
}
Jsi_DSAppendLen(&pss->recvBuf, inPtr, len);
if (!isfin) break;
cmdPtr->recvBufCnt--;
nlen = Jsi_DSLength(&pss->recvBuf);
inPtr = Jsi_DSFreeDup(&pss->recvBuf);
} else {
if (!isfin) {
cmdPtr->recvBufCnt++;
Jsi_DSAppendLen(&pss->recvBuf, inPtr, len);
break;
}
}
rc = jsi_wsrecv_callback(interp, cmdPtr, pss, inPtr, nlen, 0);
if (inPtr != in)
Jsi_Free(inPtr);
if (rc != JSI_OK) {
Jsi_LogError("websock bad rcv eval");
return 1;
}
}
lws_callback_on_writable_all_protocol(cmdPtr->context, lws_get_protocol(wsi));
break;
}
default:
break;
}
return rc;
} | 1 | 70 | -1 | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | 0CCPP |
static BOOL update_recv_orders(rdpUpdate* update, wStream* s)
{
UINT16 numberOrders;
if (Stream_GetRemainingLength(s) < 6)
{
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 6");
return FALSE;
}
Stream_Seek_UINT16(s);
Stream_Read_UINT16(s, numberOrders);
Stream_Seek_UINT16(s);
while (numberOrders > 0)
{
if (!update_recv_order(update, s))
{
WLog_ERR(TAG, "update_recv_order() failed");
return FALSE;
}
numberOrders--;
}
return TRUE;
} | 0 | null | -1 | https://github.com/FreeRDP/FreeRDP/commit/f8890a645c221823ac133dbf991f8a65ae50d637 | 0CCPP |
inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, char *url) {
debug(D_WEB_CLIENT, "%llu: API v1 data with URL '%s'", w->id, url);
int ret = 400;
BUFFER *dimensions = NULL;
buffer_flush(w->response.data);
char *google_version = "0.6",
*google_reqId = "0",
*google_sig = "0",
*google_out = "json",
*responseHandler = NULL,
*outFileName = NULL;
time_t last_timestamp_in_data = 0, google_timestamp = 0;
char *chart = NULL
, *before_str = NULL
, *after_str = NULL
, *group_time_str = NULL
, *points_str = NULL;
int group = RRDR_GROUPING_AVERAGE;
uint32_t format = DATASOURCE_JSON;
uint32_t options = 0x00000000;
while(url) {
char *value = mystrsep(&url, "?&");
if(!value || !*value) continue;
char *name = mystrsep(&value, "=");
if(!name || !*name) continue;
if(!value || !*value) continue;
debug(D_WEB_CLIENT, "%llu: API v1 data query param '%s' with value '%s'", w->id, name, value);
if(!strcmp(name, "chart")) chart = value;
else if(!strcmp(name, "dimension") || !strcmp(name, "dim") || !strcmp(name, "dimensions") || !strcmp(name, "dims")) {
if(!dimensions) dimensions = buffer_create(100);
buffer_strcat(dimensions, "|");
buffer_strcat(dimensions, value);
}
else if(!strcmp(name, "after")) after_str = value;
else if(!strcmp(name, "before")) before_str = value;
else if(!strcmp(name, "points")) points_str = value;
else if(!strcmp(name, "gtime")) group_time_str = value;
else if(!strcmp(name, "group")) {
group = web_client_api_request_v1_data_group(value, RRDR_GROUPING_AVERAGE);
}
else if(!strcmp(name, "format")) {
format = web_client_api_request_v1_data_format(value);
}
else if(!strcmp(name, "options")) {
options |= web_client_api_request_v1_data_options(value);
}
else if(!strcmp(name, "callback")) {
responseHandler = value;
}
else if(!strcmp(name, "filename")) {
outFileName = value;
}
else if(!strcmp(name, "tqx")) {
char *tqx_name, *tqx_value;
while(value) {
tqx_value = mystrsep(&value, ";");
if(!tqx_value || !*tqx_value) continue;
tqx_name = mystrsep(&tqx_value, ":");
if(!tqx_name || !*tqx_name) continue;
if(!tqx_value || !*tqx_value) continue;
if(!strcmp(tqx_name, "version"))
google_version = tqx_value;
else if(!strcmp(tqx_name, "reqId"))
google_reqId = tqx_value;
else if(!strcmp(tqx_name, "sig")) {
google_sig = tqx_value;
google_timestamp = strtoul(google_sig, NULL, 0);
}
else if(!strcmp(tqx_name, "out")) {
google_out = tqx_value;
format = web_client_api_request_v1_data_google_format(google_out);
}
else if(!strcmp(tqx_name, "responseHandler"))
responseHandler = tqx_value;
else if(!strcmp(tqx_name, "outFileName"))
outFileName = tqx_value;
}
}
}
if(!chart || !*chart) {
buffer_sprintf(w->response.data, "No chart id is given at the request.");
goto cleanup;
}
RRDSET *st = rrdset_find(host, chart);
if(!st) st = rrdset_find_byname(host, chart);
if(!st) {
buffer_strcat(w->response.data, "Chart is not found: ");
buffer_strcat_htmlescape(w->response.data, chart);
ret = 404;
goto cleanup;
}
st->last_accessed_time = now_realtime_sec();
long long before = (before_str && *before_str)?str2l(before_str):0;
long long after = (after_str && *after_str) ?str2l(after_str):0;
int points = (points_str && *points_str)?str2i(points_str):0;
long group_time = (group_time_str && *group_time_str)?str2l(group_time_str):0;
debug(D_WEB_CLIENT, "%llu: API command 'data' for chart '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', format '%u', options '0x%08x'"
, w->id
, chart
, (dimensions)?buffer_tostring(dimensions):""
, after
, before
, points
, group
, format
, options
);
if(outFileName && *outFileName) {
buffer_sprintf(w->response.header, "Content-Disposition: attachment; filename=\"%s\"\r\n", outFileName);
debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
}
if(format == DATASOURCE_DATATABLE_JSONP) {
if(responseHandler == NULL)
responseHandler = "google.visualization.Query.setResponse";
debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
w->id, google_version, google_reqId, google_sig, google_out, responseHandler, outFileName
);
buffer_sprintf(w->response.data,
"%s({version:'%s',reqId:'%s',status:'ok',sig:'%ld',table:",
responseHandler, google_version, google_reqId, st->last_updated.tv_sec);
}
else if(format == DATASOURCE_JSONP) {
if(responseHandler == NULL)
responseHandler = "callback";
buffer_strcat(w->response.data, responseHandler);
buffer_strcat(w->response.data, "(");
}
ret = rrdset2anything_api_v1(st, w->response.data, dimensions, format, points, after, before, group, group_time
, options, &last_timestamp_in_data);
if(format == DATASOURCE_DATATABLE_JSONP) {
if(google_timestamp < last_timestamp_in_data)
buffer_strcat(w->response.data, "});");
else {
buffer_flush(w->response.data);
buffer_sprintf(w->response.data,
"%s({version:'%s',reqId:'%s',status:'error',errors:[{reason:'not_modified',message:'Data not modified'}]});",
responseHandler, google_version, google_reqId);
}
}
else if(format == DATASOURCE_JSONP)
buffer_strcat(w->response.data, ");");
cleanup:
buffer_free(dimensions);
return ret;
} | 1 | null | -1 | https://github.com/netdata/netdata/commit/92327c9ec211bd1616315abcb255861b130b97ca | 0CCPP |
static void __attribute__((__noreturn__)) usage(FILE *out)
{
fputs(USAGE_HEADER, out);
fprintf(out, " %s\n", program_invocation_short_name);
fputs(USAGE_SEPARATOR, out);
fputs(_("Edit the password or group file.\n"), out);
fputs(USAGE_OPTIONS, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("vipw(8)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
} | 0 | null | -1 | https://github.com/util-linux/util-linux/commit/bde91c85bdc77975155058276f99d2e0f5eab5a9 | 0CCPP |
public void purgeTimerTasks() {
Timer timer = cancelTimer;
if (timer != null) {
timer.purge();
}
} | 0 | null | -1 | https://github.com/pgjdbc/pgjdbc/commit/14b62aca4764d496813f55a43d050b017e01eb65 | 2Java |
def import_files(self, id_, identity, uow=None):
if self.draft_files is None:
raise RuntimeError("Files support is not enabled.")
draft = self.draft_cls.pid.resolve(id_, registered_only=False)
self.require_permission(identity, "draft_create_files", record=draft)
record = self.record_cls.get_record(draft.versions.latest_id)
self.require_permission(identity, "read_files", record=record)
self.run_components("import_files", identity, draft=draft, record=record, uow=uow)
uow.register(RecordCommitOp(draft, indexer=self.indexer))
return self.draft_files.file_result_list(
self.draft_files,
identity,
results=draft.files.values(),
record=draft,
links_tpl=self.draft_files.file_links_list_tpl(id_),
links_item_tpl=self.draft_files.file_links_item_tpl(id_),
)
| 0 | null | -1 | https://github.com/inveniosoftware/invenio-drafts-resources.git/commit/039b0cff1ad4b952000f4d8c3a93f347108b6626 | 4Python |
public void setDescription(String description) throws IOException {
this.description = description;
save();
ItemListener.fireOnUpdated(this);
} | 0 | null | -1 | https://github.com/jenkinsci/jenkins/commit/e4620c6d6d6d2438eb9088bc9d377a546c5fe4bf | 2Java |
rd_contents(struct archive_read *a, const void **buff, size_t *size,
size_t *used, uint64_t remaining)
{
const unsigned char *b;
ssize_t bytes;
b = __archive_read_ahead(a, 1, &bytes);
if (bytes < 0)
return ((int)bytes);
if (bytes == 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Truncated archive file");
return (ARCHIVE_FATAL);
}
if ((uint64_t)bytes > remaining)
bytes = (ssize_t)remaining;
*used = bytes;
if (decompress(a, buff, size, b, used) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
checksum_update(a, b, *used, *buff, *size);
return (ARCHIVE_OK);
} | 0 | null | -1 | https://github.com/libarchive/libarchive/commit/fa7438a0ff4033e4741c807394a9af6207940d71 | 0CCPP |
static inline void btrfs_free_space_key(struct extent_buffer *eb,
struct btrfs_free_space_header *h,
struct btrfs_disk_key *key)
{
read_eb_member(eb, h, struct btrfs_free_space_header, location, key);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/9c52057c698fb96f8f07e7a4bcf4801a092bda89 | 0CCPP |
this.arrowWidth))));h=l*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"arrowSize",this.arrowSize))));q=(p-v)/2;v=q+v;var w=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(c,[new mxPoint(0,q),new mxPoint(l-h,q),new mxPoint(l-h,0),new mxPoint(l,p/2),new mxPoint(l-h,p),new mxPoint(l-h,v),new mxPoint(0,v)],this.isRounded,w,!0);c.end()};mxCellRenderer.registerShape("singleArrow",ca);mxUtils.extend(t,mxActor);t.prototype.redrawPath=function(c,
h,q,l,p){var v=p*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"arrowWidth",ca.prototype.arrowWidth))));h=l*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"arrowSize",ca.prototype.arrowSize))));q=(p-v)/2;v=q+v;var w=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(c,[new mxPoint(0,p/2),new mxPoint(h,0),new mxPoint(h,q),new mxPoint(l-h,q),new mxPoint(l-h,0),new mxPoint(l,p/2),new mxPoint(l-h,p),new mxPoint(l-h,v),new mxPoint(h,
v),new mxPoint(h,p)],this.isRounded,w,!0);c.end()};mxCellRenderer.registerShape("doubleArrow",t);mxUtils.extend(z,mxActor);z.prototype.size=.1;z.prototype.fixedSize=20;z.prototype.redrawPath=function(c,h,q,l,p){h="0"!=mxUtils.getValue(this.style,"fixedSize","0")?Math.max(0,Math.min(l,parseFloat(mxUtils.getValue(this.style,"size",this.fixedSize)))):l*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));c.moveTo(h,0);c.lineTo(l,0);c.quadTo(l-2*h,p/2,l,p);c.lineTo(h,p);c.quadTo(h- | 0 | null | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
Toolbar.prototype.createButton = function(classname)
{
var elt = document.createElement('a');
elt.className = 'geButton';
var inner = document.createElement('div');
if (classname != null)
{
inner.className = 'geSprite ' + classname;
}
elt.appendChild(inner);
return elt;
}; | 0 | null | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
Bool gf_isom_box_check_unique(GF_List *children, GF_Box *a)
{
u32 i, count;
if (!children) return GF_TRUE;
count = gf_list_count(children);
for (i=0; i<count; i++) {
GF_Box *c = gf_list_get(children, i);
if (c==a) continue;
if (c->type==a->type) return GF_FALSE;
}
return GF_TRUE; | 0 | null | -1 | https://github.com/gpac/gpac/commit/37592ad86c6ca934d34740012213e467acc4a3b0 | 0CCPP |
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String path = httpRequest.getServletPath();
LOG.debug("Handling request for path {}", path);
if (configuration.getRealm() == null || configuration.getRealm().equals("") || !configuration.isEnabled()) {
LOG.debug("No authentication needed for path {}", path);
chain.doFilter(request, response);
return;
}
HttpSession session = httpRequest.getSession(false);
if (session != null) {
Subject subject = (Subject) session.getAttribute("subject");
if (subject != null) {
LOG.debug("Session subject {}", subject);
executeAs(request, response, chain, subject);
return;
}
}
boolean doAuthenticate = path.startsWith("/auth") ||
path.startsWith("/jolokia") ||
path.startsWith("/upload");
if (doAuthenticate) {
LOG.debug("Doing authentication and authorization for path {}", path);
switch (Authenticator.authenticate(configuration.getRealm(), configuration.getRole(), configuration.getRolePrincipalClasses(),
configuration.getConfiguration(), httpRequest, new PrivilegedCallback() {
public void execute(Subject subject) throws Exception {
executeAs(request, response, chain, subject);
}
})) {
case AUTHORIZED:
break;
case NOT_AUTHORIZED:
Helpers.doForbidden((HttpServletResponse) response);
break;
case NO_CREDENTIALS:
Helpers.doForbidden((HttpServletResponse) response);
break;
}
} else {
LOG.debug("No authentication needed for path {}", path);
chain.doFilter(request, response);
}
} | 1 | 18,19,20,39 | -1 | https://github.com/hawtio/hawtio/commit/5289715e4f2657562fdddcbad830a30969b96e1e | 2Java |
private static void HandleEncryptedMessage(WebSocket clientSocket, byte[] message)
{
var connectionId = CookieManager.GetConnectionId(clientSocket);
AuthClient authClient;
if (AllClients.TryGetValue(connectionId, out authClient))
{
var packetManager = new PacketManager(authClient, clientSocket, message);
var packet = packetManager.GetPacket();
packet?.HandlePacket();
}
} | 1 | 0,1,2,3,4,5,6,7,8,9,10 | -1 | https://github.com/Ulterius/server/commit/770d1821de43cf1d0a93c79025995bdd812a76ee | 1CS |
nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
int flags, struct nameidata *nd)
{
struct path path = {
.mnt = nd->path.mnt,
.dentry = dentry,
};
struct nfs4_state *state;
struct rpc_cred *cred;
int status = 0;
cred = rpc_lookup_cred();
if (IS_ERR(cred)) {
status = PTR_ERR(cred);
goto out;
}
state = nfs4_do_open(dir, &path, flags, sattr, cred);
d_drop(dentry);
if (IS_ERR(state)) {
status = PTR_ERR(state);
goto out_putcred;
}
d_add(dentry, igrab(state->inode));
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
if (flags & O_EXCL) {
struct nfs_fattr fattr;
status = nfs4_do_setattr(state->inode, cred, &fattr, sattr, state);
if (status == 0)
nfs_setattr_update_inode(state->inode, sattr);
nfs_post_op_update_inode(state->inode, &fattr);
}
if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0)
status = nfs4_intent_set_file(nd, &path, state);
else
nfs4_close_sync(&path, state, flags);
out_putcred:
put_rpccred(cred);
out:
return status;
} | 1 | 15,31,33 | -1 | https://github.com/torvalds/linux/commit/dc0b027dfadfcb8a5504f7d8052754bf8d501ab9 | 0CCPP |
static int hashtable_do_rehash(hashtable_t *hashtable)
{
list_t *list, *next;
pair_t *pair;
size_t i, index, new_size;
jsonp_free(hashtable->buckets);
hashtable->num_buckets++;
new_size = num_buckets(hashtable);
hashtable->buckets = jsonp_malloc(new_size * sizeof(bucket_t));
if(!hashtable->buckets)
return -1;
for(i = 0; i < num_buckets(hashtable); i++)
{
hashtable->buckets[i].first = hashtable->buckets[i].last =
&hashtable->list;
}
list = hashtable->list.next;
list_init(&hashtable->list);
for(; list != &hashtable->list; list = next) {
next = list->next;
pair = list_to_pair(list);
index = pair->hash % new_size;
insert_to_bucket(hashtable, &hashtable->buckets[index], &pair->list);
}
return 0;
} | 1 | 6,7,11 | -1 | https://github.com/akheron/jansson/commit/8f80c2d83808150724d31793e6ade92749b1faa4 | 0CCPP |
public void setUseStreamManagementResumption(boolean useSmResumption) {
if (useSmResumption) {
setUseStreamManagement(useSmResumption);
}
this.useSmResumption = useSmResumption;
} | 0 | null | -1 | https://github.com/igniterealtime/Smack/commit/059ee99ba0d5ff7758829acf5a9aeede09ec820b | 2Java |
addnfaarc(nfa *nf, int from, int to, int lbl)
{
nfastate *st;
nfaarc *ar;
st = &nf->nf_state[from];
st->st_arc = (nfaarc *)PyObject_REALLOC(st->st_arc,
sizeof(nfaarc) * (st->st_narcs + 1));
if (st->st_arc == NULL)
Py_FatalError("out of mem");
ar = &st->st_arc[st->st_narcs++];
ar->ar_label = lbl;
ar->ar_arrow = to;
} | 1 | 0,1,2,3,4,5,6,7,8,9,10,11,12 | -1 | https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce | 0CCPP |
int main(int argc, char *argv[])
{
FILE *iplist = NULL;
plist_t root_node = NULL;
char *plist_out = NULL;
uint32_t size = 0;
int read_size = 0;
char *plist_entire = NULL;
struct stat filestats;
options_t *options = parse_arguments(argc, argv);
if (!options)
{
print_usage(argc, argv);
return 0;
}
iplist = fopen(options->in_file, "rb");
if (!iplist) {
free(options);
return 1;
}
stat(options->in_file, &filestats);
plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1));
read_size = fread(plist_entire, sizeof(char), filestats.st_size, iplist);
fclose(iplist);
if (memcmp(plist_entire, "bplist00", 8) == 0)
{
plist_from_bin(plist_entire, read_size, &root_node);
plist_to_xml(root_node, &plist_out, &size);
}
else
{
plist_from_xml(plist_entire, read_size, &root_node);
plist_to_bin(root_node, &plist_out, &size);
}
plist_free(root_node);
free(plist_entire);
if (plist_out)
{
if (options->out_file != NULL)
{
FILE *oplist = fopen(options->out_file, "wb");
if (!oplist) {
free(options);
return 1;
}
fwrite(plist_out, size, sizeof(char), oplist);
fclose(oplist);
}
else
fwrite(plist_out, size, sizeof(char), stdout);
free(plist_out);
}
else
printf("ERROR: Failed to convert input file.\n");
free(options);
return 0;
} | 1 | null | -1 | https://github.com/libimobiledevice/libplist/commit/7391a506352c009fe044dead7baad9e22dd279ee | 0CCPP |
static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
{
const char
*option;
Image
*image;
int
jp2_status;
MagickBooleanType
status;
opj_codec_t
*jp2_codec;
opj_codestream_index_t
*codestream_index = (opj_codestream_index_t *) NULL;
opj_dparameters_t
parameters;
opj_image_t
*jp2_image;
opj_stream_t
*jp2_stream;
register ssize_t
i;
ssize_t
y;
unsigned char
sans[4];
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
if (ReadBlob(image,4,sans) != 4)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
(void) SeekBlob(image,SEEK_SET,0);
if (LocaleCompare(image_info->magick,"JPT") == 0)
jp2_codec=opj_create_decompress(OPJ_CODEC_JPT);
else
if (IsJ2K(sans,4) != MagickFalse)
jp2_codec=opj_create_decompress(OPJ_CODEC_J2K);
else
jp2_codec=opj_create_decompress(OPJ_CODEC_JP2);
opj_set_warning_handler(jp2_codec,JP2WarningHandler,exception);
opj_set_error_handler(jp2_codec,JP2ErrorHandler,exception);
opj_set_default_decoder_parameters(¶meters);
option=GetImageOption(image_info,"jp2:reduce-factor");
if (option != (const char *) NULL)
parameters.cp_reduce=StringToInteger(option);
option=GetImageOption(image_info,"jp2:quality-layers");
if (option != (const char *) NULL)
parameters.cp_layer=StringToInteger(option);
if (opj_setup_decoder(jp2_codec,¶meters) == 0)
{
opj_destroy_codec(jp2_codec);
ThrowReaderException(DelegateError,"UnableToManageJP2Stream");
}
jp2_stream=opj_stream_create(OPJ_J2K_STREAM_CHUNK_SIZE,1);
opj_stream_set_read_function(jp2_stream,JP2ReadHandler);
opj_stream_set_write_function(jp2_stream,JP2WriteHandler);
opj_stream_set_seek_function(jp2_stream,JP2SeekHandler);
opj_stream_set_skip_function(jp2_stream,JP2SkipHandler);
opj_stream_set_user_data(jp2_stream,image,NULL);
opj_stream_set_user_data_length(jp2_stream,GetBlobSize(image));
if (opj_read_header(jp2_stream,jp2_codec,&jp2_image) == 0)
{
opj_stream_destroy(jp2_stream);
opj_destroy_codec(jp2_codec);
ThrowReaderException(DelegateError,"UnableToDecodeImageFile");
}
jp2_status=1;
if ((image->columns != 0) && (image->rows != 0))
{
jp2_status=opj_set_decode_area(jp2_codec,jp2_image,
(OPJ_INT32) image->extract_info.x,(OPJ_INT32) image->extract_info.y,
(OPJ_INT32) (image->extract_info.x+(ssize_t) image->columns),
(OPJ_INT32) (image->extract_info.y+(ssize_t) image->rows));
if (jp2_status == 0)
{
opj_stream_destroy(jp2_stream);
opj_destroy_codec(jp2_codec);
opj_image_destroy(jp2_image);
ThrowReaderException(DelegateError,"UnableToDecodeImageFile");
}
}
if ((image_info->number_scenes != 0) && (image_info->scene != 0))
jp2_status=opj_get_decoded_tile(jp2_codec,jp2_stream,jp2_image,
(unsigned int) image_info->scene-1);
else
if (image->ping == MagickFalse)
{
jp2_status=opj_decode(jp2_codec,jp2_stream,jp2_image);
if (jp2_status != 0)
jp2_status=opj_end_decompress(jp2_codec,jp2_stream);
}
if (jp2_status == 0)
{
opj_stream_destroy(jp2_stream);
opj_destroy_codec(jp2_codec);
opj_image_destroy(jp2_image);
ThrowReaderException(DelegateError,"UnableToDecodeImageFile");
}
opj_stream_destroy(jp2_stream);
for (i=0; i < (ssize_t) jp2_image->numcomps; i++)
{
if ((jp2_image->comps[0].dx == 0) || (jp2_image->comps[0].dy == 0) ||
(jp2_image->comps[0].dx != jp2_image->comps[i].dx) ||
(jp2_image->comps[0].dy != jp2_image->comps[i].dy) ||
(jp2_image->comps[0].prec != jp2_image->comps[i].prec) ||
(jp2_image->comps[0].sgnd != jp2_image->comps[i].sgnd) ||
(jp2_image->comps[i].data == NULL))
{
opj_destroy_codec(jp2_codec);
opj_image_destroy(jp2_image);
ThrowReaderException(CoderError,"IrregularChannelGeometryNotSupported")
}
}
image->columns=(size_t) jp2_image->comps[0].w;
image->rows=(size_t) jp2_image->comps[0].h;
image->depth=jp2_image->comps[0].prec;
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
image->compression=JPEG2000Compression;
if (jp2_image->color_space == 2)
{
SetImageColorspace(image,GRAYColorspace,exception);
if (jp2_image->numcomps > 1)
image->alpha_trait=BlendPixelTrait;
}
else
if (jp2_image->color_space == 3)
SetImageColorspace(image,Rec601YCbCrColorspace,exception);
if (jp2_image->numcomps > 3)
image->alpha_trait=BlendPixelTrait;
if (jp2_image->icc_profile_buf != (unsigned char *) NULL)
{
StringInfo
*profile;
profile=BlobToStringInfo(jp2_image->icc_profile_buf,
jp2_image->icc_profile_len);
if (profile != (StringInfo *) NULL)
SetImageProfile(image,"icc",profile,exception);
}
if (image->ping != MagickFalse)
{
opj_destroy_codec(jp2_codec);
opj_image_destroy(jp2_image);
opj_destroy_cstr_index(&codestream_index);
return(GetFirstImageInList(image));
}
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
*magick_restrict q;
register ssize_t
x;
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
register ssize_t
i;
for (i=0; i < (ssize_t) jp2_image->numcomps; i++)
{
double
pixel,
scale;
scale=QuantumRange/(double) ((1UL << jp2_image->comps[i].prec)-1);
pixel=scale*(jp2_image->comps[i].data[y/jp2_image->comps[i].dy*
image->columns/jp2_image->comps[i].dx+x/jp2_image->comps[i].dx]+
(jp2_image->comps[i].sgnd ? 1UL << (jp2_image->comps[i].prec-1) : 0));
switch (i)
{
case 0:
{
SetPixelRed(image,ClampToQuantum(pixel),q);
SetPixelGreen(image,ClampToQuantum(pixel),q);
SetPixelBlue(image,ClampToQuantum(pixel),q);
SetPixelAlpha(image,OpaqueAlpha,q);
break;
}
case 1:
{
if (jp2_image->numcomps == 2)
{
SetPixelAlpha(image,ClampToQuantum(pixel),q);
break;
}
SetPixelGreen(image,ClampToQuantum(pixel),q);
break;
}
case 2:
{
SetPixelBlue(image,ClampToQuantum(pixel),q);
break;
}
case 3:
{
SetPixelAlpha(image,ClampToQuantum(pixel),q);
break;
}
}
}
q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
opj_destroy_codec(jp2_codec);
opj_image_destroy(jp2_image);
opj_destroy_cstr_index(&codestream_index);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
} | 1 | 120 | -1 | https://github.com/ImageMagick/ImageMagick/commit/f13c6b54a879aaa771ec64b5a066b939e8f8e7f0 | 0CCPP |
static int __init personal_pci_init(void)
{
if (machine_is_personal_server())
pci_common_init(&personal_server_pci);
return 0;
} | 1 | 0,1,2,3,4,5 | -1 | https://github.com/torvalds/linux/commit/298a58e165e447ccfaae35fe9f651f9d7e15166f | 0CCPP |
static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
{
int i;
uint16_t limit;
VncDisplay *vd = vs->vd;
if (data[0] > 3) {
update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE);
}
switch (data[0]) {
case VNC_MSG_CLIENT_SET_PIXEL_FORMAT:
if (len == 1)
return 20;
set_pixel_format(vs, read_u8(data, 4), read_u8(data, 5),
read_u8(data, 6), read_u8(data, 7),
read_u16(data, 8), read_u16(data, 10),
read_u16(data, 12), read_u8(data, 14),
read_u8(data, 15), read_u8(data, 16));
break;
case VNC_MSG_CLIENT_SET_ENCODINGS:
if (len == 1)
return 4;
if (len == 4) {
limit = read_u16(data, 2);
if (limit > 0)
return 4 + (limit * 4);
} else
limit = read_u16(data, 2);
for (i = 0; i < limit; i++) {
int32_t val = read_s32(data, 4 + (i * 4));
memcpy(data + 4 + (i * 4), &val, sizeof(val));
}
set_encodings(vs, (int32_t *)(data + 4), limit);
break;
case VNC_MSG_CLIENT_FRAMEBUFFER_UPDATE_REQUEST:
if (len == 1)
return 10;
framebuffer_update_request(vs,
read_u8(data, 1), read_u16(data, 2), read_u16(data, 4),
read_u16(data, 6), read_u16(data, 8));
break;
case VNC_MSG_CLIENT_KEY_EVENT:
if (len == 1)
return 8;
key_event(vs, read_u8(data, 1), read_u32(data, 4));
break;
case VNC_MSG_CLIENT_POINTER_EVENT:
if (len == 1)
return 6;
pointer_event(vs, read_u8(data, 1), read_u16(data, 2), read_u16(data, 4));
break;
case VNC_MSG_CLIENT_CUT_TEXT:
if (len == 1)
return 8;
if (len == 8) {
uint32_t dlen = read_u32(data, 4);
if (dlen > 0)
return 8 + dlen;
}
client_cut_text(vs, read_u32(data, 4), data + 8);
break;
case VNC_MSG_CLIENT_QEMU:
if (len == 1)
return 2;
switch (read_u8(data, 1)) {
case VNC_MSG_CLIENT_QEMU_EXT_KEY_EVENT:
if (len == 2)
return 12;
ext_key_event(vs, read_u16(data, 2),
read_u32(data, 4), read_u32(data, 8));
break;
case VNC_MSG_CLIENT_QEMU_AUDIO:
if (len == 2)
return 4;
switch (read_u16 (data, 2)) {
case VNC_MSG_CLIENT_QEMU_AUDIO_ENABLE:
audio_add(vs);
break;
case VNC_MSG_CLIENT_QEMU_AUDIO_DISABLE:
audio_del(vs);
break;
case VNC_MSG_CLIENT_QEMU_AUDIO_SET_FORMAT:
if (len == 4)
return 10;
switch (read_u8(data, 4)) {
case 0: vs->as.fmt = AUD_FMT_U8; break;
case 1: vs->as.fmt = AUD_FMT_S8; break;
case 2: vs->as.fmt = AUD_FMT_U16; break;
case 3: vs->as.fmt = AUD_FMT_S16; break;
case 4: vs->as.fmt = AUD_FMT_U32; break;
case 5: vs->as.fmt = AUD_FMT_S32; break;
default:
printf("Invalid audio format %d\n", read_u8(data, 4));
vnc_client_error(vs);
break;
}
vs->as.nchannels = read_u8(data, 5);
if (vs->as.nchannels != 1 && vs->as.nchannels != 2) {
printf("Invalid audio channel coount %d\n",
read_u8(data, 5));
vnc_client_error(vs);
break;
}
vs->as.freq = read_u32(data, 6);
break;
default:
printf ("Invalid audio message %d\n", read_u8(data, 4));
vnc_client_error(vs);
break;
}
break;
default:
printf("Msg: %d\n", read_u16(data, 0));
vnc_client_error(vs);
break;
}
break;
default:
printf("Msg: %d\n", data[0]);
vnc_client_error(vs);
break;
}
vnc_read_when(vs, protocol_client_msg, 1);
return 0;
} | 1 | 51,55 | -1 | https://github.com/qemu/qemu/commit/f9a70e79391f6d7c2a912d785239ee8effc1922d | 0CCPP |
while ( 1 ) /* loops unti
{
yy_cp = yyg->yy_c_buf_p;
*yy_cp = yyg->yy_hold_char;
yy_bp = yy_cp;
yy_current_state = yyg->yy_start;
yy_match:
do
{
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
yyg->yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 45 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_current_state != 44 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
yy_find_action:
yy_act = yy_accept[yy_current_state];
YY_DO_BEFORE_ACTION;
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
{
yy_size_t yyl;
for ( yyl = 0; yyl < yyleng; ++yyl )
if ( yytext[yyl] == '\n' )
do{ yylineno++;
yycolumn=0;
}while(0)
;
}
do_action:
switch ( yy_act )
{
case 0:
*yy_cp = yyg->yy_hold_char;
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 101 "re_lexer.l"
{
int hi_bound;
int lo_bound = atoi(yytext + 1);
char* comma = strchr(yytext, ',');
if (comma - yytext == strlen(yytext) - 2)
hi_bound = INT16_MAX;
else
hi_bound = atoi(comma + 1);
if (hi_bound > INT16_MAX)
{
yyerror(yyscanner, lex_env, "repeat interval too large");
yyterminate();
}
if (hi_bound < lo_bound || hi_bound < 0 || lo_bound < 0)
{
yyerror(yyscanner, lex_env, "bad repeat interval");
yyterminate();
}
yylval->range = (hi_bound << 16) | lo_bound;
return _RANGE_;
}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 135 "re_lexer.l"
{
int value = atoi(yytext + 1);
if (value > INT16_MAX)
{
yyerror(yyscanner, lex_env, "repeat interval too large");
yyterminate();
}
yylval->range = (value << 16) | value;
return _RANGE_;
}
YY_BREAK
case 3:
YY_RULE_SETUP
#line 153 "re_lexer.l"
{
BEGIN(char_class);
memset(LEX_ENV->class_vector, 0, 32);
LEX_ENV->negated_class = TRUE;
}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 162 "re_lexer.l"
{
BEGIN(char_class);
memset(LEX_ENV->class_vector, 0, 32);
LEX_ENV->negated_class = TRUE;
LEX_ENV->class_vector[']' / 8] |= 1 << ']' % 8;
}
YY_BREAK
case 5:
YY_RULE_SETUP
#line 175 "re_lexer.l"
{
BEGIN(char_class);
memset(LEX_ENV->class_vector, 0, 32);
LEX_ENV->negated_class = FALSE;
LEX_ENV->class_vector[']' / 8] |= 1 << ']' % 8;
}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 188 "re_lexer.l"
{
BEGIN(char_class);
memset(LEX_ENV->class_vector, 0, 32);
LEX_ENV->negated_class = FALSE;
}
YY_BREAK
case 7:
YY_RULE_SETUP
#line 198 "re_lexer.l"
{
yylval->integer = yytext[0];
return _CHAR_;
}
YY_BREAK
case 8:
YY_RULE_SETUP
#line 207 "re_lexer.l"
{
return _WORD_CHAR_;
}
YY_BREAK
case 9:
YY_RULE_SETUP
#line 212 "re_lexer.l"
{
return _NON_WORD_CHAR_;
}
YY_BREAK
case 10:
YY_RULE_SETUP
#line 217 "re_lexer.l"
{
return _SPACE_;
}
YY_BREAK
case 11:
YY_RULE_SETUP
#line 222 "re_lexer.l"
{
return _NON_SPACE_;
}
YY_BREAK
case 12:
YY_RULE_SETUP
#line 227 "re_lexer.l"
{
return _DIGIT_;
}
YY_BREAK
case 13:
YY_RULE_SETUP
#line 232 "re_lexer.l"
{
return _NON_DIGIT_;
}
YY_BREAK
case 14:
YY_RULE_SETUP
#line 237 "re_lexer.l"
{
return _WORD_BOUNDARY_;
}
YY_BREAK
case 15:
YY_RULE_SETUP
#line 241 "re_lexer.l"
{
return _NON_WORD_BOUNDARY_;
}
YY_BREAK
case 16:
YY_RULE_SETUP
#line 246 "re_lexer.l"
{
yyerror(yyscanner, lex_env, "backreferences are not allowed");
yyterminate();
}
YY_BREAK
case 17:
YY_RULE_SETUP
#line 253 "re_lexer.l"
{
uint8_t c;
if (read_escaped_char(yyscanner, &c))
{
yylval->integer = c;
return _CHAR_;
}
else
{
yyerror(yyscanner, lex_env, "unexpected end of buffer");
yyterminate();
}
}
YY_BREAK
case 18:
YY_RULE_SETUP
#line 270 "re_lexer.l"
{
int i;
yylval->class_vector = (uint8_t*) yr_malloc(32);
memcpy(yylval->class_vector, LEX_ENV->class_vector, 32);
if (LEX_ENV->negated_class)
{
for(i = 0; i < 32; i++)
yylval->class_vector[i] = ~yylval->class_vector[i];
}
BEGIN(INITIAL);
return _CLASS_;
}
YY_BREAK
case 19:
YY_RULE_SETUP
#line 291 "re_lexer.l"
{
uint16_t c;
uint8_t start = yytext[0];
uint8_t end = yytext[2];
if (start == '\\')
{
start = escaped_char_value(yytext);
if (yytext[1] == 'x')
end = yytext[5];
else
end = yytext[3];
}
if (end == '\\')
{
if (!read_escaped_char(yyscanner, &end))
{
yyerror(yyscanner, lex_env, "unexpected end of buffer");
yyterminate();
}
}
if (end < start)
{
yyerror(yyscanner, lex_env, "bad character range");
yyterminate();
}
for (c = start; c <= end; c++)
{
LEX_ENV->class_vector[c / 8] |= 1 << c % 8;
}
}
YY_BREAK
case 20:
YY_RULE_SETUP
#line 333 "re_lexer.l"
{
int i;
for (i = 0; i < 32; i++)
LEX_ENV->class_vector[i] |= word_chars[i];
}
YY_BREAK
case 21:
YY_RULE_SETUP
#line 342 "re_lexer.l"
{
int i;
for (i = 0; i < 32; i++)
LEX_ENV->class_vector[i] |= ~word_chars[i];
}
YY_BREAK
case 22:
YY_RULE_SETUP
#line 351 "re_lexer.l"
{
LEX_ENV->class_vector[' ' / 8] |= 1 << ' ' % 8;
LEX_ENV->class_vector['\t' / 8] |= 1 << '\t' % 8;
}
YY_BREAK
case 23:
YY_RULE_SETUP
#line 358 "re_lexer.l"
{
int i;
for (i = 0; i < 32; i++)
{
if (i == ' ' / 8)
LEX_ENV->class_vector[i] |= ~(1 << ' ' % 8);
else if (i == '\t' / 8)
LEX_ENV->class_vector[i] |= ~(1 << '\t' % 8);
else
LEX_ENV->class_vector[i] = 0xFF;
}
}
YY_BREAK
case 24:
YY_RULE_SETUP
#line 374 "re_lexer.l"
{
char c;
for (c = '0'; c <= '9'; c++)
LEX_ENV->class_vector[c / 8] |= 1 << c % 8;
}
YY_BREAK
case 25:
YY_RULE_SETUP
#line 383 "re_lexer.l"
{
int i;
for (i = 0; i < 32; i++)
{
if (i == 6)
continue;
if (i == 7)
LEX_ENV->class_vector[i] |= 0xFC;
else
LEX_ENV->class_vector[i] = 0xFF;
}
}
YY_BREAK
case 26:
YY_RULE_SETUP
#line 403 "re_lexer.l"
{
uint8_t c;
if (read_escaped_char(yyscanner, &c))
{
LEX_ENV->class_vector[c / 8] |= 1 << c % 8;
}
else
{
yyerror(yyscanner, lex_env, "unexpected end of buffer");
yyterminate();
}
}
YY_BREAK
case 27:
YY_RULE_SETUP
#line 419 "re_lexer.l"
{
if (yytext[0] >= 32 && yytext[0] < 127)
{
LEX_ENV->class_vector[yytext[0] / 8] |= 1 << yytext[0] % 8;
}
else
{
yyerror(yyscanner, lex_env, "non-ascii character");
yyterminate();
}
}
YY_BREAK
case YY_STATE_EOF(char_class):
#line 436 "re_lexer.l"
{
yyerror(yyscanner, lex_env, "missing terminating ] for character class");
yyterminate();
}
YY_BREAK
case 28:
YY_RULE_SETUP
#line 445 "re_lexer.l"
{
if (yytext[0] >= 32 && yytext[0] < 127)
{
return yytext[0];
}
else
{
yyerror(yyscanner, lex_env, "non-ascii character");
yyterminate();
}
}
YY_BREAK
case YY_STATE_EOF(INITIAL):
#line 459 "re_lexer.l"
{
yyterminate();
}
YY_BREAK
case 29:
YY_RULE_SETUP
#line 464 "re_lexer.l"
ECHO;
YY_BREAK
#line 1358 "re_lexer.c"
case YY_END_OF_BUFFER:
{
int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
*yy_cp = yyg->yy_hold_char;
YY_RESTORE_YY_MORE_OFFSET
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
{
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
}
if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
{
yy_state_type yy_next_state;
yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( yyscanner );
yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
if ( yy_next_state )
{
yy_cp = ++yyg->yy_c_buf_p;
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer( yyscanner ) )
{
case EOB_ACT_END_OF_FILE:
{
yyg->yy_did_buffer_switch_on_eof = 0;
if ( re_yywrap(yyscanner ) )
{
yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! yyg->yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
yyg->yy_c_buf_p =
yyg->yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( yyscanner );
yy_cp = yyg->yy_c_buf_p;
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
yyg->yy_c_buf_p =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
yy_current_state = yy_get_previous_state( yyscanner );
yy_cp = yyg->yy_c_buf_p;
yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} | 1 | 209,249,342 | -1 | https://github.com/VirusTotal/yara/commit/3119b232c9c453c98d8fa8b6ae4e37ba18117cd4 | 0CCPP |
SFTPWrapper.prototype.futimes = function(handle, atime, mtime, cb) {
return this._stream.futimes(handle, atime, mtime, cb);
}; | 1 | 0,1,2 | -1 | https://github.com/mscdex/ssh2/commit/f763271f41320e71d5cbee02ea5bc6a2ded3ca21 | 3JavaScript |
public FileOutputStream(File file) throws IOException {
this(file.getPath());
} | 0 | null | -1 | https://github.com/ReadyTalk/avian/commit/0871979b298add320ca63f65060acb7532c8a0dd | 2Java |
var head = function (array) {
return array[0];
}; | 0 | null | -1 | https://github.com/semplon/GeniXCMS/commit/d885eb20006099262c0278932b9f8aca3c1ac97f | 3JavaScript |
set_interface_var(const char *iface,
const char *var, const char *name,
uint32_t val)
{
FILE *fp;
char spath[64+IFNAMSIZ];
if (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))
return -1;
if (access(spath, F_OK) != 0)
return -1;
fp = fopen(spath, "w");
if (!fp) {
if (name)
flog(LOG_ERR, "failed to set %s (%u) for %s: %s",
name, val, iface, strerror(errno));
return -1;
}
fprintf(fp, "%u", val);
fclose(fp);
return 0;
} | 1 | null | -1 | https://github.com/radvd-project/radvd/commit/92e22ca23e52066da2258df8c76a2dca8a428bcc | 0CCPP |
nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner)
{
DECODE_HEAD;
if (argp->minorversion >= 1)
return nfserr_notsupp;
READ_BUF(12);
COPYMEM(&rlockowner->rl_clientid, sizeof(clientid_t));
rlockowner->rl_owner.len = be32_to_cpup(p++);
READ_BUF(rlockowner->rl_owner.len);
READMEM(rlockowner->rl_owner.data, rlockowner->rl_owner.len);
if (argp->minorversion && !zero_clientid(&rlockowner->rl_clientid))
return nfserr_inval;
DECODE_TAIL;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/f961e3f2acae94b727380c0b74e2d3954d0edf79 | 0CCPP |
swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
{
uint32* wp = (uint32*) cp0;
tmsize_t wc = cc / 4;
horDiff32(tif, cp0, cc);
TIFFSwabArrayOfLong(wp, wc);
} | 1 | 4 | -1 | https://github.com/vadz/libtiff/commit/3ca657a8793dd011bf869695d72ad31c779c3cc1 | 0CCPP |
public void export(Identity identity, ManifestBuilder manifest, File archiveDirectory, Locale locale) {
List<Property> disclaimerProperties = propertyManager.listProperties(identity, null, null, "user", "dislaimer_accepted");
if(disclaimerProperties.isEmpty()) return;
Translator translator = Util.createPackageTranslator(RegistrationManager.class, locale);
File disclaimerArchive = new File(archiveDirectory, "Disclaimer.txt");
try(Writer out = new FileWriter(disclaimerArchive)) {
for(Property disclaimerProperty:disclaimerProperties) {
out.write(FilterFactory.getHtmlTagsFilter().filter(translator.translate("disclaimer.terms.of.usage")));
out.write('\n');
out.write("Accepted: " + Formatter.getInstance(locale).formatDateAndTime(disclaimerProperty.getCreationDate()));
out.write('\n');
StringBuilder sb = new StringBuilder();
sb.append(translator.translate("disclaimer.paragraph1"))
.append("\n")
.append(translator.translate("disclaimer.paragraph2"));
String disclaimer = new HtmlFilter().filter(sb.toString(), true);
out.write(disclaimer);
}
} catch (IOException e) {
log.error("Unable to export xlsx", e);
}
manifest.appendFile(disclaimerArchive.getName());
} | 0 | null | -1 | https://github.com/OpenOLAT/OpenOLAT/commit/3f219ac457afde82e3be57bc614352ab92c05684 | 2Java |
static void conn_to_str(const conn *c, char *addr, char *svr_addr) {
if (!c) {
strcpy(addr, "<null>");
} else if (c->state == conn_closed) {
strcpy(addr, "<closed>");
} else {
struct sockaddr_in6 local_addr;
struct sockaddr *sock_addr = (void *)&c->request_addr;
if (c->state == conn_listening ||
(IS_UDP(c->transport) &&
c->state == conn_read)) {
socklen_t local_addr_len = sizeof(local_addr);
if (getsockname(c->sfd,
(struct sockaddr *)&local_addr,
&local_addr_len) == 0) {
sock_addr = (struct sockaddr *)&local_addr;
}
}
get_conn_text(c, sock_addr->sa_family, addr, sock_addr);
if (c->state != conn_listening && !(IS_UDP(c->transport) &&
c->state == conn_read)) {
struct sockaddr_storage svr_sock_addr;
socklen_t svr_addr_len = sizeof(svr_sock_addr);
getsockname(c->sfd, (struct sockaddr *)&svr_sock_addr, &svr_addr_len);
get_conn_text(c, svr_sock_addr.ss_family, svr_addr, (struct sockaddr *)&svr_sock_addr);
}
}
} | 0 | null | -1 | https://github.com/memcached/memcached/commit/554b56687a19300a75ec24184746b5512580c819 | 0CCPP |
(function(){function g(b,a,g,f,h){for(var d=a++;a<g&&"{"!==b[a]&&";"!==b[a];)++a;if(a<g&&(h||";"===b[a])){var h=d+1,e=a;h<g&&" "===b[h]&&++h;e>h&&" "===b[e-1]&&--e;f.startAtrule&&f.startAtrule(b[d].toLowerCase(),b.slice(h,e));a="{"===b[a]?w(b,a,g,f):a+1;f.endAtrule&&f.endAtrule()}return a}function w(b,a,k,f){++a;for(f.startBlock&&f.startBlock();a<k;){var h=b[a].charAt(0);if("}"==h){++a;break}a=" "===h||";"===h?a+1:"@"===h?g(b,a,k,f,C):"{"===h?w(b,a,k,f):M(b,a,k,f)}f.endBlock&&f.endBlock();return a} | 1 | 0 | -1 | https://github.com/jgraph/drawio/commit/f768ed73875d5eca20110b9c1d72f2789cd1bab7 | 3JavaScript |
static void crypto_authenc_encrypt_done(struct crypto_async_request *req,
int err)
{
struct aead_request *areq = req->data;
if (!err) {
struct crypto_aead *authenc = crypto_aead_reqtfm(areq);
struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);
struct authenc_request_ctx *areq_ctx = aead_request_ctx(areq);
struct ablkcipher_request *abreq = (void *)(areq_ctx->tail
+ ctx->reqoff);
u8 *iv = (u8 *)abreq - crypto_ablkcipher_ivsize(ctx->enc);
err = crypto_authenc_genicv(areq, iv, 0);
}
authenc_request_complete(areq, err);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/4943ba16bbc2db05115707b3ff7b4874e9e3c560 | 0CCPP |
public async Task<AssetsModel> Get(int page = 1, string filter = "", string search = "")
{
var pager = new Pager(page);
IEnumerable<AssetItem> items;
if (string.IsNullOrEmpty(search))
{
if (filter == "filterImages")
{
items = await _store.Find(a => a.AssetType == AssetType.Image, pager);
}
else if (filter == "filterAttachments")
{
items = await _store.Find(a => a.AssetType == AssetType.Attachment, pager);
}
else
{
items = await _store.Find(null, pager);
}
}
else
{
items = await _store.Find(a => a.Title.Contains(search), pager);
}
if (page < 1 || page > pager.LastPage)
return null;
return new AssetsModel
{
Assets = items,
Pager = pager
};
} | 1 | 8,12,16,21 | -1 | https://github.com/blogifierdotnet/Blogifier/commit/3e2ae11f6be8aab82128f223c2916fab5a408be5 | 1CS |
public int getProtocolVersion() {
if (!PGProperty.PROTOCOL_VERSION.isPresent(properties)) {
return 0;
} else {
return PGProperty.PROTOCOL_VERSION.getIntNoCheck(properties);
}
} | 0 | null | -1 | https://github.com/pgjdbc/pgjdbc/commit/14b62aca4764d496813f55a43d050b017e01eb65 | 2Java |
def _inject_key_into_fs(key, fs, execute=None):
sshdir = os.path.join(fs, "root", ".ssh")
utils.execute("mkdir", "-p", sshdir, run_as_root=True)
utils.execute("chown", "root", sshdir, run_as_root=True)
utils.execute("chmod", "700", sshdir, run_as_root=True)
keyfile = os.path.join(sshdir, "authorized_keys")
key_data = [
"\n",
"# The following ssh key was injected by Nova",
"\n",
key.strip(),
"\n",
]
utils.execute(
"tee",
"-a",
keyfile,
process_input="".join(key_data),
run_as_root=True,
)
| 1 | 1,5,6,12,16,19 | -1 | https://github.com/openstack/nova.git/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7 | 4Python |
def passthrough(self, event: events.Event) -> layer.CommandGenerator[None]:
assert self.stream_id
if isinstance(event, events.DataReceived):
yield ReceiveHttp(self.ReceiveData(self.stream_id, event.data))
elif isinstance(event, events.ConnectionClosed):
if isinstance(self, Http1Server):
yield ReceiveHttp(RequestEndOfMessage(self.stream_id))
else:
yield ReceiveHttp(ResponseEndOfMessage(self.stream_id))
| 0 | null | -1 | https://github.com/mitmproxy/mitmproxy.git/commit/b06fb6d157087d526bd02e7aadbe37c56865c71b | 4Python |
def _handle_new_user(to_save, content, languages, translations, kobo_support):
content.default_language = to_save["default_language"]
content.locale = to_save.get("locale", content.locale)
content.sidebar_view = sum(
int(key[5:]) for key in to_save if key.startswith("show_")
)
if "show_detail_random" in to_save:
content.sidebar_view |= constants.DETAIL_RANDOM
content.role = constants.selected_roles(to_save)
content.password = generate_password_hash(to_save["password"])
try:
if not to_save["name"] or not to_save["email"] or not to_save["password"]:
log.info("Missing entries on new user")
raise Exception(_("Please fill out all fields!"))
content.email = check_email(to_save["email"])
content.name = check_username(to_save["name"])
if to_save.get("kindle_mail"):
content.kindle_mail = valid_email(to_save["kindle_mail"])
if config.config_public_reg and not check_valid_domain(content.email):
log.info(
"E-mail: {} for new user is not from valid domain".format(content.email)
)
raise Exception(_("E-mail is not from valid domain"))
except Exception as ex:
flash(str(ex), category="error")
return render_title_template(
"user_edit.html",
new_user=1,
content=content,
config=config,
translations=translations,
languages=languages,
title=_("Add new user"),
page="newuser",
kobo_support=kobo_support,
registered_oauth=oauth_check,
)
try:
content.allowed_tags = config.config_allowed_tags
content.denied_tags = config.config_denied_tags
content.allowed_column_value = config.config_allowed_column_value
content.denied_column_value = config.config_denied_column_value
content.kobo_only_shelves_sync = (
to_save.get("kobo_only_shelves_sync", 0) == "on"
)
ub.session.add(content)
ub.session.commit()
flash(_("User '%(user)s' created", user=content.name), category="success")
log.debug("User {} created".format(content.name))
return redirect(url_for("admin.admin"))
except IntegrityError:
ub.session.rollback()
log.error(
"Found an existing account for {} or {}".format(content.name, content.email)
)
flash(
_("Found an existing account for this e-mail address or name."),
category="error",
)
except OperationalError:
ub.session.rollback()
log.error("Settings DB is not Writeable")
flash(_("Settings DB is not Writeable"), category="error")
| 0 | null | -1 | https://github.com/janeczku/calibre-web.git/commit/785726deee13b4d56f6c3503dd57c1e3eb7d6f30 | 4Python |
mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
int len, bool more)
{
struct page *page = virt_to_head_page(data);
int offset = data - page_address(page);
struct sk_buff *skb = q->rx_head;
offset += q->buf_offset;
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, offset, len,
q->buf_size);
if (more)
return;
q->rx_head = NULL;
dev->drv->rx_skb(dev, q - dev->q_rx, skb);
} | 1 | 6,7,8 | -1 | https://github.com/torvalds/linux/commit/b102f0c522cf668c8382c56a4f771b37d011cda2 | 0CCPP |
static void __evtchn_fifo_handle_events(unsigned cpu, bool drop)
{
struct evtchn_fifo_control_block *control_block;
unsigned long ready;
unsigned q;
control_block = per_cpu(cpu_control_block, cpu);
ready = xchg(&control_block->ready, 0);
while (ready) {
q = find_first_bit(&ready, EVTCHN_FIFO_MAX_QUEUES);
consume_one_event(cpu, control_block, q, &ready, drop);
ready |= xchg(&control_block->ready, 0);
}
} | 1 | 0,9 | -1 | https://github.com/torvalds/linux/commit/e99502f76271d6bc4e374fe368c50c67a1fd3070 | 0CCPP |
Bool gf_bs_is_align(GF_BitStream *bs)
{
switch (bs->bsmode) {
case GF_BITSTREAM_READ:
case GF_BITSTREAM_FILE_READ:
return ( (8 == bs->nbBits) ? GF_TRUE : GF_FALSE);
default:
return !bs->nbBits;
}
} | 0 | null | -1 | https://github.com/gpac/gpac/commit/9ea93a2ec8f555ceed1ee27294cf94822f14f10f | 0CCPP |
static int do_putenv(char **env, const char *name, int size, int free_old)
{
int i = bsearchenv(env, name, size - 1);
if (i >= 0 && free_old)
free(env[i]);
if (strchr(name, '=')) {
if (i < 0) {
i = ~i;
memmove(&env[i + 1], &env[i], (size - i) * sizeof(char*));
size++;
}
env[i] = (char*) name;
} else if (i >= 0) {
size--;
memmove(&env[i], &env[i + 1], (size - i) * sizeof(char*));
}
return size;
} | 0 | null | -1 | https://github.com/git/git/commit/684dd4c2b414bcf648505e74498a608f28de4592 | 0CCPP |
void acct_update_integrals(struct task_struct *tsk)
{
if (likely(tsk->mm)) {
long delta = cputime_to_jiffies(
cputime_sub(tsk->stime, tsk->acct_stimexpd));
if (delta == 0)
return;
tsk->acct_stimexpd = tsk->stime;
tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
}
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/f0ec1aaf54caddd21c259aea8b2ecfbde4ee4fb9 | 0CCPP |
int perf_event_overflow(struct perf_event *event, int nmi,
struct perf_sample_data *data,
struct pt_regs *regs)
{
return __perf_event_overflow(event, nmi, 1, data, regs);
} | 1 | 0,4 | -1 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 0CCPP |
allowedDomains:["app.diagrams.net"]},setMigratedFlag:{isAsync:!1,allowedDomains:["app.diagrams.net"]}};EditorUi.prototype.remoteInvokeCallbacks=[];EditorUi.prototype.remoteInvokeQueue=[];EditorUi.prototype.handleRemoteInvokeReady=function(d){this.remoteWin=d;for(var f=0;f<this.remoteInvokeQueue.length;f++)d.postMessage(this.remoteInvokeQueue[f],"*");this.remoteInvokeQueue=[]};EditorUi.prototype.handleRemoteInvokeResponse=function(d){var f=d.msgMarkers,g=this.remoteInvokeCallbacks[f.callbackId];if(null== | 0 | null | -1 | https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf | 3JavaScript |
Jsi_RC Jsi_PathNormalize(Jsi_Interp *interp, Jsi_Value **pathPtr) {
Jsi_Value *path = *pathPtr;
if (!path) {
Jsi_DString dStr = {};
*pathPtr = Jsi_ValueNewStringDup(interp, Jsi_GetCwd(interp, &dStr));
Jsi_IncrRefCount(interp, *pathPtr);
Jsi_DSFree(&dStr);
} else {
const char *rn = Jsi_Realpath(interp, path, NULL);
if (!rn) return JSI_ERROR;
Jsi_DecrRefCount(interp, *pathPtr);
*pathPtr = Jsi_ValueNewString(interp, rn, -1);
Jsi_IncrRefCount(interp, *pathPtr);
}
return JSI_OK;
} | 0 | null | -1 | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | 0CCPP |
int dn_sockaddr2username(struct sockaddr_dn *sdn, unsigned char *buf, unsigned char type)
{
int len = 2;
*buf++ = type;
switch (type) {
case 0:
*buf++ = sdn->sdn_objnum;
break;
case 1:
*buf++ = 0;
*buf++ = le16_to_cpu(sdn->sdn_objnamel);
memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel));
len = 3 + le16_to_cpu(sdn->sdn_objnamel);
break;
case 2:
memset(buf, 0, 5);
buf += 5;
*buf++ = le16_to_cpu(sdn->sdn_objnamel);
memcpy(buf, sdn->sdn_objname, le16_to_cpu(sdn->sdn_objnamel));
len = 7 + le16_to_cpu(sdn->sdn_objnamel);
break;
}
return len;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/79462ad02e861803b3840cc782248c7359451cd9 | 0CCPP |
int IniSection::dirHelper (const YCPPath&p, YCPList&out,int get_sect,int depth)
{
if (depth >= p->length())
{
return myDir (out, get_sect? SECTION: VALUE);
}
string k = ip->changeCase (p->component_str (depth));
pair <IniSectionIdxIterator, IniSectionIdxIterator> r =
isections.equal_range (k);
IniSectionIdxIterator xi = r.first, xe = r.second;
if (xi != xe)
{
IniSection& s = (--xe)->second->s ();
return s.dirHelper (p, out, get_sect, depth+1);
}
y2debug ("Dir: Invalid path %s [%d]", p->toString().c_str(), depth);
return -1;
} | 0 | null | -1 | https://github.com/yast/yast-core/commit/7fe2e3df308b8b6a901cb2cfd60f398df53219de | 0CCPP |
protected void addLogHandler(Handler handler) {
LOG.addHandler(handler);
} | 0 | null | -1 | https://github.com/apache/cxf/commit/fae6fabf9bd7647f5e9cb68897a7d72b545b741b | 2Java |
int do_fpu_inst(unsigned short inst, struct pt_regs *regs)
{
struct task_struct *tsk = current;
struct sh_fpu_soft_struct *fpu = &(tsk->thread.xstate->softfpu);
perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
if (!(task_thread_info(tsk)->status & TS_USEDFPU)) {
fpu_init(fpu);
task_thread_info(tsk)->status |= TS_USEDFPU;
}
return fpu_emulate(inst, fpu, regs);
} | 1 | 4 | -1 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 0CCPP |
mrb_yield_argv(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value *argv)
{
struct RProc *p = mrb_proc_ptr(b);
return mrb_yield_with_class(mrb, b, argc, argv, MRB_PROC_ENV(p)->stack[0], MRB_PROC_TARGET_CLASS(p));
} | 0 | null | -1 | https://github.com/mruby/mruby/commit/aaa28a508903041dd7399d4159a8ace9766b022f | 0CCPP |
static void sctp_inet6_event_msgname(struct sctp_ulpevent *event,
char *msgname, int *addrlen)
{
struct sockaddr_in6 *sin6, *sin6from;
if (msgname) {
union sctp_addr *addr;
struct sctp_association *asoc;
asoc = event->asoc;
sctp_inet6_msgname(msgname, addrlen);
sin6 = (struct sockaddr_in6 *)msgname;
sin6->sin6_port = htons(asoc->peer.port);
addr = &asoc->peer.primary_addr;
if (sctp_sk(asoc->base.sk)->v4mapped &&
AF_INET == addr->sa.sa_family) {
sctp_v4_map_v6((union sctp_addr *)sin6);
sin6->sin6_addr.s6_addr32[3] =
addr->v4.sin_addr.s_addr;
return;
}
sin6from = &asoc->peer.primary_addr.v6;
sin6->sin6_addr = sin6from->sin6_addr;
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
sin6->sin6_scope_id = sin6from->sin6_scope_id;
}
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/95ee62083cb6453e056562d91f597552021e6ae7 | 0CCPP |
void AOClient::pktHardwareId(AreaData* area, int argc, QStringList argv, AOPacket packet)
{
hwid = argv[0];
auto ban = server->db_manager->isHDIDBanned(hwid);
if (ban.first) {
sendPacket("BD", {ban.second + "\nBan ID: " + QString::number(server->db_manager->getBanID(hwid))});
socket->close();
return;
}
sendPacket("ID", {QString::number(id), "akashi", QCoreApplication::applicationVersion()});
} | 0 | null | -1 | https://github.com/AttorneyOnline/akashi/commit/5566cdfedddef1f219aee33477d9c9690bf2f78b | 0CCPP |
static int ext4_write_end(struct file *file,
struct address_space *mapping,
loff_t pos, unsigned len, unsigned copied,
struct page *page, void *fsdata)
{
handle_t *handle = ext4_journal_current_handle();
struct inode *inode = mapping->host;
loff_t old_size = inode->i_size;
int ret = 0, ret2;
int i_size_changed = 0;
trace_ext4_write_end(inode, pos, len, copied);
if (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE)) {
ret = ext4_jbd2_file_inode(handle, inode);
if (ret) {
unlock_page(page);
put_page(page);
goto errout;
}
}
if (ext4_has_inline_data(inode)) {
ret = ext4_write_inline_data_end(inode, pos, len,
copied, page);
if (ret < 0)
goto errout;
copied = ret;
} else
copied = block_write_end(file, mapping, pos,
len, copied, page, fsdata);
i_size_changed = ext4_update_inode_size(inode, pos + copied);
unlock_page(page);
put_page(page);
if (old_size < pos)
pagecache_isize_extended(inode, old_size, pos);
if (i_size_changed)
ext4_mark_inode_dirty(handle, inode);
if (pos + len > inode->i_size && ext4_can_truncate(inode))
ext4_orphan_add(handle, inode);
errout:
ret2 = ext4_journal_stop(handle);
if (!ret)
ret = ret2;
if (pos + len > inode->i_size) {
ext4_truncate_failed_write(inode);
if (inode->i_nlink)
ext4_orphan_del(NULL, inode);
}
return ret ? ret : copied;
} | 1 | 11,12,13,14,15,16,17,18 | -1 | https://github.com/torvalds/linux/commit/06bd3c36a733ac27962fea7d6f47168841376824 | 0CCPP |
bitsetbit(PG_FUNCTION_ARGS)
{
VarBit *arg1 = PG_GETARG_VARBIT_P(0);
int32 n = PG_GETARG_INT32(1);
int32 newBit = PG_GETARG_INT32(2);
VarBit *result;
int len,
bitlen;
bits8 *r,
*p;
int byteNo,
bitNo;
bitlen = VARBITLEN(arg1);
if (n < 0 || n >= bitlen)
ereport(ERROR,
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
errmsg("bit index %d out of valid range (0..%d)",
n, bitlen - 1)));
if (newBit != 0 && newBit != 1)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("new bit must be 0 or 1")));
len = VARSIZE(arg1);
result = (VarBit *) palloc(len);
SET_VARSIZE(result, len);
VARBITLEN(result) = bitlen;
p = VARBITS(arg1);
r = VARBITS(result);
memcpy(r, p, VARBITBYTES(arg1));
byteNo = n / BITS_PER_BYTE;
bitNo = BITS_PER_BYTE - 1 - (n % BITS_PER_BYTE);
if (newBit == 0)
r[byteNo] &= (~(1 << bitNo));
else
r[byteNo] |= (1 << bitNo);
PG_RETURN_VARBIT_P(result);
} | 0 | null | -1 | https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a | 0CCPP |
static int _nfs41_proc_get_locations(struct inode *inode,
struct nfs4_fs_locations *locations,
struct page *page, struct rpc_cred *cred)
{
struct nfs_server *server = NFS_SERVER(inode);
struct rpc_clnt *clnt = server->client;
u32 bitmask[2] = {
[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
};
struct nfs4_fs_locations_arg args = {
.fh = NFS_FH(inode),
.page = page,
.bitmask = bitmask,
.migration = 1,
};
struct nfs4_fs_locations_res res = {
.fs_locations = locations,
.migration = 1,
};
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FS_LOCATIONS],
.rpc_argp = &args,
.rpc_resp = &res,
.rpc_cred = cred,
};
int status;
nfs_fattr_init(&locations->fattr);
locations->server = server;
locations->nlocations = 0;
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
nfs4_set_sequence_privileged(&args.seq_args);
status = nfs4_call_sync_sequence(clnt, server, &msg,
&args.seq_args, &res.seq_res);
if (status == NFS4_OK &&
res.seq_res.sr_status_flags & SEQ4_STATUS_LEASE_MOVED)
status = -NFS4ERR_LEASE_MOVED;
return status;
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/18e3b739fdc826481c6a1335ce0c5b19b3d415da | 0CCPP |
void macvlan_common_setup(struct net_device *dev)
{
ether_setup(dev);
dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
dev->netdev_ops = &macvlan_netdev_ops;
dev->destructor = free_netdev;
dev->header_ops = &macvlan_hard_header_ops,
dev->ethtool_ops = &macvlan_ethtool_ops;
} | 1 | 3 | -1 | https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162 | 0CCPP |
bqarr_in(PG_FUNCTION_ARGS)
{
char *buf = (char *) PG_GETARG_POINTER(0);
WORKSTATE state;
int32 i;
QUERYTYPE *query;
int32 commonlen;
ITEM *ptr;
NODE *tmp;
int32 pos = 0;
#ifdef BS_DEBUG
StringInfoData pbuf;
#endif
state.buf = buf;
state.state = WAITOPERAND;
state.count = 0;
state.num = 0;
state.str = NULL;
makepol(&state);
if (!state.num)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("empty query")));
commonlen = COMPUTESIZE(state.num);
query = (QUERYTYPE *) palloc(commonlen);
SET_VARSIZE(query, commonlen);
query->size = state.num;
ptr = GETQUERY(query);
for (i = state.num - 1; i >= 0; i--)
{
ptr[i].type = state.str->type;
ptr[i].val = state.str->val;
tmp = state.str->next;
pfree(state.str);
state.str = tmp;
}
pos = query->size - 1;
findoprnd(ptr, &pos);
#ifdef BS_DEBUG
initStringInfo(&pbuf);
for (i = 0; i < query->size; i++)
{
if (ptr[i].type == OPR)
appendStringInfo(&pbuf, "%c(%d) ", ptr[i].val, ptr[i].left);
else
appendStringInfo(&pbuf, "%d ", ptr[i].val);
}
elog(DEBUG3, "POR: %s", pbuf.data);
pfree(pbuf.data);
#endif
PG_RETURN_POINTER(query);
} | 1 | null | -1 | https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a | 0CCPP |
static inline void ttwu_post_activation(struct task_struct *p, struct rq *rq,
int wake_flags, bool success)
{
trace_sched_wakeup(p, success);
check_preempt_curr(rq, p, wake_flags);
p->state = TASK_RUNNING;
#ifdef CONFIG_SMP
if (p->sched_class->task_woken)
p->sched_class->task_woken(rq, p);
if (unlikely(rq->idle_stamp)) {
u64 delta = rq->clock - rq->idle_stamp;
u64 max = 2*sysctl_sched_migration_cost;
if (delta > max)
rq->avg_idle = max;
else
update_avg(&rq->avg_idle, delta);
rq->idle_stamp = 0;
}
#endif
if ((p->flags & PF_WQ_WORKER) && success)
wq_worker_waking_up(p, cpu_of(rq));
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/f26f9aff6aaf67e9a430d16c266f91b13a5bff64 | 0CCPP |
arguments):(this.addOp(this.lineOp,O,R),this.lastX=O,this.lastY=R)};p.prototype.moveTo=function(O,R){this.passThrough?this.originalMoveTo.apply(this.canvas,arguments):(this.addOp(this.moveOp,O,R),this.lastX=O,this.lastY=R,this.firstX=O,this.firstY=R)};p.prototype.close=function(){this.passThrough?this.originalClose.apply(this.canvas,arguments):this.addOp(this.closeOp)};p.prototype.quadTo=function(O,R,Y,da){this.passThrough?this.originalQuadTo.apply(this.canvas,arguments):(this.addOp(this.quadOp,O,
R,Y,da),this.lastX=Y,this.lastY=da)};p.prototype.curveTo=function(O,R,Y,da,ha,Z){this.passThrough?this.originalCurveTo.apply(this.canvas,arguments):(this.addOp(this.curveOp,O,R,Y,da,ha,Z),this.lastX=ha,this.lastY=Z)};p.prototype.arcTo=function(O,R,Y,da,ha,Z,ea){if(this.passThrough)this.originalArcTo.apply(this.canvas,arguments);else{var aa=mxUtils.arcToCurves(this.lastX,this.lastY,O,R,Y,da,ha,Z,ea);if(null!=aa)for(var ua=0;ua<aa.length;ua+=6)this.curveTo(aa[ua],aa[ua+1],aa[ua+2],aa[ua+3],aa[ua+4], | 1 | 1 | -1 | https://github.com/jgraph/drawio/commit/4deecee18191f67e242422abf3ca304e19e49687 | 3JavaScript |
mxShapeMockupVideoPlayer.prototype.otherShapes=function(a,d,e,b,c,f,g,h,k,l){var m=mxUtils.getValue(this.style,mxShapeMockupVideoPlayer.prototype.cst.BAR_POS,"20");m=Math.max(0,m);m=Math.min(100,m);d=mxUtils.getValue(this.style,mxConstants.STYLE_STROKEWIDTH,"1");e=c-l;m=8+(b-8-8)*m/100;a.setStrokeColor(h);a.begin();a.moveTo(0,e);a.lineTo(m,e);a.stroke();a.setStrokeColor(k);a.begin();a.moveTo(m,e);a.lineTo(b,e);a.stroke();a.setStrokeColor(g);a.begin();a.ellipse(m-8,e-8,16,16);a.fillAndStroke();a.begin();
a.setStrokeWidth(d/2);a.ellipse(m-4,e-4,8,8);a.fillAndStroke();a.setStrokeWidth(d);g=.3*l;h=c-.5*(l+g);k=.3*l;a.setFillColor(f);a.setStrokeColor(f);a.begin();a.moveTo(k,h);a.lineTo(k+g,h+.5*g);a.lineTo(k,h+g);a.close();a.fillAndStroke();f=c-l;a.moveTo(l+.05*l,f+.4*l);a.lineTo(l+.15*l,f+.4*l);a.lineTo(l+.3*l,f+.25*l);a.lineTo(l+.3*l,f+.75*l);a.lineTo(l+.15*l,f+.6*l);a.lineTo(l+.05*l,f+.6*l);a.close();a.fillAndStroke();a.begin();a.moveTo(l+.4*l,f+.35*l);a.arcTo(.2*l,.3*l,0,0,1,l+.4*l,f+.65*l);a.moveTo(l+
.425*l,f+.25*l);a.arcTo(.225*l,.35*l,0,0,1,l+.425*l,f+.75*l);a.stroke();b-=1.3*l;a.begin();a.moveTo(b+.1*l,f+.4*l);a.lineTo(b+.1*l,f+.3*l);a.lineTo(b+.25*l,f+.3*l);a.moveTo(b+.1*l,f+.6*l);a.lineTo(b+.1*l,f+.7*l);a.lineTo(b+.25*l,f+.7*l);a.moveTo(b+.9*l,f+.4*l);a.lineTo(b+.9*l,f+.3*l);a.lineTo(b+.75*l,f+.3*l);a.moveTo(b+.9*l,f+.6*l);a.lineTo(b+.9*l,f+.7*l);a.lineTo(b+.75*l,f+.7*l);a.stroke();b=mxUtils.getValue(this.style,mxShapeMockupVideoPlayer.prototype.cst.TEXT_COLOR,"#666666");a.begin();a.setFontSize(.5*
l);a.setFontColor(b);a.text(1.9*l,c-.45*l,0,0,"0:00/3:53",mxConstants.ALIGN_LEFT,mxConstants.ALIGN_MIDDLE,0,null,0,0,0)};mxCellRenderer.registerShape(mxShapeMockupVideoPlayer.prototype.cst.SHAPE_VIDEO_PLAYER,mxShapeMockupVideoPlayer); | 0 | null | -1 | https://github.com/jgraph/drawio/commit/c63f3a04450f30798df47f9badbc74eb8a69fbdf | 3JavaScript |
private ZonedDateTime toZonedDateTime(XMLGregorianCalendar instant) {
if (instant == null) {
return null;
}
return instant.toGregorianCalendar().toZonedDateTime();
} | 1 | 0,1,2,3,4,5 | -1 | https://github.com/FusionAuth/fusionauth-samlv2/commit/c66fb689d50010662f705d5b585c6388ce555dbd | 2Java |
static void wake_oom_reaper(struct task_struct *tsk)
{
if (tsk == oom_reaper_list || tsk->oom_reaper_list)
return;
get_task_struct(tsk);
spin_lock(&oom_reaper_lock);
tsk->oom_reaper_list = oom_reaper_list;
oom_reaper_list = tsk;
spin_unlock(&oom_reaper_lock);
trace_wake_reaper(tsk->pid);
wake_up(&oom_reaper_wait);
} | 0 | null | -1 | https://github.com/torvalds/linux/commit/687cb0884a714ff484d038e9190edc874edcf146 | 0CCPP |
sasl_handle_login(struct sasl_session *const restrict p, struct user *const u, struct myuser *mu)
{
bool was_killed = false;
if (! mu)
{
if (! *p->authzeid)
{
(void) slog(LG_INFO, "%s: session for '%s' without an authzeid (BUG)",
MOWGLI_FUNC_NAME, u->nick);
(void) notice(saslsvs->nick, u->nick, LOGIN_CANCELLED_STR);
return false;
}
if (! (mu = myuser_find_uid(p->authzeid)))
{
if (*p->authzid)
(void) notice(saslsvs->nick, u->nick, "Account %s dropped; login cancelled",
p->authzid);
else
(void) notice(saslsvs->nick, u->nick, "Account dropped; login cancelled");
return false;
}
}
if (u->myuser && u->myuser != mu)
{
if (is_soper(u->myuser))
(void) logcommand_user(saslsvs, u, CMDLOG_ADMIN, "DESOPER: \2%s\2 as \2%s\2",
u->nick, entity(u->myuser)->name);
(void) logcommand_user(saslsvs, u, CMDLOG_LOGIN, "LOGOUT");
if (! (was_killed = ircd_on_logout(u, entity(u->myuser)->name)))
{
mowgli_node_t *n;
MOWGLI_ITER_FOREACH(n, u->myuser->logins.head)
{
if (n->data == u)
{
(void) mowgli_node_delete(n, &u->myuser->logins);
(void) mowgli_node_free(n);
break;
}
}
u->myuser = NULL;
}
}
if (! was_killed)
{
if (u->myuser != mu)
{
(void) myuser_login(saslsvs, u, mu, false);
(void) logcommand_user(saslsvs, u, CMDLOG_LOGIN, "LOGIN (%s)", p->mechptr->name);
}
else
{
mu->lastlogin = CURRTIME;
(void) logcommand_user(saslsvs, u, CMDLOG_LOGIN, "REAUTHENTICATE (%s)", p->mechptr->name);
}
}
return true;
} | 1 | 5,7,12 | -1 | https://github.com/atheme/atheme/commit/4e664c75d0b280a052eb8b5e81aa41944e593c52 | 0CCPP |
function updateSelectedTags(tags, selected, selectedColor, filter)
{
tagCloud.innerHTML = '';
var title = document.createElement('div');
title.style.marginBottom = '8px';
mxUtils.write(title, (filter != null) ? 'Select hidden tags:' : 'Or add/remove existing tags for cell(s):');
tagCloud.appendChild(title);
var found = 0;
for (var i = 0; i < tags.length; i++)
{
if (filter == null || tags[i].substring(0, filter.length) == filter)
{
var span = document.createElement('span');
span.style.display = 'inline-block';
span.style.padding = '6px 8px';
span.style.borderRadius = '6px';
span.style.marginBottom = '8px';
span.style.maxWidth = '80px';
span.style.overflow = 'hidden';
span.style.textOverflow = 'ellipsis';
span.style.cursor = 'pointer';
span.setAttribute('title', tags[i]);
span.style.border = '1px solid #808080';
mxUtils.write(span, tags[i]);
if (selected[tags[i]])
{
span.style.background = selectedColor;
span.style.color = '#ffffff';
}
else
{
span.style.background = (Editor.isDarkMode()) ? 'transparent' : '#ffffff';
}
mxEvent.addListener(span, 'click', (function(tag)
{
return function()
{
if (!selected[tag])
{
if (!graph.isSelectionEmpty())
{
graph.addTagsForCells(graph.getSelectionCells(), [tag])
}
else
{
hiddenTags[tag] = true;
hiddenTagCount++;
refreshUi();
window.setTimeout(function()
{
graph.refresh();
}, 0);
}
}
else
{
if (!graph.isSelectionEmpty())
{
graph.removeTagsForCells(graph.getSelectionCells(), [tag])
}
else
{
delete hiddenTags[tag];
hiddenTagCount--;
refreshUi();
window.setTimeout(function()
{
graph.refresh();
}, 0);
}
}
};
})(tags[i]));
tagCloud.appendChild(span);
mxUtils.write(tagCloud, ' ');
found++;
}
}
if (found == 0)
{
mxUtils.write(tagCloud, 'No tags found');
}
}; | 1 | 2 | -1 | https://github.com/jgraph/drawio/commit/3d3f819d7a04da7d53b37cc0ca4269c157ba2825 | 3JavaScript |
static void pdo_stmt_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC)
{
struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter->data;
if (I->fetch_ahead) {
zval_ptr_dtor(&I->fetch_ahead);
I->fetch_ahead = NULL;
}
MAKE_STD_ZVAL(I->fetch_ahead);
if (!do_fetch(I->stmt, TRUE, I->fetch_ahead, PDO_FETCH_USE_DEFAULT,
PDO_FETCH_ORI_NEXT, 0, 0 TSRMLS_CC)) {
pdo_stmt_t *stmt = I->stmt;
PDO_HANDLE_STMT_ERR();
I->key = (ulong)-1;
FREE_ZVAL(I->fetch_ahead);
I->fetch_ahead = NULL;
return;
}
I->key++; | 0 | null | -1 | https://github.com/php/php-src/commit/6045de69c7dedcba3eadf7c4bba424b19c81d00d | 0CCPP |
b=RegExp("\\\\(?:(?:[0-9a-fA-F]{1,6}[\\t\\n\\f ]?|[\\u0020-\\u007e\\u0080-\\ud7ff\\ue000\\ufffd]|[\\ud800-\\udbff][\\udc00-\\udfff])|[\\n\\f])","g"),a=RegExp("^url\\([\\t\\n\\f ]*[\"']?|[\"']?[\\t\\n\\f ]*\\)$","gi");X=function(a){return a.replace(b,g)};U=function(b){for(var b=(""+b).replace(/\r\n?/g,"\n").match(v)||[],f=0,h=" ",d=0,y=b.length;d<y;++d){var l=X(b[d]),V=l.length,g=l.charCodeAt(0),l=34==g||39==g?w(l.substring(1,V-1),M):47==g&&1<V||"\\"==l||"--\>"==l||"<\!--"==l||"\ufeff"==l||32>=g?" ":
/url\(/i.test(l)?"url("+w(l.replace(a,""),x)+")":l;if(h!=l||" "!=l)b[f++]=h=l}b.length=f;return b}})();"undefined"!==typeof window&&(window.lexCss=U,window.decodeCss=X);var Y=function(){function g(d){d=(""+d).match(k);return!d?s:new e(v(d[1]),v(d[2]),v(d[3]),v(d[4]),v(d[5]),v(d[6]),v(d[7]))}function w(d,a){return"string"==typeof d?encodeURI(d).replace(a,M):s}function M(d){d=d.charCodeAt(0);return"%"+"0123456789ABCDEF".charAt(d>>4&15)+"0123456789ABCDEF".charAt(d&15)}function x(d){if(d===s)return s;for(var d=d.replace(/(^|\/)\.(?:\/|$)/g,"$1").replace(/\/{2,}/g,"/"),a=b,h;(h=d.replace(a,"$1"))!=d;d=h);return d}function E(d,h){var b=d.T(),f=h.K();f?b.ga(h.j):f=h.X(); | 1 | 0,1 | -1 | https://github.com/jgraph/drawio/commit/f768ed73875d5eca20110b9c1d72f2789cd1bab7 | 3JavaScript |
ubik_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
const struct rx_header *rxh;
if (length < (int)sizeof(struct rx_header))
return;
rxh = (const struct rx_header *) bp;
ND_PRINT((ndo, " ubik reply %s", tok2str(ubik_req, "op#%d", opcode)));
bp += sizeof(struct rx_header);
if (rxh->type == RX_PACKET_TYPE_DATA)
switch (opcode) {
case 10000:
ND_PRINT((ndo, " vote no"));
break;
case 20004:
ND_PRINT((ndo, " dbversion"));
UBIK_VERSIONOUT();
break;
default:
;
}
else
switch (opcode) {
case 10000:
ND_PRINT((ndo, " vote yes until"));
DATEOUT();
break;
default:
ND_PRINT((ndo, " errcode"));
INTOUT();
}
return;
trunc:
ND_PRINT((ndo, " [|ubik]"));
} | 0 | null | -1 | https://github.com/the-tcpdump-group/tcpdump/commit/aa0858100096a3490edf93034a80e66a4d61aad5 | 0CCPP |
int imap_subscribe(char *path, bool subscribe)
{
struct ImapData *idata = NULL;
char buf[LONG_STRING];
char mbox[LONG_STRING];
char errstr[STRING];
struct Buffer err, token;
struct ImapMbox mx;
if (!mx_is_imap(path) || imap_parse_path(path, &mx) || !mx.mbox)
{
mutt_error(_("Bad mailbox name"));
return -1;
}
idata = imap_conn_find(&(mx.account), 0);
if (!idata)
goto fail;
imap_fix_path(idata, mx.mbox, buf, sizeof(buf));
if (!*buf)
mutt_str_strfcpy(buf, "INBOX", sizeof(buf));
if (ImapCheckSubscribed)
{
mutt_buffer_init(&token);
mutt_buffer_init(&err);
err.data = errstr;
err.dsize = sizeof(errstr);
snprintf(mbox, sizeof(mbox), "%smailboxes \"%s\"", subscribe ? "" : "un", path);
if (mutt_parse_rc_line(mbox, &token, &err))
mutt_debug(1, "Error adding subscribed mailbox: %s\n", errstr);
FREE(&token.data);
}
if (subscribe)
mutt_message(_("Subscribing to %s..."), buf);
else
mutt_message(_("Unsubscribing from %s..."), buf);
imap_munge_mbox_name(idata, mbox, sizeof(mbox), buf);
snprintf(buf, sizeof(buf), "%sSUBSCRIBE %s", subscribe ? "" : "UN", mbox);
if (imap_exec(idata, buf, 0) < 0)
goto fail;
imap_unmunge_mbox_name(idata, mx.mbox);
if (subscribe)
mutt_message(_("Subscribed to %s"), mx.mbox);
else
mutt_message(_("Unsubscribed from %s"), mx.mbox);
FREE(&mx.mbox);
return 0;
fail:
FREE(&mx.mbox);
return -1;
} | 1 | 25 | -1 | https://github.com/neomutt/neomutt/commit/95e80bf9ff10f68cb6443f760b85df4117cb15eb | 0CCPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.