idx
int64 | func
string | target
int64 |
|---|---|---|
118,410
|
static int __init ipc_init(void)
{
sem_init();
msg_init();
shm_init();
register_hotmemory_notifier(&ipc_memory_nb);
register_ipcns_notifier(&init_ipc_ns);
return 0;
}
| 0
|
185,385
|
void AppCacheUpdateJob::URLFetcher::AddConditionalHeaders(
const net::HttpResponseHeaders* headers) {
DCHECK(request_);
DCHECK(headers);
net::HttpRequestHeaders extra_headers;
const std::string last_modified = "Last-Modified";
std::string last_modified_value;
headers->EnumerateHeader(NULL, last_modified, &last_modified_value);
if (!last_modified_value.empty()) {
extra_headers.SetHeader(net::HttpRequestHeaders::kIfModifiedSince,
last_modified_value);
}
const std::string etag = "ETag";
std::string etag_value;
headers->EnumerateHeader(NULL, etag, &etag_value);
if (!etag_value.empty()) {
extra_headers.SetHeader(net::HttpRequestHeaders::kIfNoneMatch,
etag_value);
}
if (!extra_headers.IsEmpty())
request_->SetExtraRequestHeaders(extra_headers);
}
| 0
|
471,555
|
void luaLdbLineHook(lua_State *lua, lua_Debug *ar) {
lua_getstack(lua,0,ar);
lua_getinfo(lua,"Sl",ar);
ldb.currentline = ar->currentline;
int bp = ldbIsBreakpoint(ldb.currentline) || ldb.luabp;
int timeout = 0;
/* Events outside our script are not interesting. */
if(strstr(ar->short_src,"user_script") == NULL) return;
/* Check if a timeout occurred. */
if (ar->event == LUA_HOOKCOUNT && ldb.step == 0 && bp == 0) {
mstime_t elapsed = mstime() - server.lua_time_start;
mstime_t timelimit = server.lua_time_limit ?
server.lua_time_limit : 5000;
if (elapsed >= timelimit) {
timeout = 1;
ldb.step = 1;
} else {
return; /* No timeout, ignore the COUNT event. */
}
}
if (ldb.step || bp) {
char *reason = "step over";
if (bp) reason = ldb.luabp ? "redis.breakpoint() called" :
"break point";
else if (timeout) reason = "timeout reached, infinite loop?";
ldb.step = 0;
ldb.luabp = 0;
ldbLog(sdscatprintf(sdsempty(),
"* Stopped at %d, stop reason = %s",
ldb.currentline, reason));
ldbLogSourceLine(ldb.currentline);
ldbSendLogs();
if (ldbRepl(lua) == C_ERR && timeout) {
/* If the client closed the connection and we have a timeout
* connection, let's kill the script otherwise the process
* will remain blocked indefinitely. */
lua_pushstring(lua, "timeout during Lua debugging with client closing connection");
lua_error(lua);
}
server.lua_time_start = mstime();
}
}
| 0
|
64,972
|
RegexMatcherImpl(const RequirementRule& rule)
: BaseMatcherImpl(rule), regex_str_(rule.match().safe_regex().regex()),
path_matcher_(Matchers::PathMatcher::createSafeRegex(rule.match().safe_regex())) {
ASSERT(rule.match().path_specifier_case() ==
envoy::config::route::v3::RouteMatch::PathSpecifierCase::kSafeRegex);
}
| 0
|
84,907
|
ex_align(exarg_T *eap)
{
pos_T save_curpos;
int len;
int indent = 0;
int new_indent;
int has_tab;
int width;
#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl)
{
/* switch left and right aligning */
if (eap->cmdidx == CMD_right)
eap->cmdidx = CMD_left;
else if (eap->cmdidx == CMD_left)
eap->cmdidx = CMD_right;
}
#endif
width = atoi((char *)eap->arg);
save_curpos = curwin->w_cursor;
if (eap->cmdidx == CMD_left) /* width is used for new indent */
{
if (width >= 0)
indent = width;
}
else
{
/*
* if 'textwidth' set, use it
* else if 'wrapmargin' set, use it
* if invalid value, use 80
*/
if (width <= 0)
width = curbuf->b_p_tw;
if (width == 0 && curbuf->b_p_wm > 0)
width = curwin->w_width - curbuf->b_p_wm;
if (width <= 0)
width = 80;
}
if (u_save((linenr_T)(eap->line1 - 1), (linenr_T)(eap->line2 + 1)) == FAIL)
return;
for (curwin->w_cursor.lnum = eap->line1;
curwin->w_cursor.lnum <= eap->line2; ++curwin->w_cursor.lnum)
{
if (eap->cmdidx == CMD_left) /* left align */
new_indent = indent;
else
{
has_tab = FALSE; /* avoid uninit warnings */
len = linelen(eap->cmdidx == CMD_right ? &has_tab
: NULL) - get_indent();
if (len <= 0) /* skip blank lines */
continue;
if (eap->cmdidx == CMD_center)
new_indent = (width - len) / 2;
else
{
new_indent = width - len; /* right align */
/*
* Make sure that embedded TABs don't make the text go too far
* to the right.
*/
if (has_tab)
while (new_indent > 0)
{
(void)set_indent(new_indent, 0);
if (linelen(NULL) <= width)
{
/*
* Now try to move the line as much as possible to
* the right. Stop when it moves too far.
*/
do
(void)set_indent(++new_indent, 0);
while (linelen(NULL) <= width);
--new_indent;
break;
}
--new_indent;
}
}
}
if (new_indent < 0)
new_indent = 0;
(void)set_indent(new_indent, 0); /* set indent */
}
changed_lines(eap->line1, 0, eap->line2 + 1, 0L);
curwin->w_cursor = save_curpos;
beginline(BL_WHITE | BL_FIX);
}
| 0
|
221,222
|
void DevToolsWindow::OnPageCloseCanceled(content::WebContents* contents) {
DevToolsWindow *window =
DevToolsWindow::GetInstanceForInspectedRenderViewHost(
contents->GetRenderViewHost());
if (!window)
return;
window->intercepted_page_beforeunload_ = false;
DevToolsWindow::OnPageCloseCanceled(window->web_contents());
}
| 0
|
259,785
|
string convertHexToDec(const string &hex_str) {
mpz_t dec;
mpz_init(dec);
string ret = "";
try {
if (mpz_set_str(dec, hex_str.c_str(), 16) == -1) {
mpz_clear(dec);
return ret;
}
SAFE_CHAR_BUF(arr,mpz_sizeinbase(dec, 10) + 2);
mpz_get_str(arr, 10, dec);
ret = arr;
} catch (exception &e) {
mpz_clear(dec);
throw SGXException(INCORRECT_STRING_CONVERSION, e.what());
} catch (...) {
mpz_clear(dec);
throw SGXException(UNKNOWN_ERROR, "");
}
return ret;
}
| 0
|
359,219
|
static inline int dev_iwstats(struct net_device *dev, struct ifreq *ifr)
{
/* Get stats from the driver */
struct iw_statistics *stats;
stats = get_wireless_stats(dev);
if (stats != (struct iw_statistics *) NULL) {
struct iwreq * wrq = (struct iwreq *)ifr;
/* Copy statistics to the user buffer */
if(copy_to_user(wrq->u.data.pointer, stats,
sizeof(struct iw_statistics)))
return -EFAULT;
/* Check if we need to clear the update flag */
if(wrq->u.data.flags != 0)
stats->qual.updated = 0;
return 0;
} else
return -EOPNOTSUPP;
}
| 0
|
99,759
|
SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
unsigned int *nbytes, char **buf, int *buf_type)
{
struct smb_rqst rqst;
int resp_buftype, rc = -EACCES;
struct smb2_read_plain_req *req = NULL;
struct smb2_read_rsp *rsp = NULL;
struct kvec iov[1];
struct kvec rsp_iov;
unsigned int total_len;
int flags = CIFS_LOG_ERROR;
struct cifs_ses *ses = io_parms->tcon->ses;
*nbytes = 0;
rc = smb2_new_read_req((void **)&req, &total_len, io_parms, NULL, 0, 0);
if (rc)
return rc;
if (smb3_encryption_required(io_parms->tcon))
flags |= CIFS_TRANSFORM_REQ;
iov[0].iov_base = (char *)req;
iov[0].iov_len = total_len;
memset(&rqst, 0, sizeof(struct smb_rqst));
rqst.rq_iov = iov;
rqst.rq_nvec = 1;
rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
rsp = (struct smb2_read_rsp *)rsp_iov.iov_base;
if (rc) {
if (rc != -ENODATA) {
cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);
cifs_dbg(VFS, "Send error in read = %d\n", rc);
trace_smb3_read_err(xid, req->PersistentFileId,
io_parms->tcon->tid, ses->Suid,
io_parms->offset, io_parms->length,
rc);
} else
trace_smb3_read_done(xid, req->PersistentFileId,
io_parms->tcon->tid, ses->Suid,
io_parms->offset, 0);
free_rsp_buf(resp_buftype, rsp_iov.iov_base);
return rc == -ENODATA ? 0 : rc;
} else
trace_smb3_read_done(xid, req->PersistentFileId,
io_parms->tcon->tid, ses->Suid,
io_parms->offset, io_parms->length);
cifs_small_buf_release(req);
*nbytes = le32_to_cpu(rsp->DataLength);
if ((*nbytes > CIFS_MAX_MSGSIZE) ||
(*nbytes > io_parms->length)) {
cifs_dbg(FYI, "bad length %d for count %d\n",
*nbytes, io_parms->length);
rc = -EIO;
*nbytes = 0;
}
if (*buf) {
memcpy(*buf, (char *)rsp + rsp->DataOffset, *nbytes);
free_rsp_buf(resp_buftype, rsp_iov.iov_base);
} else if (resp_buftype != CIFS_NO_BUFFER) {
*buf = rsp_iov.iov_base;
if (resp_buftype == CIFS_SMALL_BUFFER)
*buf_type = CIFS_SMALL_BUFFER;
else if (resp_buftype == CIFS_LARGE_BUFFER)
*buf_type = CIFS_LARGE_BUFFER;
}
return rc;
}
| 0
|
105,598
|
WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
const int argc,const char **argv,Image **images,ExceptionInfo *exception)
{
const char
*option;
ImageInfo
*mogrify_info;
MagickStatusType
status;
PixelInterpolateMethod
interpolate_method;
QuantizeInfo
*quantize_info;
register ssize_t
i;
ssize_t
count,
index;
/*
Apply options to the image list.
*/
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
assert(images != (Image **) NULL);
assert((*images)->previous == (Image *) NULL);
assert((*images)->signature == MagickCoreSignature);
if ((*images)->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
(*images)->filename);
if ((argc <= 0) || (*argv == (char *) NULL))
return(MagickTrue);
interpolate_method=UndefinedInterpolatePixel;
mogrify_info=CloneImageInfo(image_info);
quantize_info=AcquireQuantizeInfo(mogrify_info);
status=MagickTrue;
for (i=0; i < (ssize_t) argc; i++)
{
if (*images == (Image *) NULL)
break;
option=argv[i];
if (IsCommandOption(option) == MagickFalse)
continue;
count=ParseCommandOption(MagickCommandOptions,MagickFalse,option);
count=MagickMax(count,0L);
if ((i+count) >= (ssize_t) argc)
break;
status=MogrifyImageInfo(mogrify_info,(int) count+1,argv+i,exception);
switch (*(option+1))
{
case 'a':
{
if (LocaleCompare("affinity",option+1) == 0)
{
(void) SyncImagesSettings(mogrify_info,*images,exception);
if (*option == '+')
{
(void) RemapImages(quantize_info,*images,(Image *) NULL,
exception);
break;
}
i++;
break;
}
if (LocaleCompare("append",option+1) == 0)
{
Image
*append_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
append_image=AppendImages(*images,*option == '-' ? MagickTrue :
MagickFalse,exception);
if (append_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=append_image;
break;
}
if (LocaleCompare("average",option+1) == 0)
{
Image
*average_image;
/*
Average an image sequence (deprecated).
*/
(void) SyncImagesSettings(mogrify_info,*images,exception);
average_image=EvaluateImages(*images,MeanEvaluateOperator,
exception);
if (average_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=average_image;
break;
}
break;
}
case 'c':
{
if (LocaleCompare("channel-fx",option+1) == 0)
{
Image
*channel_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
channel_image=ChannelFxImage(*images,argv[i+1],exception);
if (channel_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=channel_image;
break;
}
if (LocaleCompare("clut",option+1) == 0)
{
Image
*clut_image,
*image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
image=RemoveFirstImageFromList(images);
clut_image=RemoveFirstImageFromList(images);
if (clut_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
image=DestroyImage(image);
status=MagickFalse;
break;
}
(void) ClutImage(image,clut_image,interpolate_method,exception);
clut_image=DestroyImage(clut_image);
*images=DestroyImageList(*images);
*images=image;
break;
}
if (LocaleCompare("coalesce",option+1) == 0)
{
Image
*coalesce_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
coalesce_image=CoalesceImages(*images,exception);
if (coalesce_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=coalesce_image;
break;
}
if (LocaleCompare("combine",option+1) == 0)
{
ColorspaceType
colorspace;
Image
*combine_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
colorspace=(*images)->colorspace;
if ((*images)->number_channels < GetImageListLength(*images))
colorspace=sRGBColorspace;
if (*option == '+')
colorspace=(ColorspaceType) ParseCommandOption(
MagickColorspaceOptions,MagickFalse,argv[i+1]);
combine_image=CombineImages(*images,colorspace,exception);
if (combine_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=combine_image;
break;
}
if (LocaleCompare("compare",option+1) == 0)
{
double
distortion;
Image
*difference_image,
*image,
*reconstruct_image;
MetricType
metric;
/*
Mathematically and visually annotate the difference between an
image and its reconstruction.
*/
(void) SyncImagesSettings(mogrify_info,*images,exception);
image=RemoveFirstImageFromList(images);
reconstruct_image=RemoveFirstImageFromList(images);
if (reconstruct_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
image=DestroyImage(image);
status=MagickFalse;
break;
}
metric=UndefinedErrorMetric;
option=GetImageOption(mogrify_info,"metric");
if (option != (const char *) NULL)
metric=(MetricType) ParseCommandOption(MagickMetricOptions,
MagickFalse,option);
difference_image=CompareImages(image,reconstruct_image,metric,
&distortion,exception);
if (difference_image == (Image *) NULL)
break;
reconstruct_image=DestroyImage(reconstruct_image);
image=DestroyImage(image);
if (*images != (Image *) NULL)
*images=DestroyImageList(*images);
*images=difference_image;
break;
}
if (LocaleCompare("complex",option+1) == 0)
{
ComplexOperator
op;
Image
*complex_images;
(void) SyncImageSettings(mogrify_info,*images,exception);
op=(ComplexOperator) ParseCommandOption(MagickComplexOptions,
MagickFalse,argv[i+1]);
complex_images=ComplexImages(*images,op,exception);
if (complex_images == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=complex_images;
break;
}
if (LocaleCompare("composite",option+1) == 0)
{
CompositeOperator
compose;
const char*
value;
MagickBooleanType
clip_to_self;
Image
*mask_image,
*new_images,
*source_image;
RectangleInfo
geometry;
/* Compose value from "-compose" option only */
(void) SyncImageSettings(mogrify_info,*images,exception);
value=GetImageOption(mogrify_info,"compose");
if (value == (const char *) NULL)
compose=OverCompositeOp; /* use Over not source_image->compose */
else
compose=(CompositeOperator) ParseCommandOption(
MagickComposeOptions,MagickFalse,value);
/* Get "clip-to-self" expert setting (false is normal) */
clip_to_self=GetCompositeClipToSelf(compose);
value=GetImageOption(mogrify_info,"compose:clip-to-self");
if (value != (const char *) NULL)
clip_to_self=IsStringTrue(value);
value=GetImageOption(mogrify_info,"compose:outside-overlay");
if (value != (const char *) NULL)
clip_to_self=IsStringFalse(value); /* deprecated */
new_images=RemoveFirstImageFromList(images);
source_image=RemoveFirstImageFromList(images);
if (source_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
new_images=DestroyImage(new_images);
status=MagickFalse;
break;
}
/* FUTURE: this should not be here! - should be part of -geometry */
if (source_image->geometry != (char *) NULL)
{
RectangleInfo
resize_geometry;
(void) ParseRegionGeometry(source_image,source_image->geometry,
&resize_geometry,exception);
if ((source_image->columns != resize_geometry.width) ||
(source_image->rows != resize_geometry.height))
{
Image
*resize_image;
resize_image=ResizeImage(source_image,resize_geometry.width,
resize_geometry.height,source_image->filter,exception);
if (resize_image != (Image *) NULL)
{
source_image=DestroyImage(source_image);
source_image=resize_image;
}
}
}
SetGeometry(source_image,&geometry);
(void) ParseAbsoluteGeometry(source_image->geometry,&geometry);
GravityAdjustGeometry(new_images->columns,new_images->rows,
new_images->gravity,&geometry);
mask_image=RemoveFirstImageFromList(images);
if (mask_image == (Image *) NULL)
status&=CompositeImage(new_images,source_image,compose,
clip_to_self,geometry.x,geometry.y,exception);
else
{
if ((compose == DisplaceCompositeOp) ||
(compose == DistortCompositeOp))
{
status&=CompositeImage(source_image,mask_image,
CopyGreenCompositeOp,MagickTrue,0,0,exception);
status&=CompositeImage(new_images,source_image,compose,
clip_to_self,geometry.x,geometry.y,exception);
}
else
{
Image
*clone_image;
clone_image=CloneImage(new_images,0,0,MagickTrue,exception);
if (clone_image == (Image *) NULL)
break;
status&=CompositeImage(new_images,source_image,compose,
clip_to_self,geometry.x,geometry.y,exception);
status&=CompositeImage(new_images,mask_image,
CopyAlphaCompositeOp,MagickTrue,0,0,exception);
status&=CompositeImage(clone_image,new_images,
OverCompositeOp,clip_to_self,0,0,exception);
new_images=DestroyImageList(new_images);
new_images=clone_image;
}
mask_image=DestroyImage(mask_image);
}
source_image=DestroyImage(source_image);
*images=DestroyImageList(*images);
*images=new_images;
break;
}
if (LocaleCompare("copy",option+1) == 0)
{
Image
*source_image;
OffsetInfo
offset;
RectangleInfo
geometry;
/*
Copy image pixels.
*/
(void) SyncImageSettings(mogrify_info,*images,exception);
(void) ParsePageGeometry(*images,argv[i+2],&geometry,exception);
offset.x=geometry.x;
offset.y=geometry.y;
source_image=(*images);
if (source_image->next != (Image *) NULL)
source_image=source_image->next;
(void) ParsePageGeometry(source_image,argv[i+1],&geometry,
exception);
status=CopyImagePixels(*images,source_image,&geometry,&offset,
exception);
break;
}
break;
}
case 'd':
{
if (LocaleCompare("deconstruct",option+1) == 0)
{
Image
*deconstruct_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
deconstruct_image=CompareImagesLayers(*images,CompareAnyLayer,
exception);
if (deconstruct_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=deconstruct_image;
break;
}
if (LocaleCompare("delete",option+1) == 0)
{
if (*option == '+')
DeleteImages(images,"-1",exception);
else
DeleteImages(images,argv[i+1],exception);
break;
}
if (LocaleCompare("dither",option+1) == 0)
{
if (*option == '+')
{
quantize_info->dither_method=NoDitherMethod;
break;
}
quantize_info->dither_method=(DitherMethod) ParseCommandOption(
MagickDitherOptions,MagickFalse,argv[i+1]);
break;
}
if (LocaleCompare("duplicate",option+1) == 0)
{
Image
*duplicate_images;
if (*option == '+')
duplicate_images=DuplicateImages(*images,1,"-1",exception);
else
{
const char
*p;
size_t
number_duplicates;
number_duplicates=(size_t) StringToLong(argv[i+1]);
p=strchr(argv[i+1],',');
if (p == (const char *) NULL)
duplicate_images=DuplicateImages(*images,number_duplicates,
"-1",exception);
else
duplicate_images=DuplicateImages(*images,number_duplicates,p,
exception);
}
AppendImageToList(images, duplicate_images);
(void) SyncImagesSettings(mogrify_info,*images,exception);
break;
}
break;
}
case 'e':
{
if (LocaleCompare("evaluate-sequence",option+1) == 0)
{
Image
*evaluate_image;
MagickEvaluateOperator
op;
(void) SyncImageSettings(mogrify_info,*images,exception);
op=(MagickEvaluateOperator) ParseCommandOption(
MagickEvaluateOptions,MagickFalse,argv[i+1]);
evaluate_image=EvaluateImages(*images,op,exception);
if (evaluate_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=evaluate_image;
break;
}
break;
}
case 'f':
{
if (LocaleCompare("fft",option+1) == 0)
{
Image
*fourier_image;
/*
Implements the discrete Fourier transform (DFT).
*/
(void) SyncImageSettings(mogrify_info,*images,exception);
fourier_image=ForwardFourierTransformImage(*images,*option == '-' ?
MagickTrue : MagickFalse,exception);
if (fourier_image == (Image *) NULL)
break;
*images=DestroyImageList(*images);
*images=fourier_image;
break;
}
if (LocaleCompare("flatten",option+1) == 0)
{
Image
*flatten_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
flatten_image=MergeImageLayers(*images,FlattenLayer,exception);
if (flatten_image == (Image *) NULL)
break;
*images=DestroyImageList(*images);
*images=flatten_image;
break;
}
if (LocaleCompare("fx",option+1) == 0)
{
Image
*fx_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
fx_image=FxImage(*images,argv[i+1],exception);
if (fx_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=fx_image;
break;
}
break;
}
case 'h':
{
if (LocaleCompare("hald-clut",option+1) == 0)
{
Image
*hald_image,
*image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
image=RemoveFirstImageFromList(images);
hald_image=RemoveFirstImageFromList(images);
if (hald_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
image=DestroyImage(image);
status=MagickFalse;
break;
}
(void) HaldClutImage(image,hald_image,exception);
hald_image=DestroyImage(hald_image);
if (*images != (Image *) NULL)
*images=DestroyImageList(*images);
*images=image;
break;
}
break;
}
case 'i':
{
if (LocaleCompare("ift",option+1) == 0)
{
Image
*fourier_image,
*magnitude_image,
*phase_image;
/*
Implements the inverse fourier discrete Fourier transform (DFT).
*/
(void) SyncImagesSettings(mogrify_info,*images,exception);
magnitude_image=RemoveFirstImageFromList(images);
phase_image=RemoveFirstImageFromList(images);
if (phase_image == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"ImageSequenceRequired","`%s'",option);
magnitude_image=DestroyImage(magnitude_image);
status=MagickFalse;
break;
}
fourier_image=InverseFourierTransformImage(magnitude_image,
phase_image,*option == '-' ? MagickTrue : MagickFalse,exception);
magnitude_image=DestroyImage(magnitude_image);
phase_image=DestroyImage(phase_image);
if (fourier_image == (Image *) NULL)
break;
if (*images != (Image *) NULL)
*images=DestroyImageList(*images);
*images=fourier_image;
break;
}
if (LocaleCompare("insert",option+1) == 0)
{
Image
*p,
*q;
index=0;
if (*option != '+')
index=(ssize_t) StringToLong(argv[i+1]);
p=RemoveLastImageFromList(images);
if (p == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"NoSuchImage","`%s'",argv[i+1]);
status=MagickFalse;
break;
}
q=p;
if (index == 0)
PrependImageToList(images,q);
else
if (index == (ssize_t) GetImageListLength(*images))
AppendImageToList(images,q);
else
{
q=GetImageFromList(*images,index-1);
if (q == (Image *) NULL)
{
p=DestroyImage(p);
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"NoSuchImage","`%s'",argv[i+1]);
status=MagickFalse;
break;
}
InsertImageInList(&q,p);
}
*images=GetFirstImageInList(q);
break;
}
if (LocaleCompare("interpolate",option+1) == 0)
{
interpolate_method=(PixelInterpolateMethod) ParseCommandOption(
MagickInterpolateOptions,MagickFalse,argv[i+1]);
break;
}
break;
}
case 'l':
{
if (LocaleCompare("layers",option+1) == 0)
{
Image
*layers;
LayerMethod
method;
(void) SyncImagesSettings(mogrify_info,*images,exception);
layers=(Image *) NULL;
method=(LayerMethod) ParseCommandOption(MagickLayerOptions,
MagickFalse,argv[i+1]);
switch (method)
{
case CoalesceLayer:
{
layers=CoalesceImages(*images,exception);
break;
}
case CompareAnyLayer:
case CompareClearLayer:
case CompareOverlayLayer:
default:
{
layers=CompareImagesLayers(*images,method,exception);
break;
}
case MergeLayer:
case FlattenLayer:
case MosaicLayer:
case TrimBoundsLayer:
{
layers=MergeImageLayers(*images,method,exception);
break;
}
case DisposeLayer:
{
layers=DisposeImages(*images,exception);
break;
}
case OptimizeImageLayer:
{
layers=OptimizeImageLayers(*images,exception);
break;
}
case OptimizePlusLayer:
{
layers=OptimizePlusImageLayers(*images,exception);
break;
}
case OptimizeTransLayer:
{
OptimizeImageTransparency(*images,exception);
break;
}
case RemoveDupsLayer:
{
RemoveDuplicateLayers(images,exception);
break;
}
case RemoveZeroLayer:
{
RemoveZeroDelayLayers(images,exception);
break;
}
case OptimizeLayer:
{
/*
General Purpose, GIF Animation Optimizer.
*/
layers=CoalesceImages(*images,exception);
if (layers == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=layers;
layers=OptimizeImageLayers(*images,exception);
if (layers == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=layers;
layers=(Image *) NULL;
OptimizeImageTransparency(*images,exception);
(void) RemapImages(quantize_info,*images,(Image *) NULL,
exception);
break;
}
case CompositeLayer:
{
CompositeOperator
compose;
Image
*source;
RectangleInfo
geometry;
/*
Split image sequence at the first 'NULL:' image.
*/
source=(*images);
while (source != (Image *) NULL)
{
source=GetNextImageInList(source);
if ((source != (Image *) NULL) &&
(LocaleCompare(source->magick,"NULL") == 0))
break;
}
if (source != (Image *) NULL)
{
if ((GetPreviousImageInList(source) == (Image *) NULL) ||
(GetNextImageInList(source) == (Image *) NULL))
source=(Image *) NULL;
else
{
/*
Separate the two lists, junk the null: image.
*/
source=SplitImageList(source->previous);
DeleteImageFromList(&source);
}
}
if (source == (Image *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"MissingNullSeparator","layers Composite");
status=MagickFalse;
break;
}
/*
Adjust offset with gravity and virtual canvas.
*/
SetGeometry(*images,&geometry);
(void) ParseAbsoluteGeometry((*images)->geometry,&geometry);
geometry.width=source->page.width != 0 ?
source->page.width : source->columns;
geometry.height=source->page.height != 0 ?
source->page.height : source->rows;
GravityAdjustGeometry((*images)->page.width != 0 ?
(*images)->page.width : (*images)->columns,
(*images)->page.height != 0 ? (*images)->page.height :
(*images)->rows,(*images)->gravity,&geometry);
compose=OverCompositeOp;
option=GetImageOption(mogrify_info,"compose");
if (option != (const char *) NULL)
compose=(CompositeOperator) ParseCommandOption(
MagickComposeOptions,MagickFalse,option);
CompositeLayers(*images,compose,source,geometry.x,geometry.y,
exception);
source=DestroyImageList(source);
break;
}
}
if (layers == (Image *) NULL)
break;
*images=DestroyImageList(*images);
*images=layers;
break;
}
break;
}
case 'm':
{
if (LocaleCompare("map",option+1) == 0)
{
(void) SyncImagesSettings(mogrify_info,*images,exception);
if (*option == '+')
{
(void) RemapImages(quantize_info,*images,(Image *) NULL,
exception);
break;
}
i++;
break;
}
if (LocaleCompare("maximum",option+1) == 0)
{
Image
*maximum_image;
/*
Maximum image sequence (deprecated).
*/
(void) SyncImagesSettings(mogrify_info,*images,exception);
maximum_image=EvaluateImages(*images,MaxEvaluateOperator,exception);
if (maximum_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=maximum_image;
break;
}
if (LocaleCompare("minimum",option+1) == 0)
{
Image
*minimum_image;
/*
Minimum image sequence (deprecated).
*/
(void) SyncImagesSettings(mogrify_info,*images,exception);
minimum_image=EvaluateImages(*images,MinEvaluateOperator,exception);
if (minimum_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=minimum_image;
break;
}
if (LocaleCompare("morph",option+1) == 0)
{
Image
*morph_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
morph_image=MorphImages(*images,StringToUnsignedLong(argv[i+1]),
exception);
if (morph_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=morph_image;
break;
}
if (LocaleCompare("mosaic",option+1) == 0)
{
Image
*mosaic_image;
(void) SyncImagesSettings(mogrify_info,*images,exception);
mosaic_image=MergeImageLayers(*images,MosaicLayer,exception);
if (mosaic_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=mosaic_image;
break;
}
break;
}
case 'p':
{
if (LocaleCompare("poly",option+1) == 0)
{
char
*args,
token[MagickPathExtent];
const char
*p;
double
*arguments;
Image
*polynomial_image;
register ssize_t
x;
size_t
number_arguments;
/*
Polynomial image.
*/
(void) SyncImageSettings(mogrify_info,*images,exception);
args=InterpretImageProperties(mogrify_info,*images,argv[i+1],
exception);
if (args == (char *) NULL)
break;
p=(char *) args;
for (x=0; *p != '\0'; x++)
{
GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
GetNextToken(p,&p,MagickPathExtent,token);
}
number_arguments=(size_t) x;
arguments=(double *) AcquireQuantumMemory(number_arguments,
sizeof(*arguments));
if (arguments == (double *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",(*images)->filename);
(void) memset(arguments,0,number_arguments*
sizeof(*arguments));
p=(char *) args;
for (x=0; (x < (ssize_t) number_arguments) && (*p != '\0'); x++)
{
GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
GetNextToken(p,&p,MagickPathExtent,token);
arguments[x]=StringToDouble(token,(char **) NULL);
}
args=DestroyString(args);
polynomial_image=PolynomialImage(*images,number_arguments >> 1,
arguments,exception);
arguments=(double *) RelinquishMagickMemory(arguments);
if (polynomial_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=polynomial_image;
}
if (LocaleCompare("print",option+1) == 0)
{
char
*string;
(void) SyncImagesSettings(mogrify_info,*images,exception);
string=InterpretImageProperties(mogrify_info,*images,argv[i+1],
exception);
if (string == (char *) NULL)
break;
(void) FormatLocaleFile(stdout,"%s",string);
string=DestroyString(string);
}
if (LocaleCompare("process",option+1) == 0)
{
char
**arguments;
int
j,
number_arguments;
(void) SyncImagesSettings(mogrify_info,*images,exception);
arguments=StringToArgv(argv[i+1],&number_arguments);
if (arguments == (char **) NULL)
break;
if ((argc > 1) && (strchr(arguments[1],'=') != (char *) NULL))
{
char
breaker,
quote,
*token;
const char
*argument;
int
next,
token_status;
size_t
length;
TokenInfo
*token_info;
/*
Support old style syntax, filter="-option arg".
*/
length=strlen(argv[i+1]);
token=(char *) NULL;
if (~length >= (MagickPathExtent-1))
token=(char *) AcquireQuantumMemory(length+MagickPathExtent,
sizeof(*token));
if (token == (char *) NULL)
break;
next=0;
argument=argv[i+1];
token_info=AcquireTokenInfo();
token_status=Tokenizer(token_info,0,token,length,argument,"",
"=","\"",'\0',&breaker,&next,"e);
token_info=DestroyTokenInfo(token_info);
if (token_status == 0)
{
const char
*arg;
arg=(&(argument[next]));
(void) InvokeDynamicImageFilter(token,&(*images),1,&arg,
exception);
}
token=DestroyString(token);
break;
}
(void) SubstituteString(&arguments[1],"-","");
(void) InvokeDynamicImageFilter(arguments[1],&(*images),
number_arguments-2,(const char **) arguments+2,exception);
for (j=0; j < number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
break;
}
break;
}
case 'r':
{
if (LocaleCompare("reverse",option+1) == 0)
{
ReverseImageList(images);
break;
}
break;
}
case 's':
{
if (LocaleCompare("smush",option+1) == 0)
{
Image
*smush_image;
ssize_t
offset;
(void) SyncImagesSettings(mogrify_info,*images,exception);
offset=(ssize_t) StringToLong(argv[i+1]);
smush_image=SmushImages(*images,*option == '-' ? MagickTrue :
MagickFalse,offset,exception);
if (smush_image == (Image *) NULL)
{
status=MagickFalse;
break;
}
*images=DestroyImageList(*images);
*images=smush_image;
break;
}
if (LocaleCompare("swap",option+1) == 0)
{
Image
*p,
*q,
*u,
*v;
ssize_t
swap_index;
index=(-1);
swap_index=(-2);
if (*option != '+')
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
swap_index=(-1);
flags=ParseGeometry(argv[i+1],&geometry_info);
index=(ssize_t) geometry_info.rho;
if ((flags & SigmaValue) != 0)
swap_index=(ssize_t) geometry_info.sigma;
}
p=GetImageFromList(*images,index);
q=GetImageFromList(*images,swap_index);
if ((p == (Image *) NULL) || (q == (Image *) NULL))
{
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError,"NoSuchImage","`%s'",(*images)->filename);
status=MagickFalse;
break;
}
if (p == q)
break;
u=CloneImage(p,0,0,MagickTrue,exception);
if (u == (Image *) NULL)
break;
v=CloneImage(q,0,0,MagickTrue,exception);
if (v == (Image *) NULL)
{
u=DestroyImage(u);
break;
}
ReplaceImageInList(&p,v);
ReplaceImageInList(&q,u);
*images=GetFirstImageInList(q);
break;
}
break;
}
case 'w':
{
if (LocaleCompare("write",option+1) == 0)
{
char
key[MagickPathExtent];
Image
*write_images;
ImageInfo
*write_info;
(void) SyncImagesSettings(mogrify_info,*images,exception);
(void) FormatLocaleString(key,MagickPathExtent,"cache:%s",
argv[i+1]);
(void) DeleteImageRegistry(key);
write_images=(*images);
if (*option == '+')
write_images=CloneImageList(*images,exception);
write_info=CloneImageInfo(mogrify_info);
status&=WriteImages(write_info,write_images,argv[i+1],exception);
write_info=DestroyImageInfo(write_info);
if (*option == '+')
write_images=DestroyImageList(write_images);
break;
}
break;
}
default:
break;
}
i+=count;
}
quantize_info=DestroyQuantizeInfo(quantize_info);
mogrify_info=DestroyImageInfo(mogrify_info);
status&=MogrifyImageInfo(image_info,argc,argv,exception);
return(status != 0 ? MagickTrue : MagickFalse);
}
| 0
|
453,939
|
TEST(ParseExpression, ShouldRejectExpressionIfItsNotTheOnlyField) {
ASSERT_THROWS(parseExpression(BSON("$and" << BSONArray() << "a" << BSON("$or" << BSONArray()))),
AssertionException);
}
| 0
|
178,493
|
void PPB_URLLoader_Impl::SetDefersLoading(bool defers_loading) {
if (loader_.get()) {
loader_->setDefersLoading(defers_loading);
is_asynchronous_load_suspended_ = defers_loading;
}
}
| 0
|
431,197
|
bool isAuthEnabled() const override {
return false;
}
| 0
|
86,531
|
TEST_P(SslSocketTest, DownstreamNotReadySslSocket) {
Stats::TestUtil::TestStore stats_store;
NiceMock<LocalInfo::MockLocalInfo> local_info;
testing::NiceMock<Server::Configuration::MockTransportSocketFactoryContext> factory_context;
NiceMock<Init::MockManager> init_manager;
NiceMock<Event::MockDispatcher> dispatcher;
EXPECT_CALL(factory_context, mainThreadDispatcher()).WillRepeatedly(ReturnRef(dispatcher));
EXPECT_CALL(factory_context, localInfo()).WillOnce(ReturnRef(local_info));
EXPECT_CALL(factory_context, stats()).WillOnce(ReturnRef(stats_store));
EXPECT_CALL(factory_context, initManager()).WillRepeatedly(ReturnRef(init_manager));
envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context;
auto sds_secret_configs =
tls_context.mutable_common_tls_context()->mutable_tls_certificate_sds_secret_configs()->Add();
sds_secret_configs->set_name("abc.com");
sds_secret_configs->mutable_sds_config();
auto server_cfg = std::make_unique<ServerContextConfigImpl>(tls_context, factory_context);
EXPECT_TRUE(server_cfg->tlsCertificates().empty());
EXPECT_FALSE(server_cfg->isReady());
ContextManagerImpl manager(time_system_);
ServerSslSocketFactory server_ssl_socket_factory(std::move(server_cfg), manager, stats_store,
std::vector<std::string>{});
auto transport_socket = server_ssl_socket_factory.createTransportSocket(nullptr);
EXPECT_FALSE(transport_socket->startSecureTransport()); // Noop
transport_socket->configureInitialCongestionWindow(200, std::chrono::microseconds(223)); // Noop
EXPECT_EQ(EMPTY_STRING, transport_socket->protocol());
EXPECT_EQ(nullptr, transport_socket->ssl());
EXPECT_EQ(true, transport_socket->canFlushClose());
Buffer::OwnedImpl buffer;
Network::IoResult result = transport_socket->doRead(buffer);
EXPECT_EQ(Network::PostIoAction::Close, result.action_);
result = transport_socket->doWrite(buffer, true);
EXPECT_EQ(Network::PostIoAction::Close, result.action_);
EXPECT_EQ("TLS error: Secret is not supplied by SDS", transport_socket->failureReason());
}
| 0
|
109,478
|
void jas_matrix_divpow2(jas_matrix_t *matrix, int n)
{
jas_matind_t i;
jas_matind_t j;
jas_seqent_t *rowstart;
jas_matind_t rowstep;
jas_seqent_t *data;
if (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {
assert(matrix->rows_);
rowstep = jas_matrix_rowstep(matrix);
for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
rowstart += rowstep) {
for (j = matrix->numcols_, data = rowstart; j > 0; --j,
++data) {
*data = (*data >= 0) ? ((*data) >> n) :
(-((-(*data)) >> n));
}
}
}
}
| 0
|
511,089
|
rl_bind_keyseq_if_unbound (keyseq, default_func)
const char *keyseq;
rl_command_func_t *default_func;
{
return (rl_bind_keyseq_if_unbound_in_map (keyseq, default_func, _rl_keymap));
}
| 0
|
24,366
|
static guint8 dissect_zcl_ota_field_ctrl_field ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
guint8 field ;
static const int * field_ctrl [ ] = {
& hf_zbee_zcl_ota_field_ctrl_hw_ver_present , & hf_zbee_zcl_ota_field_ctrl_reserved , NULL }
;
field = tvb_get_guint8 ( tvb , * offset ) ;
proto_tree_add_bitmask ( tree , tvb , * offset , hf_zbee_zcl_ota_field_ctrl , ett_zbee_zcl_ota_field_ctrl , field_ctrl , ENC_BIG_ENDIAN ) ;
* offset += 1 ;
return field ;
}
| 0
|
344,374
|
add_account (GoaProvider *provider,
GoaClient *client,
GtkDialog *dialog,
GtkBox *vbox,
GError **error)
{
AddAccountData data;
GVariantBuilder credentials;
GVariantBuilder details;
GoaEwsClient *ews_client;
GoaObject *ret;
const gchar *email_address;
const gchar *server;
const gchar *password;
const gchar *username;
const gchar *provider_type;
gint response;
ews_client = NULL;
ret = NULL;
memset (&data, 0, sizeof (AddAccountData));
data.loop = g_main_loop_new (NULL, FALSE);
data.dialog = dialog;
data.error = NULL;
create_account_details_ui (provider, dialog, vbox, TRUE, &data);
gtk_widget_show_all (GTK_WIDGET (vbox));
ews_client = goa_ews_client_new ();
ews_again:
response = gtk_dialog_run (dialog);
if (response != GTK_RESPONSE_OK)
{
g_set_error (&data.error,
GOA_ERROR,
GOA_ERROR_DIALOG_DISMISSED,
_("Dialog was dismissed"));
goto out;
}
email_address = gtk_entry_get_text (GTK_ENTRY (data.email_address));
password = gtk_entry_get_text (GTK_ENTRY (data.password));
username = gtk_entry_get_text (GTK_ENTRY (data.username));
server = gtk_entry_get_text (GTK_ENTRY (data.server));
/* See if there's already an account of this type with the
* given identity
*/
provider_type = goa_provider_get_provider_type (provider);
if (!goa_utils_check_duplicate (client,
username,
provider_type,
(GoaPeekInterfaceFunc) goa_object_peek_password_based,
&data.error))
goto out;
goa_ews_client_autodiscover (ews_client,
email_address,
password,
username,
server,
NULL,
autodiscover_cb,
&data);
goa_spinner_button_start (GOA_SPINNER_BUTTON (data.spinner_button));
g_main_loop_run (data.loop);
if (data.error != NULL)
{
gchar *markup;
markup = g_strdup_printf ("<b>%s:</b> %s",
_("Error connecting to Microsoft Exchange server"),
data.error->message);
g_clear_error (&data.error);
gtk_label_set_markup (GTK_LABEL (data.cluebar_label), markup);
g_free (markup);
goa_spinner_button_set_label (GOA_SPINNER_BUTTON (data.spinner_button), _("_Try Again"));
gtk_expander_set_expanded (GTK_EXPANDER (data.expander), TRUE);
gtk_widget_set_no_show_all (data.cluebar, FALSE);
gtk_widget_show_all (data.cluebar);
goto ews_again;
}
gtk_widget_hide (GTK_WIDGET (dialog));
g_variant_builder_init (&credentials, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&credentials, "{sv}", "password", g_variant_new_string (password));
g_variant_builder_init (&details, G_VARIANT_TYPE ("a{ss}"));
g_variant_builder_add (&details, "{ss}", "MailEnabled", "true");
g_variant_builder_add (&details, "{ss}", "CalendarEnabled", "true");
g_variant_builder_add (&details, "{ss}", "ContactsEnabled", "true");
g_variant_builder_add (&details, "{ss}", "Host", server);
/* OK, everything is dandy, add the account */
/* we want the GoaClient to update before this method returns (so it
* can create a proxy for the new object) so run the mainloop while
* waiting for this to complete
*/
goa_manager_call_add_account (goa_client_get_manager (client),
goa_provider_get_provider_type (provider),
username,
email_address,
g_variant_builder_end (&credentials),
g_variant_builder_end (&details),
NULL, /* GCancellable* */
(GAsyncReadyCallback) add_account_cb,
&data);
g_main_loop_run (data.loop);
if (data.error != NULL)
goto out;
ret = GOA_OBJECT (g_dbus_object_manager_get_object (goa_client_get_object_manager (client),
data.account_object_path));
out:
/* We might have an object even when data.error is set.
* eg., if we failed to store the credentials in the keyring.
*/
if (data.error != NULL)
g_propagate_error (error, data.error);
else
g_assert (ret != NULL);
g_free (data.account_object_path);
if (data.loop != NULL)
g_main_loop_unref (data.loop);
if (ews_client != NULL)
g_object_unref (ews_client);
return ret;
}
| 1
|
490,762
|
static int flv_write_trailer(AVFormatContext *s)
{
int64_t file_size;
AVIOContext *pb = s->pb;
FLVContext *flv = s->priv_data;
int i;
/* Add EOS tag */
for (i = 0; i < s->nb_streams; i++) {
AVCodecContext *enc = s->streams[i]->codec;
FLVStreamContext *sc = s->streams[i]->priv_data;
if (enc->codec_type == AVMEDIA_TYPE_VIDEO &&
(enc->codec_id == AV_CODEC_ID_H264 || enc->codec_id == AV_CODEC_ID_MPEG4))
put_avc_eos_tag(pb, sc->last_ts);
}
file_size = avio_tell(pb);
/* update information */
if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0)
av_log(s, AV_LOG_WARNING, "Failed to update header with correct duration.\n");
else
put_amf_double(pb, flv->duration / (double)1000);
if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0)
av_log(s, AV_LOG_WARNING, "Failed to update header with correct filesize.\n");
else
put_amf_double(pb, file_size);
avio_seek(pb, file_size, SEEK_SET);
return 0;
}
| 0
|
486,447
|
ossl_cipher_is_authenticated(VALUE self)
{
EVP_CIPHER_CTX *ctx;
int nid;
GetCipher(self, ctx);
nid = EVP_CIPHER_CTX_nid(ctx);
if (ossl_is_gcm(nid)) {
return Qtrue;
} else {
return Qfalse;
}
}
| 0
|
61,994
|
static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{
int err;
struct sock_diag_req *req = nlmsg_data(nlh);
const struct sock_diag_handler *hndl;
if (nlmsg_len(nlh) < sizeof(*req))
return -EINVAL;
if (req->sdiag_family >= AF_MAX)
return -EINVAL;
hndl = sock_diag_lock_handler(req->sdiag_family);
if (hndl == NULL)
err = -ENOENT;
else
err = hndl->dump(skb, nlh);
sock_diag_unlock_handler(hndl);
return err;
}
| 0
|
59,856
|
static int get_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
const struct kvm_one_reg *reg, void __user *uaddr)
{
__u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
return -EFAULT;
return 0;
}
| 0
|
83,249
|
}
static inline bool f2fs_hw_support_discard(struct f2fs_sb_info *sbi)
{
int i;
if (!f2fs_is_multi_device(sbi))
return f2fs_bdev_support_discard(sbi->sb->s_bdev);
for (i = 0; i < sbi->s_ndevs; i++)
if (f2fs_bdev_support_discard(FDEV(i).bdev))
return true;
| 0
|
374,908
|
_outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
{
WRITE_NODE_TYPE("BITMAPHEAPSCAN");
_outScanInfo(str, (const Scan *) node);
WRITE_NODE_FIELD(bitmapqualorig);
}
| 0
|
29,534
|
static inline int check_for_slice ( AVSContext * h ) {
GetBitContext * gb = & h -> gb ;
int align ;
if ( h -> mbx ) return 0 ;
align = ( - get_bits_count ( gb ) ) & 7 ;
if ( ! align && ( show_bits ( gb , 8 ) == 0x80 ) ) align = 8 ;
if ( ( show_bits_long ( gb , 24 + align ) & 0xFFFFFF ) == 0x000001 ) {
skip_bits_long ( gb , 24 + align ) ;
h -> stc = get_bits ( gb , 8 ) ;
if ( h -> stc >= h -> mb_height ) return 0 ;
decode_slice_header ( h , gb ) ;
return 1 ;
}
return 0 ;
}
| 0
|
375,187
|
_equalRangeTblEntry(const RangeTblEntry *a, const RangeTblEntry *b)
{
COMPARE_SCALAR_FIELD(rtekind);
COMPARE_SCALAR_FIELD(relid);
COMPARE_SCALAR_FIELD(relkind);
COMPARE_NODE_FIELD(subquery);
COMPARE_SCALAR_FIELD(security_barrier);
COMPARE_SCALAR_FIELD(jointype);
COMPARE_NODE_FIELD(joinaliasvars);
COMPARE_NODE_FIELD(functions);
COMPARE_SCALAR_FIELD(funcordinality);
COMPARE_NODE_FIELD(values_lists);
COMPARE_NODE_FIELD(values_collations);
COMPARE_STRING_FIELD(ctename);
COMPARE_SCALAR_FIELD(ctelevelsup);
COMPARE_SCALAR_FIELD(self_reference);
COMPARE_NODE_FIELD(ctecoltypes);
COMPARE_NODE_FIELD(ctecoltypmods);
COMPARE_NODE_FIELD(ctecolcollations);
COMPARE_NODE_FIELD(alias);
COMPARE_NODE_FIELD(eref);
COMPARE_SCALAR_FIELD(lateral);
COMPARE_SCALAR_FIELD(inh);
COMPARE_SCALAR_FIELD(inFromCl);
COMPARE_SCALAR_FIELD(requiredPerms);
COMPARE_SCALAR_FIELD(checkAsUser);
COMPARE_BITMAPSET_FIELD(selectedCols);
COMPARE_BITMAPSET_FIELD(modifiedCols);
return true;
}
| 0
|
467,561
|
EXPORTED char *dumpentryatt(const struct entryattlist *l)
{
struct buf buf = BUF_INITIALIZER;
const struct entryattlist *ee;
buf_printf(&buf, "(");
const char *sp = "";
const struct attvaluelist *av;
for (ee = l ; ee ; ee = ee->next) {
buf_printf(&buf, "%s%s (", sp, ee->entry);
const char *insp = "";
for (av = ee->attvalues ; av ; av = av->next) {
buf_printf(&buf, "%s%s %s", insp, av->attrib, buf_cstring(&av->value));
insp = " ";
}
buf_printf(&buf, ")");
sp = " ";
}
buf_printf(&buf, ")");
char *res = buf_release(&buf);
buf_free(&buf);
return res;
}
| 0
|
100,206
|
njs_vm_retval(njs_vm_t *vm)
{
return &vm->retval;
}
| 0
|
335,751
|
static void mkv_free(MatroskaMuxContext *mkv) {
if (mkv->main_seekhead) {
av_freep(&mkv->main_seekhead->entries);
av_freep(&mkv->main_seekhead);
if (mkv->cues) {
av_freep(&mkv->cues->entries);
av_freep(&mkv->cues);
if (mkv->attachments) {
av_freep(&mkv->attachments->entries);
av_freep(&mkv->attachments);
av_freep(&mkv->tracks);
av_freep(&mkv->stream_durations);
av_freep(&mkv->stream_duration_offsets);
| 1
|
47,872
|
**/
CImg<T>& assign(const unsigned int size_x, const unsigned int size_y,
const unsigned int size_z, const unsigned int size_c,
const double value0, const double value1, ...) {
assign(size_x,size_y,size_z,size_c);
_CImg_stdarg(*this,value0,value1,(size_t)size_x*size_y*size_z*size_c,double);
return *this;
| 0
|
131,850
|
MagickCore::QuantizeInfo *Magick::Image::quantizeInfo(void)
{
return(_imgRef->options()->quantizeInfo());
}
| 0
|
268,684
|
void dhcpServerParseInform(DhcpServerContext *context,
const DhcpMessage *message, size_t length)
{
//Make sure the client IP address is valid
if(message->ciaddr != IPV4_UNSPECIFIED_ADDR)
{
//Servers receiving a DHCPINFORM message construct a DHCPACK message
//with any local configuration parameters appropriate for the client
dhcpServerSendReply(context, DHCP_MESSAGE_TYPE_ACK,
IPV4_UNSPECIFIED_ADDR, message, length);
}
}
| 0
|
453,676
|
numericStringNormalize(
slap_mask_t usage,
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
struct berval *normalized,
void *ctx )
{
/* removal all spaces */
char *p, *q;
assert( !BER_BVISEMPTY( val ) );
normalized->bv_val = slap_sl_malloc( val->bv_len + 1, ctx );
p = val->bv_val;
q = normalized->bv_val;
while ( *p ) {
if ( ASCII_SPACE( *p ) ) {
/* Ignore whitespace */
p++;
} else {
*q++ = *p++;
}
}
/* we should have copied no more than is in val */
assert( (q - normalized->bv_val) <= (p - val->bv_val) );
/* null terminate */
*q = '\0';
normalized->bv_len = q - normalized->bv_val;
if( BER_BVISEMPTY( normalized ) ) {
normalized->bv_val = slap_sl_realloc( normalized->bv_val, 2, ctx );
normalized->bv_val[0] = ' ';
normalized->bv_val[1] = '\0';
normalized->bv_len = 1;
}
return LDAP_SUCCESS;
}
| 0
|
399,642
|
static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr)
{
struct worker *worker = NULL;
struct worker_pool *pool;
struct pool_workqueue *pwq;
might_sleep();
local_irq_disable();
pool = get_work_pool(work);
if (!pool) {
local_irq_enable();
return false;
}
spin_lock(&pool->lock);
/* see the comment in try_to_grab_pending() with the same code */
pwq = get_work_pwq(work);
if (pwq) {
if (unlikely(pwq->pool != pool))
goto already_gone;
} else {
worker = find_worker_executing_work(pool, work);
if (!worker)
goto already_gone;
pwq = worker->current_pwq;
}
check_flush_dependency(pwq->wq, work);
insert_wq_barrier(pwq, barr, work, worker);
spin_unlock_irq(&pool->lock);
/*
* If @max_active is 1 or rescuer is in use, flushing another work
* item on the same workqueue may lead to deadlock. Make sure the
* flusher is not running on the same workqueue by verifying write
* access.
*/
if (pwq->wq->saved_max_active == 1 || pwq->wq->rescuer)
lock_map_acquire(&pwq->wq->lockdep_map);
else
lock_map_acquire_read(&pwq->wq->lockdep_map);
lock_map_release(&pwq->wq->lockdep_map);
return true;
already_gone:
spin_unlock_irq(&pool->lock);
return false;
}
| 0
|
23,059
|
int write_command_to_file ( char * cmd ) {
char * buffer ;
char * ip_address ;
int dummy ;
char * p ;
FILE * fp ;
struct stat statbuf ;
char error_string [ MAX_INPUT_BUFFER ] ;
if ( ! cmd || ! * cmd || strchr ( cmd , '\n' ) ) return ERROR ;
if ( stat ( command_file , & statbuf ) ) {
snprintf ( error_string , sizeof ( error_string ) , "Error: Could not stat() command file '%s'!" , command_file ) ;
error_string [ sizeof ( error_string ) - 1 ] = '\x0' ;
print_generic_error_message ( error_string , "The external command file may be missing, Icinga may not be running, and/or Icinga may not be checking external commands." , 2 ) ;
return ERROR ;
}
fp = fopen ( command_file , "w" ) ;
if ( fp == NULL ) {
snprintf ( error_string , sizeof ( error_string ) , "Error: Could not open command file '%s' for update!" , command_file ) ;
error_string [ sizeof ( error_string ) - 1 ] = '\x0' ;
print_generic_error_message ( error_string , "The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions." , 2 ) ;
return ERROR ;
}
if ( use_logging == TRUE ) {
p = strchr ( cmd , ']' ) ;
if ( p != NULL ) p += 2 ;
else p = & cmd [ 0 ] ;
ip_address = strdup ( getenv ( "REMOTE_ADDR" ) ) ;
dummy = asprintf ( & buffer , "EXTERNAL COMMAND: %s;
%s;
%s" , current_authdata . username , ( ip_address != NULL ) ? ip_address : "unknown remote address" , p ) ;
write_to_cgi_log ( buffer ) ;
if ( enforce_comments_on_actions == TRUE ) {
my_free ( buffer ) ;
dummy = asprintf ( & buffer , "FORCED COMMENT: %s;
%s;
%s;
%s" , current_authdata . username , ( ip_address != NULL ) ? ip_address : "unknown remote address" , comment_author , comment_data ) ;
write_to_cgi_log ( buffer ) ;
}
my_free ( buffer ) ;
}
fprintf ( fp , "%s\n" , cmd ) ;
fflush ( fp ) ;
fclose ( fp ) ;
return OK ;
}
| 0
|
93,808
|
cifs_writedata_alloc(unsigned int nr_pages)
{
struct cifs_writedata *wdata;
/* this would overflow */
if (nr_pages == 0) {
cERROR(1, "%s: called with nr_pages == 0!", __func__);
return NULL;
}
/* writedata + number of page pointers */
wdata = kzalloc(sizeof(*wdata) +
sizeof(struct page *) * (nr_pages - 1), GFP_NOFS);
if (wdata != NULL) {
INIT_WORK(&wdata->work, cifs_writev_complete);
kref_init(&wdata->refcount);
}
return wdata;
}
| 0
|
265,877
|
void CollectGraphs(EagerContext* ctx) {
mutex_lock ml(*ctx->MetadataMu());
GraphCollector* collector = ctx->GetGraphCollector();
mutex_lock mll(collector->mu);
// Adding to partition graphs for backward compatibility.
for (const auto& graph : collector->partitioned_graphs) {
*ctx->RunMetadataProto()->add_partition_graphs() = graph;
}
if (collector->dirty) {
auto* function_graphs = ctx->RunMetadataProto()->add_function_graphs();
*function_graphs->mutable_post_optimization_graph() =
collector->optimized_graph;
*function_graphs->mutable_pre_optimization_graph() = collector->raw_graph;
for (const auto& graph : collector->partitioned_graphs) {
*function_graphs->add_partition_graphs() = graph;
}
}
collector->ClearGraphs();
}
| 0
|
290,356
|
static int imc_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int ret, i;
IMCContext *q = avctx->priv_data;
LOCAL_ALIGNED_16(uint16_t, buf16, [IMC_BLOCK_SIZE / 2]);
if (buf_size < IMC_BLOCK_SIZE * avctx->channels) {
av_log(avctx, AV_LOG_ERROR, "frame too small!\n");
return AVERROR_INVALIDDATA;
}
/* get output buffer */
frame->nb_samples = COEFFS;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
for (i = 0; i < avctx->channels; i++) {
q->out_samples = (float *)frame->extended_data[i];
q->bdsp.bswap16_buf(buf16, (const uint16_t *) buf, IMC_BLOCK_SIZE / 2);
init_get_bits(&q->gb, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8);
buf += IMC_BLOCK_SIZE;
if ((ret = imc_decode_block(avctx, q, i)) < 0)
return ret;
}
if (avctx->channels == 2) {
q->fdsp.butterflies_float((float *)frame->extended_data[0],
(float *)frame->extended_data[1], COEFFS);
}
*got_frame_ptr = 1;
return IMC_BLOCK_SIZE * avctx->channels;
}
| 1
|
455,106
|
TEST_F(QueryPlannerTest, ShardFilterBasicCovered) {
params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;
params.shardKey = BSON("a" << 1);
addIndex(BSON("a" << 1));
runQuery(fromjson("{a: 1}"));
assertNumSolutions(1U);
assertSolutionExists(
"{fetch: {node: "
"{sharding_filter: {node: "
"{ixscan: {pattern: {a: 1}}}}}}}");
}
| 0
|
200,697
|
static void LodePNGText_cleanup(LodePNGInfo* info)
{
size_t i;
for(i = 0; i < info->text_num; i++)
{
string_cleanup(&info->text_keys[i]);
string_cleanup(&info->text_strings[i]);
}
free(info->text_keys);
free(info->text_strings);
}
| 0
|
332,114
|
void qemu_vfree(void *ptr)
{
/* may be useful some day, but currently we do not need to free */
}
| 0
|
352,064
|
TPMI_SM4_KEY_BITS_Unmarshal(TPMI_SM4_KEY_BITS *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_KEY_BITS_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
switch (*target) {
case 128:
break;
default:
rc = TPM_RC_VALUE;
}
}
return rc;
}
| 1
|
297,898
|
ASC_acceptContextsWithPreferredTransferSyntaxes(
T_ASC_Parameters * params,
const char* abstractSyntaxes[], int abstractSyntaxCount,
const char* transferSyntaxes[], int transferSyntaxCount,
T_ASC_SC_ROLE acceptedRole)
{
int i;
OFCondition cond = EC_Normal;
/*
** Accept in the order "least wanted" to "most wanted" transfer
** syntax. Accepting a transfer syntax will override previously
** accepted transfer syntaxes.
*/
for (i=transferSyntaxCount-1; i>=0; i--)
{
cond = ASC_acceptContextsWithTransferSyntax(
params, transferSyntaxes[i],
abstractSyntaxCount, abstractSyntaxes, acceptedRole);
if (cond.bad()) return cond;
}
return cond;
}
| 0
|
466,253
|
TEST_F(HttpConnectionManagerImplTest, DateHeaderNotPresent) {
setup(false, "");
setUpEncoderAndDecoder(false, false);
sendRequestHeadersAndData();
const auto* modified_headers = sendResponseHeaders(
ResponseHeaderMapPtr{new TestResponseHeaderMapImpl{{":status", "200"}, {"server", "foo"}}});
ASSERT_TRUE(modified_headers);
EXPECT_TRUE(modified_headers->Date());
doRemoteClose();
}
| 0
|
393,958
|
void show_state_filter(unsigned long state_filter)
{
struct task_struct *g, *p;
#if BITS_PER_LONG == 32
printk(KERN_INFO
" task PC stack pid father\n");
#else
printk(KERN_INFO
" task PC stack pid father\n");
#endif
rcu_read_lock();
for_each_process_thread(g, p) {
/*
* reset the NMI-timeout, listing all files on a slow
* console might take a lot of time:
*/
touch_nmi_watchdog();
if (!state_filter || (p->state & state_filter))
sched_show_task(p);
}
touch_all_softlockup_watchdogs();
#ifdef CONFIG_SCHED_DEBUG
sysrq_sched_debug_show();
#endif
rcu_read_unlock();
/*
* Only show locks if all tasks are dumped:
*/
if (!state_filter)
debug_show_all_locks();
}
| 0
|
63,899
|
Wasm::Wasm(absl::string_view vm, absl::string_view vm_id, absl::string_view vm_configuration,
PluginSharedPtr plugin, Stats::ScopeSharedPtr scope,
Upstream::ClusterManager& cluster_manager, Event::Dispatcher& dispatcher)
: vm_id_(std::string(vm_id)), wasm_vm_(Common::Wasm::createWasmVm(vm)), plugin_(plugin),
scope_(scope), cluster_manager_(cluster_manager), dispatcher_(dispatcher),
time_source_(dispatcher.timeSource()), vm_configuration_(vm_configuration),
stat_name_set_(scope_->symbolTable().makeSet("Wasm").release()) {}
| 0
|
415,535
|
imapx_untagged_flags (CamelIMAPXServer *is,
GInputStream *input_stream,
GCancellable *cancellable,
GError **error)
{
guint32 flags = 0;
gboolean success;
g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
success = imapx_parse_flags (
CAMEL_IMAPX_INPUT_STREAM (input_stream),
&flags, NULL, cancellable, error);
c (is->priv->tagprefix, "flags: %08x\n", flags);
return success;
}
| 0
|
247,429
|
void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() {
legacy_render_widget_host_HWND_ = NULL;
legacy_window_destroyed_ = true;
}
| 0
|
234,660
|
bool HTMLFormControlElement::isAutofocusable() const
{
return fastHasAttribute(autofocusAttr) && supportsAutofocus();
}
| 0
|
107,284
|
static char *write_metadata (WavpackMetadata *wpmd, char *outdata)
{
unsigned char id = wpmd->id, wordlen [3];
wordlen [0] = (wpmd->byte_length + 1) >> 1;
wordlen [1] = (wpmd->byte_length + 1) >> 9;
wordlen [2] = (wpmd->byte_length + 1) >> 17;
if (wpmd->byte_length & 1)
id |= ID_ODD_SIZE;
if (wordlen [1] || wordlen [2])
id |= ID_LARGE;
*outdata++ = id;
*outdata++ = wordlen [0];
if (id & ID_LARGE) {
*outdata++ = wordlen [1];
*outdata++ = wordlen [2];
}
if (wpmd->data && wpmd->byte_length) {
memcpy (outdata, wpmd->data, wpmd->byte_length);
outdata += wpmd->byte_length;
if (wpmd->byte_length & 1)
*outdata++ = 0;
}
return outdata;
}
| 0
|
298,258
|
void CreateStatusBar(void)
{
SIZE sz = {0, 0};
RECT rect;
LONG x, y, width, height;
int edge[3];
TBBUTTON tbbStatusToolbarButtons[1];
TBBUTTONINFO tbi;
HFONT hFont;
HDC hDC;
// Create the status bar (WS_CLIPSIBLINGS since we have an overlapping button)
hStatus = CreateWindowExW(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS | WS_CLIPSIBLINGS,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hMainDialog,
(HMENU)IDC_STATUS, hMainInstance, NULL);
// Keep track of the status bar height
GetClientRect(hStatus, &rect);
height = rect.bottom;
// Set the font we'll use to display the '#' sign in the toolbar button
hFont = CreateFontA(-MulDiv(10, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72),
0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
0, 0, PROOF_QUALITY, 0, (nWindowsVersion >= WINDOWS_VISTA)?"Segoe UI":"Arial Unicode MS");
// Find the width of our hash sign
hDC = GetDC(hMainDialog);
SelectObject(hDC, hFont);
GetTextExtentPoint32W(hDC, L"#", 1, &sz);
if (hDC != NULL)
ReleaseDC(hMainDialog, hDC);
// Create 3 status areas
GetClientRect(hMainDialog, &rect);
edge[1] = rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale);
edge[0] = edge[1] - (8 + sz.cx + 8 + 1); // There's 8 absolute pixels on right and left of the text
edge[2] = rect.right;
SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge);
// NB: To add an icon on the status bar, you can use something like this:
// SendMessage(hStatus, SB_SETICON, (WPARAM) 1, (LPARAM)LoadImage(GetLibraryHandle("rasdlg"),
// MAKEINTRESOURCE(50), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED));
// This is supposed to create a toolips for a statusbar section (when SBARS_TOOLTIPS is in use)... but doesn't :(
// SendMessageLU(hStatus, SB_SETTIPTEXT, (WPARAM)2, (LPARAM)"HELLO");
// Compute the dimensions for the hash button
x = edge[0];
if (nWindowsVersion <= WINDOWS_XP) {
x -= 1;
height -= 2;
}
y = rect.bottom - height + 1;
width = edge[1] - edge[0] - 1;
// How I wish there was a way to figure out how to make Windows controls look good
// at all scales, without adding all these crappy empirical adjustments...
if ((fScale > 1.20f) && (fScale <2.40f))
height -= 1;
if (nWindowsVersion <= WINDOWS_7)
height += 1;
// Create the status toolbar
hStatusToolbar = CreateWindowExW(WS_EX_TRANSPARENT, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | WS_DISABLED |
TBSTYLE_LIST | CCS_NOPARENTALIGN | CCS_NODIVIDER | CCS_NORESIZE,
x, y, width, height, hMainDialog, (HMENU)IDC_STATUS_TOOLBAR, hMainInstance, NULL);
// Set the button properties
SendMessage(hStatusToolbar, WM_SETFONT, (WPARAM)hFont, TRUE);
SendMessage(hStatusToolbar, TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_MIXEDBUTTONS);
SendMessage(hStatusToolbar, TB_SETIMAGELIST, 0, (LPARAM)NULL);
SendMessage(hStatusToolbar, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)NULL);
SendMessage(hStatusToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(0,0));
// Set our text
memset(tbbStatusToolbarButtons, 0, sizeof(TBBUTTON));
tbbStatusToolbarButtons[0].idCommand = IDC_HASH;
tbbStatusToolbarButtons[0].fsStyle = BTNS_SHOWTEXT;
tbbStatusToolbarButtons[0].fsState = TBSTATE_ENABLED;
tbbStatusToolbarButtons[0].iString = (INT_PTR)L"#";
SendMessage(hStatusToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
SendMessage(hStatusToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbbStatusToolbarButtons);
SendMessage(hStatusToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height - 1));
// Yeah, you'd think that TB_SETBUTTONSIZE would work for the width... but you'd be wrong.
// The only working method that actually enforces the requested width is TB_SETBUTTONINFO
tbi.cbSize = sizeof(tbi);
tbi.dwMask = TBIF_SIZE | TBIF_COMMAND;
tbi.cx = (WORD)width;
tbi.idCommand = IDC_HASH;
SendMessage(hStatusToolbar, TB_SETBUTTONINFO, (WPARAM)IDC_HASH, (LPARAM)&tbi);
// Need to resend the positioning for the toolbar to become active... One of Windows' mysteries
// Also use this opportunity to set our Z-order for tab stop
SetWindowPos(hStatusToolbar, GetDlgItem(hMainDialog, IDCANCEL), x, y, width, height, 0);
ShowWindow(hStatusToolbar, SW_SHOWNORMAL);
}
| 0
|
19,254
|
IN_PROC_BROWSER_TEST_F ( BluetoothChooserBrowserTest , InvokeDialog_ConnectedBubble ) {
set_status ( FakeBluetoothChooserController : : BluetoothStatus : : IDLE ) ;
AddConnectedDevice ( ) ;
RunDialog ( ) ;
}
| 0
|
341,195
|
void ff_vp3_idct_c(DCTELEM *block/* align 16*/){
idct(NULL, 0, block, 0);
}
| 0
|
334,700
|
static bool memory_region_access_valid(MemoryRegion *mr,
target_phys_addr_t addr,
unsigned size)
{
if (!mr->ops->valid.unaligned && (addr & (size - 1))) {
return false;
}
/* Treat zero as compatibility all valid */
if (!mr->ops->valid.max_access_size) {
return true;
}
if (size > mr->ops->valid.max_access_size
|| size < mr->ops->valid.min_access_size) {
return false;
}
return true;
}
| 0
|
299,258
|
int mg_base64_final(char *to, int n) {
int saved = n;
// printf("---[%.*s]\n", n, to);
if (n & 3) n = mg_base64_update(0, to, n);
if ((saved & 3) == 2) n--;
// printf(" %d[%.*s]\n", n, n, to);
while (n & 3) to[n++] = '=';
to[n] = '\0';
return n;
}
| 0
|
423,033
|
*__dma_request_slave_channel_compat(const dma_cap_mask_t *mask,
dma_filter_fn fn, void *fn_param,
struct device *dev, char *name)
{
struct dma_chan *chan;
chan = dma_request_slave_channel(dev, name);
if (chan)
return chan;
return __dma_request_channel(mask, fn, fn_param);
}
| 0
|
471,294
|
void killRDBChild(void) {
kill(server.rdb_child_pid,SIGUSR1);
rdbRemoveTempFile(server.rdb_child_pid, 0);
closeChildInfoPipe();
updateDictResizePolicy();
}
| 0
|
473,917
|
hash_value_compare(const void *a, const void *b)
{
uint64_t ia = (uint64_t)a;
uint64_t ib = (uint64_t)b;
return ia == ib;
}
| 0
|
258,048
|
int get_ber_length ( tvbuff_t * tvb , int offset , guint32 * length , gboolean * ind ) {
return try_get_ber_length ( tvb , offset , length , ind , 1 ) ;
}
| 0
|
98,786
|
findfilendir(
typval_T *argvars UNUSED,
typval_T *rettv,
int find_what UNUSED)
{
#ifdef FEAT_SEARCHPATH
char_u *fname;
char_u *fresult = NULL;
char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path;
char_u *p;
char_u pathbuf[NUMBUFLEN];
int count = 1;
int first = TRUE;
int error = FALSE;
#endif
rettv->vval.v_string = NULL;
rettv->v_type = VAR_STRING;
if (in_vim9script()
&& (check_for_nonempty_string_arg(argvars, 0) == FAIL
|| check_for_opt_string_arg(argvars, 1) == FAIL
|| (argvars[1].v_type != VAR_UNKNOWN
&& check_for_opt_number_arg(argvars, 2) == FAIL)))
return;
#ifdef FEAT_SEARCHPATH
fname = tv_get_string(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN)
{
p = tv_get_string_buf_chk(&argvars[1], pathbuf);
if (p == NULL)
error = TRUE;
else
{
if (*p != NUL)
path = p;
if (argvars[2].v_type != VAR_UNKNOWN)
count = (int)tv_get_number_chk(&argvars[2], &error);
}
}
if (count < 0 && rettv_list_alloc(rettv) == FAIL)
error = TRUE;
if (*fname != NUL && !error)
{
do
{
if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST)
vim_free(fresult);
fresult = find_file_in_path_option(first ? fname : NULL,
first ? (int)STRLEN(fname) : 0,
0, first, path,
find_what,
curbuf->b_ffname,
find_what == FINDFILE_DIR
? (char_u *)"" : curbuf->b_p_sua);
first = FALSE;
if (fresult != NULL && rettv->v_type == VAR_LIST)
list_append_string(rettv->vval.v_list, fresult, -1);
} while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL);
}
if (rettv->v_type == VAR_STRING)
rettv->vval.v_string = fresult;
#endif
}
| 0
|
298,765
|
static cimg_uint64 min() { return 0; }
| 0
|
95,553
|
virtio_set_modern_pio_bar(struct virtio_base *base, int barnum)
{
int rc;
struct virtio_pci_notify_cap notify_pio = {
.cap.cap_vndr = PCIY_VENDOR,
.cap.cap_next = 0,
.cap.cap_len = sizeof(notify_pio),
.cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG,
.cap.bar = barnum,
.cap.offset = 0,
.cap.length = 4,
.notify_off_multiplier = 0,
};
/* notification capability */
rc = pci_emul_add_capability(base->dev, (u_char *)¬ify_pio,
sizeof(notify_pio));
if (rc != 0) {
pr_err("pci emulation add notification capability for virtio modern PIO BAR failed\n");
return -1;
}
/* allocate and register modern pio bar */
rc = pci_emul_alloc_bar(base->dev, barnum, PCIBAR_IO, 4);
if (rc != 0) {
pr_err("allocate and register modern pio bar failed\n");
return -1;
}
base->modern_pio_bar_idx = barnum;
return 0;
}
| 0
|
394,631
|
wb_set_offset(struct archive_write *a, int64_t off)
{
struct iso9660 *iso9660 = (struct iso9660 *)a->format_data;
int64_t used, ext_bytes;
if (iso9660->wbuff_type != WB_TO_TEMP) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Internal Programing error: iso9660:wb_set_offset()");
return (ARCHIVE_FATAL);
}
used = sizeof(iso9660->wbuff) - iso9660->wbuff_remaining;
if (iso9660->wbuff_offset + used > iso9660->wbuff_tail)
iso9660->wbuff_tail = iso9660->wbuff_offset + used;
if (iso9660->wbuff_offset < iso9660->wbuff_written) {
if (used > 0 &&
write_to_temp(a, iso9660->wbuff, (size_t)used) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
iso9660->wbuff_offset = iso9660->wbuff_written;
lseek(iso9660->temp_fd, iso9660->wbuff_offset, SEEK_SET);
iso9660->wbuff_remaining = sizeof(iso9660->wbuff);
used = 0;
}
if (off < iso9660->wbuff_offset) {
/*
* Write out waiting data.
*/
if (used > 0) {
if (wb_write_out(a) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
}
lseek(iso9660->temp_fd, off, SEEK_SET);
iso9660->wbuff_offset = off;
iso9660->wbuff_remaining = sizeof(iso9660->wbuff);
} else if (off <= iso9660->wbuff_tail) {
iso9660->wbuff_remaining = (size_t)
(sizeof(iso9660->wbuff) - (off - iso9660->wbuff_offset));
} else {
ext_bytes = off - iso9660->wbuff_tail;
iso9660->wbuff_remaining = (size_t)(sizeof(iso9660->wbuff)
- (iso9660->wbuff_tail - iso9660->wbuff_offset));
while (ext_bytes >= (int64_t)iso9660->wbuff_remaining) {
if (write_null(a, (size_t)iso9660->wbuff_remaining)
!= ARCHIVE_OK)
return (ARCHIVE_FATAL);
ext_bytes -= iso9660->wbuff_remaining;
}
if (ext_bytes > 0) {
if (write_null(a, (size_t)ext_bytes) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
}
}
return (ARCHIVE_OK);
}
| 0
|
258,392
|
char * xmlrpc_time2date ( char * buf , time_t t ) {
char timebuf [ XMLRPC_BUFSIZE ] ;
struct tm * tm ;
* buf = '\0' ;
tm = localtime ( & t ) ;
strftime ( timebuf , XMLRPC_BUFSIZE - 1 , "%Y%m%dT%I:%M:%S" , tm ) ;
snprintf ( buf , XMLRPC_BUFSIZE , "<dateTime.iso8601>%s</dateTime.iso8601>" , timebuf ) ;
return buf ;
}
| 0
|
176,665
|
LoginBigUserView* LockContentsView::TestApi::primary_big_view() const {
return view_->primary_big_view_;
}
| 0
|
113,961
|
nv_exmode(cmdarg_T *cap)
{
/*
* Ignore 'Q' in Visual mode, just give a beep.
*/
if (VIsual_active)
vim_beep(BO_EX);
else if (!checkclearop(cap->oap))
do_exmode(FALSE);
}
| 0
|
472,050
|
static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info)
{
stbi_uc version;
if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8')
return stbi__err("not GIF", "Corrupt GIF");
version = stbi__get8(s);
if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF");
if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF");
stbi__g_failure_reason = "";
g->w = stbi__get16le(s);
g->h = stbi__get16le(s);
g->flags = stbi__get8(s);
g->bgindex = stbi__get8(s);
g->ratio = stbi__get8(s);
g->transparent = -1;
if (g->w > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)");
if (g->h > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)");
if (comp != 0) *comp = 4; // can't actually tell whether it's 3 or 4 until we parse the comments
if (is_info) return 1;
if (g->flags & 0x80)
stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1);
return 1;
}
| 0
|
259,608
|
static unsigned long weighted_cpuload(const int cpu)
{
return cpu_rq(cpu)->load.weight;
}
| 0
|
481,663
|
static int nf_tables_fill_rule_info(struct sk_buff *skb, struct net *net,
u32 portid, u32 seq, int event,
u32 flags, int family,
const struct nft_table *table,
const struct nft_chain *chain,
const struct nft_rule *rule, u64 handle)
{
struct nlmsghdr *nlh;
const struct nft_expr *expr, *next;
struct nlattr *list;
u16 type = nfnl_msg_type(NFNL_SUBSYS_NFTABLES, event);
nlh = nfnl_msg_put(skb, portid, seq, type, flags, family, NFNETLINK_V0,
nft_base_seq(net));
if (!nlh)
goto nla_put_failure;
if (nla_put_string(skb, NFTA_RULE_TABLE, table->name))
goto nla_put_failure;
if (nla_put_string(skb, NFTA_RULE_CHAIN, chain->name))
goto nla_put_failure;
if (nla_put_be64(skb, NFTA_RULE_HANDLE, cpu_to_be64(rule->handle),
NFTA_RULE_PAD))
goto nla_put_failure;
if (event != NFT_MSG_DELRULE && handle) {
if (nla_put_be64(skb, NFTA_RULE_POSITION, cpu_to_be64(handle),
NFTA_RULE_PAD))
goto nla_put_failure;
}
if (chain->flags & NFT_CHAIN_HW_OFFLOAD)
nft_flow_rule_stats(chain, rule);
list = nla_nest_start_noflag(skb, NFTA_RULE_EXPRESSIONS);
if (list == NULL)
goto nla_put_failure;
nft_rule_for_each_expr(expr, next, rule) {
if (nft_expr_dump(skb, NFTA_LIST_ELEM, expr) < 0)
goto nla_put_failure;
}
nla_nest_end(skb, list);
if (rule->udata) {
struct nft_userdata *udata = nft_userdata(rule);
if (nla_put(skb, NFTA_RULE_USERDATA, udata->len + 1,
udata->data) < 0)
goto nla_put_failure;
}
nlmsg_end(skb, nlh);
return 0;
nla_put_failure:
nlmsg_trim(skb, nlh);
return -1;
}
| 0
|
151,831
|
Perl_reg_numbered_buff_length(pTHX_ REGEXP * const r, const SV * const sv,
const I32 paren)
{
struct regexp *const rx = ReANY(r);
I32 i;
I32 s1, t1;
PERL_ARGS_ASSERT_REG_NUMBERED_BUFF_LENGTH;
if ( paren == RX_BUFF_IDX_CARET_PREMATCH
|| paren == RX_BUFF_IDX_CARET_FULLMATCH
|| paren == RX_BUFF_IDX_CARET_POSTMATCH
)
{
bool keepcopy = cBOOL(rx->extflags & RXf_PMf_KEEPCOPY);
if (!keepcopy) {
/* on something like
* $r = qr/.../;
* /$qr/p;
* the KEEPCOPY is set on the PMOP rather than the regex */
if (PL_curpm && r == PM_GETRE(PL_curpm))
keepcopy = cBOOL(PL_curpm->op_pmflags & PMf_KEEPCOPY);
}
if (!keepcopy)
goto warn_undef;
}
/* Some of this code was originally in C<Perl_magic_len> in F<mg.c> */
switch (paren) {
case RX_BUFF_IDX_CARET_PREMATCH: /* ${^PREMATCH} */
case RX_BUFF_IDX_PREMATCH: /* $` */
if (rx->offs[0].start != -1) {
i = rx->offs[0].start;
if (i > 0) {
s1 = 0;
t1 = i;
goto getlen;
}
}
return 0;
case RX_BUFF_IDX_CARET_POSTMATCH: /* ${^POSTMATCH} */
case RX_BUFF_IDX_POSTMATCH: /* $' */
if (rx->offs[0].end != -1) {
i = rx->sublen - rx->offs[0].end;
if (i > 0) {
s1 = rx->offs[0].end;
t1 = rx->sublen;
goto getlen;
}
}
return 0;
default: /* $& / ${^MATCH}, $1, $2, ... */
if (paren <= (I32)rx->nparens &&
(s1 = rx->offs[paren].start) != -1 &&
(t1 = rx->offs[paren].end) != -1)
{
i = t1 - s1;
goto getlen;
} else {
warn_undef:
if (ckWARN(WARN_UNINITIALIZED))
report_uninit((const SV *)sv);
return 0;
}
}
getlen:
if (i > 0 && RXp_MATCH_UTF8(rx)) {
const char * const s = rx->subbeg - rx->suboffset + s1;
const U8 *ep;
STRLEN el;
i = t1 - s1;
if (is_utf8_string_loclen((U8*)s, i, &ep, &el))
i = el;
}
return i;
}
| 0
|
30,381
|
static inline uint8_t NVRAM_get_byte ( m48t59_t * nvram , uint32_t addr ) {
m48t59_set_addr ( nvram , addr ) ;
return m48t59_read ( nvram ) ;
}
| 0
|
328,086
|
static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cs = CPU(dev);
X86CPU *cpu = X86_CPU(dev);
X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
CPUX86State *env = &cpu->env;
Error *local_err = NULL;
static bool ht_warned;
if (xcc->kvm_required && !kvm_enabled()) {
char *name = x86_cpu_class_get_model_name(xcc);
error_setg(&local_err, "CPU model '%s' requires KVM", name);
g_free(name);
goto out;
}
if (cpu->apic_id == UNASSIGNED_APIC_ID) {
error_setg(errp, "apic-id property was not initialized properly");
return;
}
x86_cpu_expand_features(cpu, &local_err);
if (local_err) {
goto out;
}
if (x86_cpu_filter_features(cpu) &&
(cpu->check_cpuid || cpu->enforce_cpuid)) {
x86_cpu_report_filtered_features(cpu);
if (cpu->enforce_cpuid) {
error_setg(&local_err,
kvm_enabled() ?
"Host doesn't support requested features" :
"TCG doesn't support requested features");
goto out;
}
}
/* On AMD CPUs, some CPUID[8000_0001].EDX bits must match the bits on
* CPUID[1].EDX.
*/
if (IS_AMD_CPU(env)) {
env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES;
env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX]
& CPUID_EXT2_AMD_ALIASES);
}
/* For 64bit systems think about the number of physical bits to present.
* ideally this should be the same as the host; anything other than matching
* the host can cause incorrect guest behaviour.
* QEMU used to pick the magic value of 40 bits that corresponds to
* consumer AMD devices but nothing else.
*/
if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) {
if (kvm_enabled()) {
uint32_t host_phys_bits = x86_host_phys_bits();
static bool warned;
if (cpu->host_phys_bits) {
/* The user asked for us to use the host physical bits */
cpu->phys_bits = host_phys_bits;
}
/* Print a warning if the user set it to a value that's not the
* host value.
*/
if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 &&
!warned) {
error_report("Warning: Host physical bits (%u)"
" does not match phys-bits property (%u)",
host_phys_bits, cpu->phys_bits);
warned = true;
}
if (cpu->phys_bits &&
(cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS ||
cpu->phys_bits < 32)) {
error_setg(errp, "phys-bits should be between 32 and %u "
" (but is %u)",
TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits);
return;
}
} else {
if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) {
error_setg(errp, "TCG only supports phys-bits=%u",
TCG_PHYS_ADDR_BITS);
return;
}
}
/* 0 means it was not explicitly set by the user (or by machine
* compat_props or by the host code above). In this case, the default
* is the value used by TCG (40).
*/
if (cpu->phys_bits == 0) {
cpu->phys_bits = TCG_PHYS_ADDR_BITS;
}
} else {
/* For 32 bit systems don't use the user set value, but keep
* phys_bits consistent with what we tell the guest.
*/
if (cpu->phys_bits != 0) {
error_setg(errp, "phys-bits is not user-configurable in 32 bit");
return;
}
if (env->features[FEAT_1_EDX] & CPUID_PSE36) {
cpu->phys_bits = 36;
} else {
cpu->phys_bits = 32;
}
}
cpu_exec_realizefn(cs, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
if (tcg_enabled()) {
tcg_x86_init();
}
#ifndef CONFIG_USER_ONLY
qemu_register_reset(x86_cpu_machine_reset_cb, cpu);
if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) {
x86_cpu_apic_create(cpu, &local_err);
if (local_err != NULL) {
goto out;
}
}
#endif
mce_init(cpu);
#ifndef CONFIG_USER_ONLY
if (tcg_enabled()) {
AddressSpace *as_normal = address_space_init_shareable(cs->memory,
"cpu-memory");
AddressSpace *as_smm = g_new(AddressSpace, 1);
cpu->cpu_as_mem = g_new(MemoryRegion, 1);
cpu->cpu_as_root = g_new(MemoryRegion, 1);
/* Outer container... */
memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull);
memory_region_set_enabled(cpu->cpu_as_root, true);
/* ... with two regions inside: normal system memory with low
* priority, and...
*/
memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory",
get_system_memory(), 0, ~0ull);
memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0);
memory_region_set_enabled(cpu->cpu_as_mem, true);
address_space_init(as_smm, cpu->cpu_as_root, "CPU");
cs->num_ases = 2;
cpu_address_space_init(cs, as_normal, 0);
cpu_address_space_init(cs, as_smm, 1);
/* ... SMRAM with higher priority, linked from /machine/smram. */
cpu->machine_done.notify = x86_cpu_machine_done;
qemu_add_machine_init_done_notifier(&cpu->machine_done);
}
#endif
qemu_init_vcpu(cs);
/* Only Intel CPUs support hyperthreading. Even though QEMU fixes this
* issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX
* based on inputs (sockets,cores,threads), it is still better to gives
* users a warning.
*
* NOTE: the following code has to follow qemu_init_vcpu(). Otherwise
* cs->nr_threads hasn't be populated yet and the checking is incorrect.
*/
if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) {
error_report("AMD CPU doesn't support hyperthreading. Please configure"
" -smp options properly.");
ht_warned = true;
}
x86_cpu_apic_realize(cpu, &local_err);
if (local_err != NULL) {
goto out;
}
cpu_reset(cs);
xcc->parent_realize(dev, &local_err);
out:
if (local_err != NULL) {
error_propagate(errp, local_err);
return;
}
}
| 0
|
119,399
|
void *fxArrayBuffer(txMachine* the, txSlot* slot, void* data, txInteger byteLength, txInteger maxByteLength)
{
txSlot* instance;
txSlot* arrayBuffer;
txSlot* bufferInfo;
if (byteLength < 0)
mxRangeError("invalid byteLength %ld", byteLength);
mxPush(mxArrayBufferPrototype);
instance = fxNewArrayBufferInstance(the);
arrayBuffer = instance->next;
arrayBuffer->value.arrayBuffer.address = fxNewChunk(the, byteLength);
bufferInfo = arrayBuffer->next;
bufferInfo->value.bufferInfo.length = byteLength;
bufferInfo->value.bufferInfo.maxLength = maxByteLength;
if (data != NULL)
c_memcpy(arrayBuffer->value.arrayBuffer.address, data, byteLength);
else
c_memset(arrayBuffer->value.arrayBuffer.address, 0, byteLength);
mxPullSlot(slot);
return arrayBuffer->value.arrayBuffer.address;
}
| 0
|
296,404
|
GF_Err sdp_box_read(GF_Box *s, GF_BitStream *bs)
{
u32 length;
GF_SDPBox *ptr = (GF_SDPBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
length = (u32) (ptr->size);
if (length >= (u32)0xFFFFFFFF) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Invalid length %lu in sdp box\n", length));
return GF_ISOM_INVALID_FILE;
}
//sdp text has no delimiter !!!
ptr->sdpText = (char*)gf_malloc(sizeof(char) * (length+1));
if (!ptr->sdpText) return GF_OUT_OF_MEM;
gf_bs_read_data(bs, ptr->sdpText, length);
ptr->sdpText[length] = 0;
return GF_OK;
}
| 0
|
271,091
|
SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
struct timespec __user *, interval)
{
struct task_struct *p;
unsigned int time_slice;
unsigned long flags;
struct rq *rq;
int retval;
struct timespec t;
if (pid < 0)
return -EINVAL;
retval = -ESRCH;
rcu_read_lock();
p = find_process_by_pid(pid);
if (!p)
goto out_unlock;
retval = security_task_getscheduler(p);
if (retval)
goto out_unlock;
rq = task_rq_lock(p, &flags);
time_slice = p->sched_class->get_rr_interval(rq, p);
task_rq_unlock(rq, &flags);
rcu_read_unlock();
jiffies_to_timespec(time_slice, &t);
retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;
return retval;
out_unlock:
rcu_read_unlock();
return retval;
}
| 0
|
295,390
|
void traf_del(GF_Box *s)
{
GF_TrackFragmentBox *ptr = (GF_TrackFragmentBox *)s;
if (ptr == NULL) return;
if (ptr->tfhd) gf_isom_box_del((GF_Box *) ptr->tfhd);
if (ptr->sdtp) gf_isom_box_del((GF_Box *) ptr->sdtp);
if (ptr->sub_samples) gf_isom_box_array_del(ptr->sub_samples);
if (ptr->tfdt) gf_isom_box_del((GF_Box *) ptr->tfdt);
if (ptr->sample_encryption) gf_isom_box_del((GF_Box *) ptr->sample_encryption);
gf_isom_box_array_del(ptr->TrackRuns);
if (ptr->sampleGroups) gf_isom_box_array_del(ptr->sampleGroups);
if (ptr->sampleGroupsDescription) gf_isom_box_array_del(ptr->sampleGroupsDescription);
if (ptr->sai_sizes) gf_isom_box_array_del(ptr->sai_sizes);
if (ptr->sai_offsets) gf_isom_box_array_del(ptr->sai_offsets);
gf_free(ptr);
}
| 0
|
245,575
|
void parseVorbisComment(
const sp<MetaData> &fileMeta, const char *comment, size_t commentLength)
{
struct {
const char *const mTag;
uint32_t mKey;
} kMap[] = {
{ "TITLE", kKeyTitle },
{ "ARTIST", kKeyArtist },
{ "ALBUMARTIST", kKeyAlbumArtist },
{ "ALBUM ARTIST", kKeyAlbumArtist },
{ "COMPILATION", kKeyCompilation },
{ "ALBUM", kKeyAlbum },
{ "COMPOSER", kKeyComposer },
{ "GENRE", kKeyGenre },
{ "AUTHOR", kKeyAuthor },
{ "TRACKNUMBER", kKeyCDTrackNumber },
{ "DISCNUMBER", kKeyDiscNumber },
{ "DATE", kKeyDate },
{ "YEAR", kKeyYear },
{ "LYRICIST", kKeyWriter },
{ "METADATA_BLOCK_PICTURE", kKeyAlbumArt },
{ "ANDROID_LOOP", kKeyAutoLoop },
};
for (size_t j = 0; j < sizeof(kMap) / sizeof(kMap[0]); ++j) {
size_t tagLen = strlen(kMap[j].mTag);
if (!strncasecmp(kMap[j].mTag, comment, tagLen)
&& comment[tagLen] == '=') {
if (kMap[j].mKey == kKeyAlbumArt) {
extractAlbumArt(
fileMeta,
&comment[tagLen + 1],
commentLength - tagLen - 1);
} else if (kMap[j].mKey == kKeyAutoLoop) {
if (!strcasecmp(&comment[tagLen + 1], "true")) {
fileMeta->setInt32(kKeyAutoLoop, true);
}
} else {
fileMeta->setCString(kMap[j].mKey, &comment[tagLen + 1]);
}
}
}
}
| 0
|
142,105
|
qemuProcessShutdownOrReboot(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
if (priv->fakeReboot) {
g_autofree char *name = g_strdup_printf("reboot-%s", vm->def->name);
virThread th;
qemuDomainSetFakeReboot(driver, vm, false);
virObjectRef(vm);
if (virThreadCreateFull(&th,
false,
qemuProcessFakeReboot,
name,
false,
vm) < 0) {
VIR_ERROR(_("Failed to create reboot thread, killing domain"));
ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_NOWAIT));
priv->pausedShutdown = false;
virObjectUnref(vm);
}
} else {
ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_NOWAIT));
}
}
| 0
|
106,497
|
TEST_P(TcpTunnelingIntegrationTest, BasicUsePost) {
// Enable using POST.
config_helper_.addConfigModifier([&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void {
envoy::extensions::filters::network::tcp_proxy::v3::TcpProxy proxy_config;
proxy_config.set_stat_prefix("tcp_stats");
proxy_config.set_cluster("cluster_0");
proxy_config.mutable_tunneling_config()->set_hostname("host.com:80");
proxy_config.mutable_tunneling_config()->set_use_post(true);
auto* listeners = bootstrap.mutable_static_resources()->mutable_listeners();
for (auto& listener : *listeners) {
if (listener.name() != "tcp_proxy") {
continue;
}
auto* filter_chain = listener.mutable_filter_chains(0);
auto* filter = filter_chain->mutable_filters(0);
filter->mutable_typed_config()->PackFrom(proxy_config);
break;
}
});
initialize();
// Start a connection, and verify the upgrade headers are received upstream.
tcp_client_ = makeTcpConnection(lookupPort("tcp_proxy"));
ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_));
ASSERT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, upstream_request_));
ASSERT_TRUE(upstream_request_->waitForHeadersComplete());
EXPECT_EQ(upstream_request_->headers().get(Http::Headers::get().Method)[0]->value(), "POST");
// Send upgrade headers downstream, fully establishing the connection.
upstream_request_->encodeHeaders(default_response_headers_, false);
sendBidiData(fake_upstream_connection_);
closeConnection(fake_upstream_connection_);
}
| 0
|
253,755
|
BluetoothDeviceChooserController::BluetoothDeviceChooserController(
WebBluetoothServiceImpl* web_bluetooth_service,
RenderFrameHost* render_frame_host,
device::BluetoothAdapter* adapter)
: adapter_(adapter),
web_bluetooth_service_(web_bluetooth_service),
render_frame_host_(render_frame_host),
web_contents_(WebContents::FromRenderFrameHost(render_frame_host_)),
discovery_session_timer_(
FROM_HERE,
base::TimeDelta::FromSeconds(scan_duration_),
base::Bind(&BluetoothDeviceChooserController::StopDeviceDiscovery,
base::Unretained(this))) {
CHECK(adapter_);
}
| 0
|
286,873
|
static void m5206_mbar_writew(void *opaque, target_phys_addr_t offset,
uint32_t value)
{
m5206_mbar_state *s = (m5206_mbar_state *)opaque;
int width;
offset &= 0x3ff;
if (offset >= 0x200) {
hw_error("Bad MBAR write offset 0x%x", (int)offset);
}
width = m5206_mbar_width[offset >> 2];
if (width > 2) {
uint32_t tmp;
tmp = m5206_mbar_readl(opaque, offset & ~3);
if (offset & 3) {
tmp = (tmp & 0xffff0000) | value;
} else {
tmp = (tmp & 0x0000ffff) | (value << 16);
}
m5206_mbar_writel(opaque, offset & ~3, tmp);
return;
} else if (width < 2) {
m5206_mbar_writeb(opaque, offset, value >> 8);
m5206_mbar_writeb(opaque, offset + 1, value & 0xff);
return;
}
m5206_mbar_write(s, offset, value, 2);
}
| 0
|
414,306
|
GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
{
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION pslpi, ptr;
DWORD length;
GuestLogicalProcessorList *head, **link;
Error *local_err = NULL;
int64_t current;
ptr = pslpi = NULL;
length = 0;
current = 0;
head = NULL;
link = &head;
if ((GetLogicalProcessorInformation(pslpi, &length) == FALSE) &&
(GetLastError() == ERROR_INSUFFICIENT_BUFFER) &&
(length > sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION))) {
ptr = pslpi = g_malloc0(length);
if (GetLogicalProcessorInformation(pslpi, &length) == FALSE) {
error_setg(&local_err, "Failed to get processor information: %d",
(int)GetLastError());
}
} else {
error_setg(&local_err,
"Failed to get processor information buffer length: %d",
(int)GetLastError());
}
while ((local_err == NULL) && (length > 0)) {
if (pslpi->Relationship == RelationProcessorCore) {
ULONG_PTR cpu_bits = pslpi->ProcessorMask;
while (cpu_bits > 0) {
if (!!(cpu_bits & 1)) {
GuestLogicalProcessor *vcpu;
GuestLogicalProcessorList *entry;
vcpu = g_malloc0(sizeof *vcpu);
vcpu->logical_id = current++;
vcpu->online = true;
vcpu->has_can_offline = true;
entry = g_malloc0(sizeof *entry);
entry->value = vcpu;
*link = entry;
link = &entry->next;
}
cpu_bits >>= 1;
}
}
length -= sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
pslpi++; /* next entry */
}
g_free(ptr);
if (local_err == NULL) {
if (head != NULL) {
return head;
}
/* there's no guest with zero VCPUs */
error_setg(&local_err, "Guest reported zero VCPUs");
}
qapi_free_GuestLogicalProcessorList(head);
error_propagate(errp, local_err);
return NULL;
}
| 0
|
304,274
|
utfc_ptr2len(char_u *p)
{
int len;
int b0 = *p;
#ifdef FEAT_ARABIC
int prevlen;
#endif
if (b0 == NUL)
return 0;
if (b0 < 0x80 && p[1] < 0x80) // be quick for ASCII
return 1;
// Skip over first UTF-8 char, stopping at a NUL byte.
len = utf_ptr2len(p);
// Check for illegal byte.
if (len == 1 && b0 >= 0x80)
return 1;
/*
* Check for composing characters. We can handle only the first six, but
* skip all of them (otherwise the cursor would get stuck).
*/
#ifdef FEAT_ARABIC
prevlen = 0;
#endif
for (;;)
{
if (p[len] < 0x80 || !UTF_COMPOSINGLIKE(p + prevlen, p + len))
return len;
// Skip over composing char
#ifdef FEAT_ARABIC
prevlen = len;
#endif
len += utf_ptr2len(p + len);
}
}
| 0
|
156,854
|
void CLASS parse_ciff (int offset, int length, int depth)
{
int tboff, nrecs, c, type, len, save, wbi=-1;
ushort key[] = { 0x410, 0x45f3 };
fseek (ifp, offset+length-4, SEEK_SET);
tboff = get4() + offset;
fseek (ifp, tboff, SEEK_SET);
nrecs = get2();
if ((nrecs | depth) > 127) return;
while (nrecs--) {
type = get2();
len = get4();
save = ftell(ifp) + 4;
fseek (ifp, offset+get4(), SEEK_SET);
if ((((type >> 8) + 8) | 8) == 0x38) {
parse_ciff (ftell(ifp), len, depth+1); /* Parse a sub-table */
}
#ifdef LIBRAW_LIBRARY_BUILD
if (type == 0x3004) parse_ciff (ftell(ifp), len, depth+1);
#endif
if (type == 0x0810)
fread (artist, 64, 1, ifp);
if (type == 0x080a) {
fread (make, 64, 1, ifp);
fseek (ifp, strbuflen(make) - 63, SEEK_CUR);
fread (model, 64, 1, ifp);
}
if (type == 0x1810) {
width = get4();
height = get4();
pixel_aspect = int_to_float(get4());
flip = get4();
}
if (type == 0x1835) /* Get the decoder table */
tiff_compress = get4();
if (type == 0x2007) {
thumb_offset = ftell(ifp);
thumb_length = len;
}
if (type == 0x1818) {
shutter = libraw_powf64(2.0f, -int_to_float((get4(),get4())));
aperture = libraw_powf64(2.0f, int_to_float(get4())/2);
#ifdef LIBRAW_LIBRARY_BUILD
imgdata.lens.makernotes.CurAp = aperture;
#endif
}
if (type == 0x102a) {
// iso_speed = pow (2.0, (get4(),get2())/32.0 - 4) * 50;
iso_speed = libraw_powf64(2.0f, ((get2(),get2()) + get2())/32.0f - 5.0f) * 100.0f;
#ifdef LIBRAW_LIBRARY_BUILD
aperture = _CanonConvertAperture((get2(),get2()));
imgdata.lens.makernotes.CurAp = aperture;
#else
aperture = libraw_powf64(2.0, (get2(),(short)get2())/64.0);
#endif
shutter = libraw_powf64(2.0,-((short)get2())/32.0);
wbi = (get2(),get2());
if (wbi > 17) wbi = 0;
fseek (ifp, 32, SEEK_CUR);
if (shutter > 1e6) shutter = get2()/10.0;
}
if (type == 0x102c) {
if (get2() > 512) { /* Pro90, G1 */
fseek (ifp, 118, SEEK_CUR);
FORC4 cam_mul[c ^ 2] = get2();
} else { /* G2, S30, S40 */
fseek (ifp, 98, SEEK_CUR);
FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get2();
}
}
#ifdef LIBRAW_LIBRARY_BUILD
if (type == 0x10a9)
{
INT64 o = ftell(ifp);
fseek (ifp, (0x5<<1), SEEK_CUR);
Canon_WBpresets(0,0);
fseek(ifp,o,SEEK_SET);
}
if (type == 0x102d)
{
INT64 o = ftell(ifp);
Canon_CameraSettings();
fseek(ifp,o,SEEK_SET);
}
if (type == 0x580b)
{
if (strcmp(model,"Canon EOS D30")) sprintf(imgdata.shootinginfo.BodySerial, "%d", len);
else sprintf(imgdata.shootinginfo.BodySerial, "%0x-%05d", len>>16, len&0xffff);
}
#endif
if (type == 0x0032) {
if (len == 768) { /* EOS D30 */
fseek (ifp, 72, SEEK_CUR);
FORC4 cam_mul[c ^ (c >> 1)] = 1024.0 / get2();
if (!wbi) cam_mul[0] = -1; /* use my auto white balance */
} else if (!cam_mul[0]) {
if (get2() == key[0]) /* Pro1, G6, S60, S70 */
c = (strstr(model,"Pro1") ?
"012346000000000000":"01345:000000006008")[LIM(0,wbi,17)]-'0'+ 2;
else { /* G3, G5, S45, S50 */
c = "023457000000006000"[LIM(0,wbi,17)]-'0';
key[0] = key[1] = 0;
}
fseek (ifp, 78 + c*8, SEEK_CUR);
FORC4 cam_mul[c ^ (c >> 1) ^ 1] = get2() ^ key[c & 1];
if (!wbi) cam_mul[0] = -1;
}
}
if (type == 0x10a9) { /* D60, 10D, 300D, and clones */
if (len > 66) wbi = "0134567028"[LIM(0,wbi,9)]-'0';
fseek (ifp, 2 + wbi*8, SEEK_CUR);
FORC4 cam_mul[c ^ (c >> 1)] = get2();
}
if (type == 0x1030 && wbi>=0 && (0x18040 >> wbi & 1))
ciff_block_1030(); /* all that don't have 0x10a9 */
if (type == 0x1031) {
raw_width = (get2(),get2());
raw_height = get2();
}
if (type == 0x501c) {
iso_speed = len & 0xffff;
}
if (type == 0x5029) {
#ifdef LIBRAW_LIBRARY_BUILD
imgdata.lens.makernotes.CurFocal = len >> 16;
imgdata.lens.makernotes.FocalType = len & 0xffff;
if (imgdata.lens.makernotes.FocalType == 2) {
imgdata.lens.makernotes.CanonFocalUnits = 32;
if(imgdata.lens.makernotes.CanonFocalUnits>1)
imgdata.lens.makernotes.CurFocal /= (float)imgdata.lens.makernotes.CanonFocalUnits;
}
focal_len = imgdata.lens.makernotes.CurFocal;
#else
focal_len = len >> 16;
if ((len & 0xffff) == 2) focal_len /= 32;
#endif
}
if (type == 0x5813) flash_used = int_to_float(len);
if (type == 0x5814) canon_ev = int_to_float(len);
if (type == 0x5817) shot_order = len;
if (type == 0x5834)
{
unique_id = len;
#ifdef LIBRAW_LIBRARY_BUILD
setCanonBodyFeatures(unique_id);
#endif
}
if (type == 0x580e) timestamp = len;
if (type == 0x180e) timestamp = get4();
#ifdef LOCALTIME
if ((type | 0x4000) == 0x580e)
timestamp = mktime (gmtime (×tamp));
#endif
fseek (ifp, save, SEEK_SET);
}
}
| 0
|
36,873
|
static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
const struct xfrm_migrate *m, int num_bundles,
const struct xfrm_kmaddress *k)
{
int i;
int sasize_sel;
int size = 0;
int size_pol = 0;
struct sk_buff *skb;
struct sadb_msg *hdr;
struct sadb_x_policy *pol;
const struct xfrm_migrate *mp;
if (type != XFRM_POLICY_TYPE_MAIN)
return 0;
if (num_bundles <= 0 || num_bundles > XFRM_MAX_DEPTH)
return -EINVAL;
if (k != NULL) {
/* addresses for KM */
size += PFKEY_ALIGN8(sizeof(struct sadb_x_kmaddress) +
pfkey_sockaddr_pair_size(k->family));
}
/* selector */
sasize_sel = pfkey_sockaddr_size(sel->family);
if (!sasize_sel)
return -EINVAL;
size += (sizeof(struct sadb_address) + sasize_sel) * 2;
/* policy info */
size_pol += sizeof(struct sadb_x_policy);
/* ipsecrequests */
for (i = 0, mp = m; i < num_bundles; i++, mp++) {
/* old locator pair */
size_pol += sizeof(struct sadb_x_ipsecrequest) +
pfkey_sockaddr_pair_size(mp->old_family);
/* new locator pair */
size_pol += sizeof(struct sadb_x_ipsecrequest) +
pfkey_sockaddr_pair_size(mp->new_family);
}
size += sizeof(struct sadb_msg) + size_pol;
/* alloc buffer */
skb = alloc_skb(size, GFP_ATOMIC);
if (skb == NULL)
return -ENOMEM;
hdr = (struct sadb_msg *)skb_put(skb, sizeof(struct sadb_msg));
hdr->sadb_msg_version = PF_KEY_V2;
hdr->sadb_msg_type = SADB_X_MIGRATE;
hdr->sadb_msg_satype = pfkey_proto2satype(m->proto);
hdr->sadb_msg_len = size / 8;
hdr->sadb_msg_errno = 0;
hdr->sadb_msg_reserved = 0;
hdr->sadb_msg_seq = 0;
hdr->sadb_msg_pid = 0;
/* Addresses to be used by KM for negotiation, if ext is available */
if (k != NULL && (set_sadb_kmaddress(skb, k) < 0))
goto err;
/* selector src */
set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel);
/* selector dst */
set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_DST, sel);
/* policy information */
pol = (struct sadb_x_policy *)skb_put(skb, sizeof(struct sadb_x_policy));
pol->sadb_x_policy_len = size_pol / 8;
pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC;
pol->sadb_x_policy_dir = dir + 1;
pol->sadb_x_policy_id = 0;
pol->sadb_x_policy_priority = 0;
for (i = 0, mp = m; i < num_bundles; i++, mp++) {
/* old ipsecrequest */
int mode = pfkey_mode_from_xfrm(mp->mode);
if (mode < 0)
goto err;
if (set_ipsecrequest(skb, mp->proto, mode,
(mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
mp->reqid, mp->old_family,
&mp->old_saddr, &mp->old_daddr) < 0)
goto err;
/* new ipsecrequest */
if (set_ipsecrequest(skb, mp->proto, mode,
(mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
mp->reqid, mp->new_family,
&mp->new_saddr, &mp->new_daddr) < 0)
goto err;
}
/* broadcast migrate message to sockets */
pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, &init_net);
return 0;
err:
kfree_skb(skb);
return -EINVAL;
}
| 0
|
33,489
|
void test_checkout_nasty__dot_dotgit_tree(void)
{
test_checkout_fails("refs/heads/dot_dotgit_tree", ".git/foobar");
}
| 0
|
488,869
|
static gboolean avdtp_parse_resp(struct avdtp *session,
struct avdtp_stream *stream,
uint8_t transaction, uint8_t signal_id,
void *buf, int size)
{
struct pending_req *next;
const char *get_all = "";
if (session->prio_queue)
next = session->prio_queue->data;
else if (session->req_queue)
next = session->req_queue->data;
else
next = NULL;
switch (signal_id) {
case AVDTP_DISCOVER:
DBG("DISCOVER request succeeded");
return avdtp_discover_resp(session, buf, size);
case AVDTP_GET_ALL_CAPABILITIES:
get_all = "ALL_";
/* fall through */
case AVDTP_GET_CAPABILITIES:
DBG("GET_%sCAPABILITIES request succeeded", get_all);
if (!avdtp_get_capabilities_resp(session, buf, size))
return FALSE;
if (!(next && (next->signal_id == AVDTP_GET_CAPABILITIES ||
next->signal_id == AVDTP_GET_ALL_CAPABILITIES)))
finalize_discovery(session, 0);
return TRUE;
}
/* The remaining commands require an existing stream so bail out
* here if the stream got unexpectedly disconnected */
if (!stream) {
DBG("AVDTP: stream was closed while waiting for reply");
return TRUE;
}
switch (signal_id) {
case AVDTP_SET_CONFIGURATION:
DBG("SET_CONFIGURATION request succeeded");
return avdtp_set_configuration_resp(session, stream,
buf, size);
case AVDTP_RECONFIGURE:
DBG("RECONFIGURE request succeeded");
return avdtp_reconfigure_resp(session, stream, buf, size);
case AVDTP_OPEN:
DBG("OPEN request succeeded");
return avdtp_open_resp(session, stream, buf, size);
case AVDTP_SUSPEND:
DBG("SUSPEND request succeeded");
return avdtp_suspend_resp(session, stream, buf, size);
case AVDTP_START:
DBG("START request succeeded");
return avdtp_start_resp(session, stream, buf, size);
case AVDTP_CLOSE:
DBG("CLOSE request succeeded");
return avdtp_close_resp(session, stream, buf, size);
case AVDTP_ABORT:
DBG("ABORT request succeeded");
return avdtp_abort_resp(session, stream, buf, size);
case AVDTP_DELAY_REPORT:
DBG("DELAY_REPORT request succeeded");
return avdtp_delay_report_resp(session, stream, buf, size);
}
error("Unknown signal id in accept response: %u", signal_id);
return TRUE;
}
| 0
|
30,164
|
void bn_sqr_comba8 ( BN_ULONG * r , const BN_ULONG * a ) {
BN_ULONG c1 , c2 , c3 ;
c1 = 0 ;
c2 = 0 ;
c3 = 0 ;
sqr_add_c ( a , 0 , c1 , c2 , c3 ) ;
r [ 0 ] = c1 ;
c1 = 0 ;
sqr_add_c2 ( a , 1 , 0 , c2 , c3 , c1 ) ;
r [ 1 ] = c2 ;
c2 = 0 ;
sqr_add_c ( a , 1 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 2 , 0 , c3 , c1 , c2 ) ;
r [ 2 ] = c3 ;
c3 = 0 ;
sqr_add_c2 ( a , 3 , 0 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 2 , 1 , c1 , c2 , c3 ) ;
r [ 3 ] = c1 ;
c1 = 0 ;
sqr_add_c ( a , 2 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 3 , 1 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 4 , 0 , c2 , c3 , c1 ) ;
r [ 4 ] = c2 ;
c2 = 0 ;
sqr_add_c2 ( a , 5 , 0 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 4 , 1 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 3 , 2 , c3 , c1 , c2 ) ;
r [ 5 ] = c3 ;
c3 = 0 ;
sqr_add_c ( a , 3 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 4 , 2 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 5 , 1 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 6 , 0 , c1 , c2 , c3 ) ;
r [ 6 ] = c1 ;
c1 = 0 ;
sqr_add_c2 ( a , 7 , 0 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 6 , 1 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 5 , 2 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 4 , 3 , c2 , c3 , c1 ) ;
r [ 7 ] = c2 ;
c2 = 0 ;
sqr_add_c ( a , 4 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 5 , 3 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 6 , 2 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 7 , 1 , c3 , c1 , c2 ) ;
r [ 8 ] = c3 ;
c3 = 0 ;
sqr_add_c2 ( a , 7 , 2 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 6 , 3 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 5 , 4 , c1 , c2 , c3 ) ;
r [ 9 ] = c1 ;
c1 = 0 ;
sqr_add_c ( a , 5 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 6 , 4 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 7 , 3 , c2 , c3 , c1 ) ;
r [ 10 ] = c2 ;
c2 = 0 ;
sqr_add_c2 ( a , 7 , 4 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 6 , 5 , c3 , c1 , c2 ) ;
r [ 11 ] = c3 ;
c3 = 0 ;
sqr_add_c ( a , 6 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 7 , 5 , c1 , c2 , c3 ) ;
r [ 12 ] = c1 ;
c1 = 0 ;
sqr_add_c2 ( a , 7 , 6 , c2 , c3 , c1 ) ;
r [ 13 ] = c2 ;
c2 = 0 ;
sqr_add_c ( a , 7 , c3 , c1 , c2 ) ;
r [ 14 ] = c3 ;
r [ 15 ] = c1 ;
}
| 0
|
67,643
|
Type makeFrozenStructALike() {
Type structALike;
structALike.fieldA_ref() = 2000;
return structALike;
}
| 0
|
228,114
|
static void NPN_UnscheduleTimer(NPP instance, uint32_t timerID)
{
notImplemented();
}
| 0
|
220,657
|
CoreEnterLeaveEvent(DeviceIntPtr mouse,
int type,
int mode, int detail, WindowPtr pWin, Window child)
{
xEvent event = {
.u.u.type = type,
.u.u.detail = detail
};
WindowPtr focus;
DeviceIntPtr keybd;
GrabPtr grab = mouse->deviceGrab.grab;
Mask mask;
keybd = GetMaster(mouse, KEYBOARD_OR_FLOAT);
if ((pWin == mouse->valuator->motionHintWindow) &&
(detail != NotifyInferior))
mouse->valuator->motionHintWindow = NullWindow;
if (grab) {
mask = (pWin == grab->window) ? grab->eventMask : 0;
if (grab->ownerEvents)
mask |= EventMaskForClient(pWin, rClient(grab));
}
else {
mask = pWin->eventMask | wOtherEventMasks(pWin);
}
event.u.enterLeave.time = currentTime.milliseconds;
event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x;
event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y;
/* Counts on the same initial structure of crossing & button events! */
FixUpEventFromWindow(mouse->spriteInfo->sprite, &event, pWin, None, FALSE);
/* Enter/Leave events always set child */
event.u.enterLeave.child = child;
event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
ELFlagSameScreen : 0;
event.u.enterLeave.state =
mouse->button ? (mouse->button->state & 0x1f00) : 0;
if (keybd)
event.u.enterLeave.state |=
XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
event.u.enterLeave.mode = mode;
focus = (keybd) ? keybd->focus->win : None;
if ((focus != NoneWin) &&
((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin)))
event.u.enterLeave.flags |= ELFlagFocus;
if ((mask & GetEventFilter(mouse, &event))) {
if (grab)
TryClientEvents(rClient(grab), mouse, &event, 1, mask,
GetEventFilter(mouse, &event), grab);
else
DeliverEventsToWindow(mouse, pWin, &event, 1,
GetEventFilter(mouse, &event), NullGrab);
}
if ((type == EnterNotify) && (mask & KeymapStateMask)) {
xKeymapEvent ke = {
.type = KeymapNotify
};
ClientPtr client = grab ? rClient(grab) : wClient(pWin);
int rc;
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
if (rc == Success)
memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
if (grab)
TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1,
mask, KeymapStateMask, grab);
else
DeliverEventsToWindow(mouse, pWin, (xEvent *) &ke, 1,
KeymapStateMask, NullGrab);
}
}
| 0
|
75,810
|
void CServer::ConchainPlayerSlotsUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
{
pfnCallback(pResult, pCallbackUserData);
CServer *pSelf = (CServer *)pUserData;
if(pResult->NumArguments())
{
if(pSelf->Config()->m_SvMaxClients < pSelf->Config()->m_SvPlayerSlots)
pSelf->Config()->m_SvPlayerSlots = pSelf->Config()->m_SvMaxClients;
}
}
| 0
|
209,481
|
void FileAPIMessageFilter::OnAppendSharedMemory(
const GURL& url, base::SharedMemoryHandle handle, size_t buffer_size) {
DCHECK(base::SharedMemory::IsHandleValid(handle));
if (!buffer_size) {
BadMessageReceived();
return;
}
#if defined(OS_WIN)
base::SharedMemory shared_memory(handle, true, peer_handle());
#else
base::SharedMemory shared_memory(handle, true);
#endif
if (!shared_memory.Map(buffer_size)) {
OnRemoveBlob(url);
return;
}
BlobData::Item item;
item.SetToSharedBytes(static_cast<char*>(shared_memory.memory()),
buffer_size);
blob_storage_context_->controller()->AppendBlobDataItem(url, item);
}
| 0
|
222,548
|
static int __apic_accept_irq(struct kvm_vcpu *vcpu, uint64_t vector)
{
struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
if (!test_and_set_bit(vector, &vpd->irr[0])) {
vcpu->arch.irq_new_pending = 1;
kvm_vcpu_kick(vcpu);
return 1;
}
return 0;
}
| 0
|
37,267
|
static int64_t Unknown() { return -1; }
| 0
|
495,274
|
lexer_string_is_use_strict (parser_context_t *context_p) /**< context */
{
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL);
return (context_p->token.lit_location.length == 10
&& !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)
&& memcmp (context_p->token.lit_location.char_p, "use strict", 10) == 0);
} /* lexer_string_is_use_strict */
| 0
|
274,271
|
lookupGid(const string &groupName) {
struct group *groupEntry;
groupEntry = getgrnam(groupName.c_str());
if (groupEntry == NULL) {
if (looksLikePositiveNumber(groupName)) {
return atoi(groupName);
} else {
return (gid_t) -1;
}
} else {
return groupEntry->gr_gid;
}
}
| 0
|
16,549
|
IN_PROC_BROWSER_TEST_F ( ExtensionMessageBubbleViewBrowserTest , ExtensionBubbleAnchoredToAppMenu ) {
TestBubbleAnchoredToAppMenu ( ) ;
}
| 0
|
507,115
|
int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
unsigned int *siglen, DSA *dsa)
{
DSA_SIG *s;
#ifdef OPENSSL_FIPS
if(FIPS_mode() && !(dsa->flags & DSA_FLAG_NON_FIPS_ALLOW))
{
DSAerr(DSA_F_DSA_SIGN, DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE);
return 0;
}
#endif
RAND_seed(dgst, dlen);
s=DSA_do_sign(dgst,dlen,dsa);
if (s == NULL)
{
*siglen=0;
return(0);
}
*siglen=i2d_DSA_SIG(s,&sig);
DSA_SIG_free(s);
return(1);
}
| 0
|
447,472
|
smtp_set_error (CamelSmtpTransport *transport,
CamelStreamBuffer *istream,
const gchar *respbuf,
GCancellable *cancellable,
GError **error)
{
const gchar *token, *rbuf = respbuf;
gchar *buffer = NULL;
GString *string;
g_return_if_fail (respbuf != NULL);
string = g_string_new ("");
do {
if (transport->flags & CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES)
token = smtp_next_token (rbuf + 4);
else
token = rbuf + 4;
if (*token == '\0') {
g_free (buffer);
g_string_free (string, TRUE);
goto fake_status_code;
}
g_string_append (string, token);
if (*(rbuf + 3) == '-') {
g_free (buffer);
buffer = camel_stream_buffer_read_line (istream, cancellable, NULL);
d (fprintf (stderr, "[SMTP] received: %s\n", buffer ? buffer : "(null)"));
g_string_append_c (string, '\n');
} else {
g_free (buffer);
buffer = NULL;
}
rbuf = buffer;
} while (rbuf);
convert_to_local (string);
if (!(transport->flags & CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES) && string->len) {
string->str = g_strstrip (string->str);
string->len = strlen (string->str);
if (!string->len) {
g_string_free (string, TRUE);
goto fake_status_code;
}
g_set_error (
error, CAMEL_ERROR,
CAMEL_ERROR_GENERIC,
"%s", string->str);
g_string_free (string, TRUE);
} else {
buffer = smtp_decode_status_code (string->str, string->len);
g_string_free (string, TRUE);
if (!buffer)
goto fake_status_code;
g_set_error (
error, CAMEL_ERROR,
CAMEL_ERROR_GENERIC,
"%s", buffer);
g_free (buffer);
}
return;
fake_status_code:
g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
"%s", smtp_error_string (atoi (respbuf)));
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.