unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
127,209 | 0 | void CloseHandlesAndTerminateProcess(PROCESS_INFORMATION* process_information) {
if (process_information->hThread) {
CloseHandle(process_information->hThread);
process_information->hThread = NULL;
}
if (process_information->hProcess) {
TerminateProcess(process_information->hProcess, CONTROL_C_EXIT);
CloseHandle(process_information->hProcess);
process_information->hProcess = NULL;
}
}
| 7,700 |
122,975 | 0 | RenderWidgetHostView* RenderWidgetHostImpl::GetView() const {
return view_;
}
| 7,701 |
96,708 | 0 | WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info,
const int argc,const char **argv,ExceptionInfo *exception)
{
const char
*option;
GeometryInfo
geometry_info;
ssize_t
count;
register ssize_t
i;
/*
Initialize method variables.
*/
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
if (argc < 0)
return(MagickTrue);
/*
Set the image settings.
*/
for (i=0; i < (ssize_t) argc; i++)
{
option=argv[i];
if (IsCommandOption(option) == MagickFalse)
continue;
count=ParseCommandOption(MagickCommandOptions,MagickFalse,option);
count=MagickMax(count,0L);
if ((i+count) >= (ssize_t) argc)
break;
switch (*(option+1))
{
case 'a':
{
if (LocaleCompare("adjoin",option+1) == 0)
{
image_info->adjoin=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
if (LocaleCompare("antialias",option+1) == 0)
{
image_info->antialias=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
if (LocaleCompare("authenticate",option+1) == 0)
{
if (*option == '+')
(void) DeleteImageOption(image_info,option+1);
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'b':
{
if (LocaleCompare("background",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
(void) QueryColorCompliance(MogrifyBackgroundColor,
AllCompliance,&image_info->background_color,exception);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->background_color,exception);
break;
}
if (LocaleCompare("bias",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,"convolve:bias","0.0");
break;
}
(void) SetImageOption(image_info,"convolve:bias",argv[i+1]);
break;
}
if (LocaleCompare("black-point-compensation",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"false");
break;
}
(void) SetImageOption(image_info,option+1,"true");
break;
}
if (LocaleCompare("blue-primary",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0.0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("bordercolor",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
(void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
&image_info->border_color,exception);
break;
}
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->border_color,exception);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("box",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,"undercolor","none");
break;
}
(void) SetImageOption(image_info,"undercolor",argv[i+1]);
break;
}
break;
}
case 'c':
{
if (LocaleCompare("cache",option+1) == 0)
{
MagickSizeType
limit;
limit=MagickResourceInfinity;
if (LocaleCompare("unlimited",argv[i+1]) != 0)
limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+1],
100.0);
(void) SetMagickResourceLimit(MemoryResource,limit);
(void) SetMagickResourceLimit(MapResource,2*limit);
break;
}
if (LocaleCompare("caption",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("colorspace",option+1) == 0)
{
if (*option == '+')
{
image_info->colorspace=UndefinedColorspace;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->colorspace=(ColorspaceType) ParseCommandOption(
MagickColorspaceOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("comment",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("compose",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("compress",option+1) == 0)
{
if (*option == '+')
{
image_info->compression=UndefinedCompression;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->compression=(CompressionType) ParseCommandOption(
MagickCompressOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'd':
{
if (LocaleCompare("debug",option+1) == 0)
{
if (*option == '+')
(void) SetLogEventMask("none");
else
(void) SetLogEventMask(argv[i+1]);
image_info->debug=IsEventLogging();
break;
}
if (LocaleCompare("define",option+1) == 0)
{
if (*option == '+')
{
if (LocaleNCompare(argv[i+1],"registry:",9) == 0)
(void) DeleteImageRegistry(argv[i+1]+9);
else
(void) DeleteImageOption(image_info,argv[i+1]);
break;
}
if (LocaleNCompare(argv[i+1],"registry:",9) == 0)
{
(void) DefineImageRegistry(StringRegistryType,argv[i+1]+9,
exception);
break;
}
(void) DefineImageOption(image_info,argv[i+1]);
break;
}
if (LocaleCompare("delay",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("density",option+1) == 0)
{
/*
Set image density.
*/
if (*option == '+')
{
if (image_info->density != (char *) NULL)
image_info->density=DestroyString(image_info->density);
(void) SetImageOption(image_info,option+1,"72");
break;
}
(void) CloneString(&image_info->density,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("depth",option+1) == 0)
{
if (*option == '+')
{
image_info->depth=MAGICKCORE_QUANTUM_DEPTH;
break;
}
image_info->depth=StringToUnsignedLong(argv[i+1]);
break;
}
if (LocaleCompare("direction",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("display",option+1) == 0)
{
if (*option == '+')
{
if (image_info->server_name != (char *) NULL)
image_info->server_name=DestroyString(
image_info->server_name);
break;
}
(void) CloneString(&image_info->server_name,argv[i+1]);
break;
}
if (LocaleCompare("dispose",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("dither",option+1) == 0)
{
if (*option == '+')
{
image_info->dither=MagickFalse;
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
image_info->dither=MagickTrue;
break;
}
break;
}
case 'e':
{
if (LocaleCompare("encoding",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("endian",option+1) == 0)
{
if (*option == '+')
{
image_info->endian=UndefinedEndian;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->endian=(EndianType) ParseCommandOption(
MagickEndianOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("extract",option+1) == 0)
{
/*
Set image extract geometry.
*/
if (*option == '+')
{
if (image_info->extract != (char *) NULL)
image_info->extract=DestroyString(image_info->extract);
break;
}
(void) CloneString(&image_info->extract,argv[i+1]);
break;
}
break;
}
case 'f':
{
if (LocaleCompare("family",option+1) == 0)
{
if (*option != '+')
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("fill",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("filter",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("font",option+1) == 0)
{
if (*option == '+')
{
if (image_info->font != (char *) NULL)
image_info->font=DestroyString(image_info->font);
break;
}
(void) CloneString(&image_info->font,argv[i+1]);
break;
}
if (LocaleCompare("format",option+1) == 0)
{
register const char
*q;
for (q=strchr(argv[i+1],'%'); q != (char *) NULL; q=strchr(q+1,'%'))
if (strchr("Agkrz@[#",*(q+1)) != (char *) NULL)
image_info->ping=MagickFalse;
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("fuzz",option+1) == 0)
{
if (*option == '+')
{
image_info->fuzz=0.0;
(void) SetImageOption(image_info,option+1,"0");
break;
}
image_info->fuzz=StringToDoubleInterval(argv[i+1],(double)
QuantumRange+1.0);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'g':
{
if (LocaleCompare("gravity",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("green-primary",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0.0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'i':
{
if (LocaleCompare("intensity",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("intent",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interlace",option+1) == 0)
{
if (*option == '+')
{
image_info->interlace=UndefinedInterlace;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->interlace=(InterlaceType) ParseCommandOption(
MagickInterlaceOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interline-spacing",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interpolate",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interword-spacing",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'k':
{
if (LocaleCompare("kerning",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'l':
{
if (LocaleCompare("label",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("limit",option+1) == 0)
{
MagickSizeType
limit;
ResourceType
type;
if (*option == '+')
break;
type=(ResourceType) ParseCommandOption(MagickResourceOptions,
MagickFalse,argv[i+1]);
limit=MagickResourceInfinity;
if (LocaleCompare("unlimited",argv[i+2]) != 0)
limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+2],100.0);
(void) SetMagickResourceLimit(type,limit);
break;
}
if (LocaleCompare("list",option+1) == 0)
{
ssize_t
list;
/*
Display configuration list.
*/
list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i+1]);
switch (list)
{
case MagickCoderOptions:
{
(void) ListCoderInfo((FILE *) NULL,exception);
break;
}
case MagickColorOptions:
{
(void) ListColorInfo((FILE *) NULL,exception);
break;
}
case MagickConfigureOptions:
{
(void) ListConfigureInfo((FILE *) NULL,exception);
break;
}
case MagickDelegateOptions:
{
(void) ListDelegateInfo((FILE *) NULL,exception);
break;
}
case MagickFontOptions:
{
(void) ListTypeInfo((FILE *) NULL,exception);
break;
}
case MagickFormatOptions:
{
(void) ListMagickInfo((FILE *) NULL,exception);
break;
}
case MagickLocaleOptions:
{
(void) ListLocaleInfo((FILE *) NULL,exception);
break;
}
case MagickLogOptions:
{
(void) ListLogInfo((FILE *) NULL,exception);
break;
}
case MagickMagicOptions:
{
(void) ListMagicInfo((FILE *) NULL,exception);
break;
}
case MagickMimeOptions:
{
(void) ListMimeInfo((FILE *) NULL,exception);
break;
}
case MagickModuleOptions:
{
(void) ListModuleInfo((FILE *) NULL,exception);
break;
}
case MagickPolicyOptions:
{
(void) ListPolicyInfo((FILE *) NULL,exception);
break;
}
case MagickResourceOptions:
{
(void) ListMagickResourceInfo((FILE *) NULL,exception);
break;
}
case MagickThresholdOptions:
{
(void) ListThresholdMaps((FILE *) NULL,exception);
break;
}
default:
{
(void) ListCommandOptions((FILE *) NULL,(CommandOption) list,
exception);
break;
}
}
break;
}
if (LocaleCompare("log",option+1) == 0)
{
if (*option == '+')
break;
(void) SetLogFormat(argv[i+1]);
break;
}
if (LocaleCompare("loop",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'm':
{
if (LocaleCompare("matte",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"false");
break;
}
(void) SetImageOption(image_info,option+1,"true");
break;
}
if (LocaleCompare("mattecolor",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,argv[i+1]);
(void) QueryColorCompliance(MogrifyAlphaColor,AllCompliance,
&image_info->matte_color,exception);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->matte_color,exception);
break;
}
if (LocaleCompare("metric",option+1) == 0)
{
if (*option == '+')
(void) DeleteImageOption(image_info,option+1);
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("monitor",option+1) == 0)
{
(void) SetImageInfoProgressMonitor(image_info,MonitorProgress,
(void *) NULL);
break;
}
if (LocaleCompare("monochrome",option+1) == 0)
{
image_info->monochrome=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
break;
}
case 'o':
{
if (LocaleCompare("orient",option+1) == 0)
{
if (*option == '+')
{
image_info->orientation=UndefinedOrientation;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->orientation=(OrientationType) ParseCommandOption(
MagickOrientationOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
}
case 'p':
{
if (LocaleCompare("page",option+1) == 0)
{
char
*canonical_page,
page[MagickPathExtent];
const char
*image_option;
MagickStatusType
flags;
RectangleInfo
geometry;
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
(void) CloneString(&image_info->page,(char *) NULL);
break;
}
(void) memset(&geometry,0,sizeof(geometry));
image_option=GetImageOption(image_info,"page");
if (image_option != (const char *) NULL)
flags=ParseAbsoluteGeometry(image_option,&geometry);
canonical_page=GetPageGeometry(argv[i+1]);
flags=ParseAbsoluteGeometry(canonical_page,&geometry);
canonical_page=DestroyString(canonical_page);
(void) FormatLocaleString(page,MagickPathExtent,"%lux%lu",
(unsigned long) geometry.width,(unsigned long) geometry.height);
if (((flags & XValue) != 0) || ((flags & YValue) != 0))
(void) FormatLocaleString(page,MagickPathExtent,"%lux%lu%+ld%+ld",
(unsigned long) geometry.width,(unsigned long) geometry.height,
(long) geometry.x,(long) geometry.y);
(void) SetImageOption(image_info,option+1,page);
(void) CloneString(&image_info->page,page);
break;
}
if (LocaleCompare("ping",option+1) == 0)
{
image_info->ping=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
if (LocaleCompare("pointsize",option+1) == 0)
{
if (*option == '+')
geometry_info.rho=0.0;
else
(void) ParseGeometry(argv[i+1],&geometry_info);
image_info->pointsize=geometry_info.rho;
break;
}
if (LocaleCompare("precision",option+1) == 0)
{
(void) SetMagickPrecision(StringToInteger(argv[i+1]));
break;
}
break;
}
case 'q':
{
if (LocaleCompare("quality",option+1) == 0)
{
/*
Set image compression quality.
*/
if (*option == '+')
{
image_info->quality=UndefinedCompressionQuality;
(void) SetImageOption(image_info,option+1,"0");
break;
}
image_info->quality=StringToUnsignedLong(argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("quiet",option+1) == 0)
{
static WarningHandler
warning_handler = (WarningHandler) NULL;
if (*option == '+')
{
/*
Restore error or warning messages.
*/
warning_handler=SetWarningHandler(warning_handler);
break;
}
/*
Suppress error or warning messages.
*/
warning_handler=SetWarningHandler((WarningHandler) NULL);
break;
}
break;
}
case 'r':
{
if (LocaleCompare("red-primary",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0.0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 's':
{
if (LocaleCompare("sampling-factor",option+1) == 0)
{
/*
Set image sampling factor.
*/
if (*option == '+')
{
if (image_info->sampling_factor != (char *) NULL)
image_info->sampling_factor=DestroyString(
image_info->sampling_factor);
break;
}
(void) CloneString(&image_info->sampling_factor,argv[i+1]);
break;
}
if (LocaleCompare("scene",option+1) == 0)
{
/*
Set image scene.
*/
if (*option == '+')
{
image_info->scene=0;
(void) SetImageOption(image_info,option+1,"0");
break;
}
image_info->scene=StringToUnsignedLong(argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("seed",option+1) == 0)
{
unsigned long
seed;
if (*option == '+')
{
seed=(unsigned long) time((time_t *) NULL);
SetRandomSecretKey(seed);
break;
}
seed=StringToUnsignedLong(argv[i+1]);
SetRandomSecretKey(seed);
break;
}
if (LocaleCompare("size",option+1) == 0)
{
if (*option == '+')
{
if (image_info->size != (char *) NULL)
image_info->size=DestroyString(image_info->size);
break;
}
(void) CloneString(&image_info->size,argv[i+1]);
break;
}
if (LocaleCompare("stroke",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("strokewidth",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("style",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("synchronize",option+1) == 0)
{
if (*option == '+')
{
image_info->synchronize=MagickFalse;
break;
}
image_info->synchronize=MagickTrue;
break;
}
break;
}
case 't':
{
if (LocaleCompare("taint",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"false");
break;
}
(void) SetImageOption(image_info,option+1,"true");
break;
}
if (LocaleCompare("texture",option+1) == 0)
{
if (*option == '+')
{
if (image_info->texture != (char *) NULL)
image_info->texture=DestroyString(image_info->texture);
break;
}
(void) CloneString(&image_info->texture,argv[i+1]);
break;
}
if (LocaleCompare("tile-offset",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("transparent-color",option+1) == 0)
{
if (*option == '+')
{
(void) QueryColorCompliance("none",AllCompliance,
&image_info->transparent_color,exception);
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->transparent_color,exception);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("type",option+1) == 0)
{
if (*option == '+')
{
image_info->type=UndefinedType;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->type=(ImageType) ParseCommandOption(MagickTypeOptions,
MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'u':
{
if (LocaleCompare("undercolor",option+1) == 0)
{
if (*option == '+')
(void) DeleteImageOption(image_info,option+1);
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("units",option+1) == 0)
{
if (*option == '+')
{
image_info->units=UndefinedResolution;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->units=(ResolutionType) ParseCommandOption(
MagickResolutionOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'v':
{
if (LocaleCompare("verbose",option+1) == 0)
{
if (*option == '+')
{
image_info->verbose=MagickFalse;
break;
}
image_info->verbose=MagickTrue;
image_info->ping=MagickFalse;
break;
}
if (LocaleCompare("virtual-pixel",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"undefined");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'w':
{
if (LocaleCompare("weight",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("white-point",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0.0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
default:
break;
}
i+=count;
}
return(MagickTrue);
}
| 7,702 |
125,001 | 0 | LayoutUnit RenderFlexibleBox::crossAxisExtentForChild(RenderBox* child) const
{
return isHorizontalFlow() ? child->height() : child->width();
}
| 7,703 |
188,444 | 1 | long Chapters::Atom::ParseDisplay(
IMkvReader* pReader,
long long pos,
long long size)
{
if (!ExpandDisplaysArray())
return -1;
Display& d = m_displays[m_displays_count++];
d.Init();
return d.Parse(pReader, pos, size);
}
| 7,704 |
143,662 | 0 | void RenderWidgetHostImpl::OnHasTouchEventHandlers(bool has_handlers) {
has_touch_handler_ = has_handlers;
}
| 7,705 |
9,958 | 0 | void PSIR_FileWriter::DeleteExistingInfo()
{
XMP_Assert ( ! (this->memParsed && this->fileParsed) );
if ( this->memParsed ) {
if ( this->ownedContent ) free ( this->memContent );
} else if ( this->fileParsed ) {
InternalRsrcMap::iterator irPos = this->imgRsrcs.begin();
InternalRsrcMap::iterator irEnd = this->imgRsrcs.end();
for ( ; irPos != irEnd; ++irPos ) irPos->second.changed = true; // Fool the InternalRsrcInfo destructor.
}
this->imgRsrcs.clear();
this->memContent = 0;
this->memLength = 0;
this->changed = false;
this->legacyDeleted = false;
this->memParsed = false;
this->fileParsed = false;
this->ownedContent = false;
} // PSIR_FileWriter::DeleteExistingInfo
| 7,706 |
96,180 | 0 | MagickExport void SetQuantumScale(QuantumInfo *quantum_info,const double scale)
{
assert(quantum_info != (QuantumInfo *) NULL);
assert(quantum_info->signature == MagickSignature);
quantum_info->scale=scale;
}
| 7,707 |
65,578 | 0 | static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open,
struct nfs4_delegation *dp)
{
if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG &&
dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
} else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
}
/* Otherwise the client must be confused wanting a delegation
* it already has, therefore we don't return
* NFS4_OPEN_DELEGATE_NONE_EXT and reason.
*/
}
| 7,708 |
94,151 | 0 | static int tcm_loop_queuecommand(
struct Scsi_Host *sh,
struct scsi_cmnd *sc)
{
struct se_cmd *se_cmd;
struct se_portal_group *se_tpg;
struct tcm_loop_hba *tl_hba;
struct tcm_loop_tpg *tl_tpg;
TL_CDB_DEBUG("tcm_loop_queuecommand() %d:%d:%d:%d got CDB: 0x%02x"
" scsi_buf_len: %u\n", sc->device->host->host_no,
sc->device->id, sc->device->channel, sc->device->lun,
sc->cmnd[0], scsi_bufflen(sc));
/*
* Locate the tcm_loop_hba_t pointer
*/
tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id];
se_tpg = &tl_tpg->tl_se_tpg;
/*
* Determine the SAM Task Attribute and allocate tl_cmd and
* tl_cmd->tl_se_cmd from TCM infrastructure
*/
se_cmd = tcm_loop_allocate_core_cmd(tl_hba, se_tpg, sc);
if (!se_cmd) {
sc->scsi_done(sc);
return 0;
}
/*
* Queue up the newly allocated to be processed in TCM thread context.
*/
transport_generic_handle_cdb_map(se_cmd);
return 0;
}
| 7,709 |
178,201 | 1 | _ksba_name_new_from_der (ksba_name_t *r_name,
const unsigned char *image, size_t imagelen)
{
gpg_error_t err;
ksba_name_t name;
struct tag_info ti;
const unsigned char *der;
size_t derlen;
int n;
char *p;
if (!r_name || !image)
return gpg_error (GPG_ERR_INV_VALUE);
*r_name = NULL;
/* count and check for encoding errors - we won;t do this again
during the second pass */
der = image;
derlen = imagelen;
n = 0;
while (derlen)
{
err = _ksba_ber_parse_tl (&der, &derlen, &ti);
if (err)
return err;
if (ti.class != CLASS_CONTEXT)
return gpg_error (GPG_ERR_INV_CERT_OBJ); /* we expected a tag */
if (ti.ndef)
return gpg_error (GPG_ERR_NOT_DER_ENCODED);
if (derlen < ti.length)
return gpg_error (GPG_ERR_BAD_BER);
switch (ti.tag)
{
case 1: /* rfc822Name - this is an imlicit IA5_STRING */
case 4: /* Name */
case 6: /* URI */
n++;
break;
default:
break;
}
/* advance pointer */
der += ti.length;
derlen -= ti.length;
}
/* allocate array and set all slots to NULL for easier error recovery */
err = ksba_name_new (&name);
if (err)
return err;
if (!n)
return 0; /* empty GeneralNames */
name->names = xtrycalloc (n, sizeof *name->names);
if (!name->names)
{
ksba_name_release (name);
return gpg_error (GPG_ERR_ENOMEM);
}
name->n_names = n;
/* start the second pass */
der = image;
derlen = imagelen;
n = 0;
while (derlen)
{
char numbuf[21];
err = _ksba_ber_parse_tl (&der, &derlen, &ti);
assert (!err);
switch (ti.tag)
{
case 1: /* rfc822Name - this is an imlicit IA5_STRING */
p = name->names[n] = xtrymalloc (ti.length+3);
if (!p)
{
ksba_name_release (name);
return gpg_error (GPG_ERR_ENOMEM);
}
*p++ = '<';
memcpy (p, der, ti.length);
p += ti.length;
*p++ = '>';
*p = 0;
n++;
break;
case 4: /* Name */
err = _ksba_derdn_to_str (der, ti.length, &p);
if (err)
return err; /* FIXME: we need to release some of the memory */
name->names[n++] = p;
break;
case 6: /* URI */
sprintf (numbuf, "%u:", (unsigned int)ti.length);
p = name->names[n] = xtrymalloc (1+5+strlen (numbuf)
+ ti.length +1+1);
if (!p)
{
ksba_name_release (name);
return gpg_error (GPG_ERR_ENOMEM);
}
p = stpcpy (p, "(3:uri");
p = stpcpy (p, numbuf);
memcpy (p, der, ti.length);
p += ti.length;
*p++ = ')';
*p = 0; /* extra safeguard null */
n++;
break;
default:
break;
}
/* advance pointer */
der += ti.length;
derlen -= ti.length;
}
*r_name = name;
return 0;
}
| 7,710 |
118,750 | 0 | LayoutRect ContainerNode::boundingBox() const
{
FloatPoint upperLeft, lowerRight;
bool foundUpperLeft = getUpperLeftCorner(upperLeft);
bool foundLowerRight = getLowerRightCorner(lowerRight);
if (foundUpperLeft != foundLowerRight) {
if (foundUpperLeft)
lowerRight = upperLeft;
else
upperLeft = lowerRight;
}
return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
}
| 7,711 |
105,541 | 0 | bool SendGetCookiesJSONRequest(
AutomationMessageSender* sender,
const std::string& url,
ListValue** cookies,
std::string* error_msg) {
DictionaryValue dict;
dict.SetString("command", "GetCookies");
dict.SetString("url", url);
DictionaryValue reply_dict;
if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
return false;
Value* cookies_unscoped_value;
if (!reply_dict.Remove("cookies", &cookies_unscoped_value))
return false;
scoped_ptr<Value> cookies_value(cookies_unscoped_value);
if (!cookies_value->IsType(Value::TYPE_LIST))
return false;
*cookies = static_cast<ListValue*>(cookies_value.release());
return true;
}
| 7,712 |
148,888 | 0 | RenderFrameHostManager::GetSiteInstanceForNavigation(
const GURL& dest_url,
SiteInstance* source_instance,
SiteInstance* dest_instance,
SiteInstance* candidate_instance,
ui::PageTransition transition,
bool dest_is_restore,
bool dest_is_view_source_mode,
bool was_server_redirect) {
DCHECK(!source_instance || !dest_instance);
SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
if (current_instance->GetSiteURL().SchemeIs(kGuestScheme))
return current_instance;
const NavigationEntry* current_entry =
delegate_->GetLastCommittedNavigationEntryForRenderManager();
BrowserContext* browser_context =
delegate_->GetControllerForRenderManager().GetBrowserContext();
const GURL& current_effective_url = current_entry ?
SiteInstanceImpl::GetEffectiveURL(browser_context,
current_entry->GetURL()) :
render_frame_host_->GetSiteInstance()->GetSiteURL();
bool current_is_view_source_mode = current_entry ?
current_entry->IsViewSourceMode() : dest_is_view_source_mode;
bool force_swap = ShouldSwapBrowsingInstancesForNavigation(
current_effective_url,
current_is_view_source_mode,
dest_instance,
SiteInstanceImpl::GetEffectiveURL(browser_context, dest_url),
dest_is_view_source_mode);
SiteInstanceDescriptor new_instance_descriptor =
SiteInstanceDescriptor(current_instance);
if (ShouldTransitionCrossSite() || force_swap) {
new_instance_descriptor = DetermineSiteInstanceForURL(
dest_url, source_instance, current_instance, dest_instance, transition,
dest_is_restore, dest_is_view_source_mode, force_swap,
was_server_redirect);
}
scoped_refptr<SiteInstance> new_instance =
ConvertToSiteInstance(new_instance_descriptor, candidate_instance);
if (force_swap)
CHECK_NE(new_instance, current_instance);
DCHECK_EQ(new_instance->GetBrowserContext(), browser_context);
SiteInstanceImpl* new_instance_impl =
static_cast<SiteInstanceImpl*>(new_instance.get());
auto* policy = ChildProcessSecurityPolicyImpl::GetInstance();
if (!frame_tree_node_->IsMainFrame() && !new_instance_impl->HasProcess() &&
new_instance_impl->HasSite() &&
policy->IsIsolatedOrigin(url::Origin(new_instance_impl->GetSiteURL()))) {
new_instance_impl->set_process_reuse_policy(
SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE);
}
return new_instance;
}
| 7,713 |
174,260 | 0 | void Camera3Device::sNotify(const camera3_callback_ops *cb,
const camera3_notify_msg *msg) {
Camera3Device *d =
const_cast<Camera3Device*>(static_cast<const Camera3Device*>(cb));
d->notify(msg);
}
| 7,714 |
156,759 | 0 | void RemoteFrame::CheckCompleted() {
Client()->CheckCompleted();
}
| 7,715 |
127,410 | 0 | PassRefPtr<RenderStyle> StyleResolver::styleForDocument(Document& document, CSSFontSelector* fontSelector)
{
const Frame* frame = document.frame();
RefPtr<RenderStyle> documentStyle = RenderStyle::create();
bool seamlessWithParent = document.shouldDisplaySeamlesslyWithParent();
if (seamlessWithParent) {
RenderStyle* iframeStyle = document.seamlessParentIFrame()->renderStyle();
if (iframeStyle)
documentStyle->inheritFrom(iframeStyle);
}
documentStyle->setDisplay(BLOCK);
if (!seamlessWithParent) {
documentStyle->setRTLOrdering(document.visuallyOrdered() ? VisualOrder : LogicalOrder);
documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor() : 1);
documentStyle->setLocale(document.contentLanguage());
}
documentStyle->setUserModify(document.inDesignMode() ? READ_WRITE : READ_ONLY);
document.setStyleDependentState(documentStyle.get());
return documentStyle.release();
}
| 7,716 |
42,631 | 0 | static void svm_fpu_activate(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
clr_exception_intercept(svm, NM_VECTOR);
svm->vcpu.fpu_active = 1;
update_cr0_intercept(svm);
}
| 7,717 |
147,134 | 0 | const AtomicString& DocumentLoader::ResponseMIMEType() const {
return response_.MimeType();
}
| 7,718 |
49,463 | 0 | sched_write(struct file *file, const char __user *buf,
size_t count, loff_t *offset)
{
struct inode *inode = file_inode(file);
struct task_struct *p;
p = get_proc_task(inode);
if (!p)
return -ESRCH;
proc_sched_set_task(p);
put_task_struct(p);
return count;
}
| 7,719 |
127,917 | 0 | void DocumentThreadableLoader::responseReceived(Resource* resource, const ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle)
{
ASSERT_UNUSED(resource, resource == this->resource());
ASSERT(m_async);
if (handle)
m_isUsingDataConsumerHandle = true;
handleResponse(resource->identifier(), response, std::move(handle));
}
| 7,720 |
11,782 | 0 | lvm2_lv_create_has_lv (CreateLvm2LVData *data)
{
GList *devices;
Device *ret;
GList *l;
ret = NULL;
devices = daemon_local_get_all_devices (data->daemon);
for (l = devices; l != NULL; l = l->next)
{
Device *d = DEVICE (l->data);
if (d->priv->device_is_linux_lvm2_lv &&
g_strcmp0 (d->priv->linux_lvm2_lv_group_uuid, data->vg_uuid) == 0 &&
g_strcmp0 (d->priv->linux_lvm2_lv_name, data->lv_name) == 0)
{
GList *m;
const gchar *lv_uuid;
lv_uuid = d->priv->linux_lvm2_lv_uuid;
/* OK, we've found the LV... now check that one of more PVs actually reference this LV */
for (m = devices; m != NULL; m = m->next)
{
Device *pv = DEVICE (m->data);
if (pv->priv->device_is_linux_lvm2_pv &&
g_strcmp0 (pv->priv->linux_lvm2_pv_group_uuid, data->vg_uuid) == 0)
{
guint n;
for (n = 0; n < pv->priv->linux_lvm2_pv_group_logical_volumes->len; n++)
{
const gchar *str = pv->priv->linux_lvm2_pv_group_logical_volumes->pdata[n];
if (str_has_lv_uuid (str, lv_uuid))
{
/* Return the LV, not the PV */
ret = d;
break;
}
}
}
} /* for all PVs */
break;
} /* if (found LV) */
}
return ret;
}
| 7,721 |
56,261 | 0 | SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
{
int read_bytes;
int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %ld bytes exceeds the limit of %ld bytes",
SG(request_info).content_length, SG(post_max_size));
return;
}
SG(request_info).post_data = emalloc(allocated_bytes);
for (;;) {
read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE TSRMLS_CC);
if (read_bytes<=0) {
break;
}
SG(read_post_bytes) += read_bytes;
if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds %ld bytes", SG(post_max_size));
break;
}
if (read_bytes < SAPI_POST_BLOCK_SIZE) {
break;
}
if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1;
SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes);
}
}
SG(request_info).post_data[SG(read_post_bytes)] = 0; /* terminating NULL */
SG(request_info).post_data_length = SG(read_post_bytes);
}
| 7,722 |
125,391 | 0 | void GDataFileSystem::OnCloseFileFinished(
const FilePath& file_path,
const FileOperationCallback& callback,
GDataFileError result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
open_files_.erase(file_path);
if (!callback.is_null())
callback.Run(result);
}
| 7,723 |
113,667 | 0 | xsltFreeCompMatch(xsltCompMatchPtr comp) {
xsltStepOpPtr op;
int i;
if (comp == NULL)
return;
if (comp->pattern != NULL)
xmlFree((xmlChar *)comp->pattern);
if (comp->nsList != NULL)
xmlFree(comp->nsList);
for (i = 0;i < comp->nbStep;i++) {
op = &comp->steps[i];
if (op->value != NULL)
xmlFree(op->value);
if (op->value2 != NULL)
xmlFree(op->value2);
if (op->value3 != NULL)
xmlFree(op->value3);
if (op->comp != NULL)
xmlXPathFreeCompExpr(op->comp);
}
xmlFree(comp->steps);
memset(comp, -1, sizeof(xsltCompMatch));
xmlFree(comp);
}
| 7,724 |
158,631 | 0 | void FrameFetchContext::ProvideDocumentToContext(FetchContext& context,
Document* document) {
DCHECK(document);
CHECK(context.IsFrameFetchContext());
static_cast<FrameFetchContext&>(context).document_ = document;
static_cast<FrameFetchContext&>(context).fetch_client_settings_object_ =
new FetchClientSettingsObjectImpl(*document);
}
| 7,725 |
43,664 | 0 | static int lookup_fast(struct nameidata *nd,
struct path *path, struct inode **inode,
unsigned *seqp)
{
struct vfsmount *mnt = nd->path.mnt;
struct dentry *dentry, *parent = nd->path.dentry;
int need_reval = 1;
int status = 1;
int err;
/*
* Rename seqlock is not required here because in the off chance
* of a false negative due to a concurrent rename, we're going to
* do the non-racy lookup, below.
*/
if (nd->flags & LOOKUP_RCU) {
unsigned seq;
bool negative;
dentry = __d_lookup_rcu(parent, &nd->last, &seq);
if (!dentry)
goto unlazy;
/*
* This sequence count validates that the inode matches
* the dentry name information from lookup.
*/
*inode = d_backing_inode(dentry);
negative = d_is_negative(dentry);
if (read_seqcount_retry(&dentry->d_seq, seq))
return -ECHILD;
if (negative)
return -ENOENT;
/*
* This sequence count validates that the parent had no
* changes while we did the lookup of the dentry above.
*
* The memory barrier in read_seqcount_begin of child is
* enough, we can use __read_seqcount_retry here.
*/
if (__read_seqcount_retry(&parent->d_seq, nd->seq))
return -ECHILD;
*seqp = seq;
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) {
status = d_revalidate(dentry, nd->flags);
if (unlikely(status <= 0)) {
if (status != -ECHILD)
need_reval = 0;
goto unlazy;
}
}
path->mnt = mnt;
path->dentry = dentry;
if (likely(__follow_mount_rcu(nd, path, inode, seqp)))
return 0;
unlazy:
if (unlazy_walk(nd, dentry, seq))
return -ECHILD;
} else {
dentry = __d_lookup(parent, &nd->last);
}
if (unlikely(!dentry))
goto need_lookup;
if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval)
status = d_revalidate(dentry, nd->flags);
if (unlikely(status <= 0)) {
if (status < 0) {
dput(dentry);
return status;
}
d_invalidate(dentry);
dput(dentry);
goto need_lookup;
}
if (unlikely(d_is_negative(dentry))) {
dput(dentry);
return -ENOENT;
}
path->mnt = mnt;
path->dentry = dentry;
err = follow_managed(path, nd);
if (likely(!err))
*inode = d_backing_inode(path->dentry);
return err;
need_lookup:
return 1;
}
| 7,726 |
56,366 | 0 | void reclaim_file(DOS_FS * fs)
{
DOS_FILE orphan;
int reclaimed, files;
int changed = 0;
uint32_t i, next, walk;
uint32_t *num_refs = NULL; /* Only for orphaned clusters */
uint32_t total_num_clusters;
if (verbose)
printf("Reclaiming unconnected clusters.\n");
total_num_clusters = fs->clusters + 2UL;
num_refs = alloc(total_num_clusters * sizeof(uint32_t));
memset(num_refs, 0, (total_num_clusters * sizeof(uint32_t)));
/* Guarantee that all orphan chains (except cycles) end cleanly
* with an end-of-chain mark.
*/
for (i = 2; i < total_num_clusters; i++) {
FAT_ENTRY curEntry;
get_fat(&curEntry, fs->fat, i, fs);
next = curEntry.value;
if (!get_owner(fs, i) && next && next < fs->clusters + 2) {
/* Cluster is linked, but not owned (orphan) */
FAT_ENTRY nextEntry;
get_fat(&nextEntry, fs->fat, next, fs);
/* Mark it end-of-chain if it links into an owned cluster,
* a free cluster, or a bad cluster.
*/
if (get_owner(fs, next) || !nextEntry.value ||
FAT_IS_BAD(fs, nextEntry.value))
set_fat(fs, i, -1);
else
num_refs[next]++;
}
}
/* Scan until all the orphans are accounted for,
* and all cycles and cross-links are broken
*/
do {
tag_free(fs, &orphan, num_refs, changed);
changed = 0;
/* Any unaccounted-for orphans must be part of a cycle */
for (i = 2; i < total_num_clusters; i++) {
FAT_ENTRY curEntry;
get_fat(&curEntry, fs->fat, i, fs);
if (curEntry.value && !FAT_IS_BAD(fs, curEntry.value) &&
!get_owner(fs, i)) {
if (!num_refs[curEntry.value]--)
die("Internal error: num_refs going below zero");
set_fat(fs, i, -1);
changed = curEntry.value;
printf("Broke cycle at cluster %lu in free chain.\n", (unsigned long)i);
/* If we've created a new chain head,
* tag_free() can claim it
*/
if (num_refs[curEntry.value] == 0)
break;
}
}
}
while (changed);
/* Now we can start recovery */
files = reclaimed = 0;
for (i = 2; i < total_num_clusters; i++)
/* If this cluster is the head of an orphan chain... */
if (get_owner(fs, i) == &orphan && !num_refs[i]) {
DIR_ENT de;
loff_t offset;
files++;
offset = alloc_rootdir_entry(fs, &de, "FSCK%04dREC");
de.start = htole16(i & 0xffff);
if (fs->fat_bits == 32)
de.starthi = htole16(i >> 16);
for (walk = i; walk > 0 && walk != -1;
walk = next_cluster(fs, walk)) {
de.size = htole32(le32toh(de.size) + fs->cluster_size);
reclaimed++;
}
fs_write(offset, sizeof(DIR_ENT), &de);
}
if (reclaimed)
printf("Reclaimed %d unused cluster%s (%llu bytes) in %d chain%s.\n",
reclaimed, reclaimed == 1 ? "" : "s",
(unsigned long long)reclaimed * fs->cluster_size, files,
files == 1 ? "" : "s");
free(num_refs);
}
| 7,727 |
113,852 | 0 | AudioManagerBase::~AudioManagerBase() {
CHECK(!audio_thread_.get());
DCHECK_EQ(0, num_output_streams_);
DCHECK_EQ(0, num_input_streams_);
}
| 7,728 |
182,346 | 1 | static int handle_vmptrst(struct kvm_vcpu *vcpu)
{
unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
gva_t vmcs_gva;
struct x86_exception e;
if (!nested_vmx_check_permission(vcpu))
return 1;
if (get_vmx_mem_address(vcpu, exit_qualification,
vmx_instruction_info, true, &vmcs_gva))
return 1;
/* ok to use *_system, as hardware has verified cpl=0 *
if (kvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, vmcs_gva,
(void *)&to_vmx(vcpu)->nested.current_vmptr,
sizeof(u64), &e)) {
kvm_inject_page_fault(vcpu, &e);
return 1;
}
nested_vmx_succeed(vcpu);
return kvm_skip_emulated_instruction(vcpu);
}
| 7,729 |
57,435 | 0 | unsigned int ext4_ext_check_overlap(struct inode *inode,
struct ext4_extent *newext,
struct ext4_ext_path *path)
{
ext4_lblk_t b1, b2;
unsigned int depth, len1;
unsigned int ret = 0;
b1 = le32_to_cpu(newext->ee_block);
len1 = ext4_ext_get_actual_len(newext);
depth = ext_depth(inode);
if (!path[depth].p_ext)
goto out;
b2 = le32_to_cpu(path[depth].p_ext->ee_block);
/*
* get the next allocated block if the extent in the path
* is before the requested block(s)
*/
if (b2 < b1) {
b2 = ext4_ext_next_allocated_block(path);
if (b2 == EXT_MAX_BLOCK)
goto out;
}
/* check for wrap through zero on extent logical start block*/
if (b1 + len1 < b1) {
len1 = EXT_MAX_BLOCK - b1;
newext->ee_len = cpu_to_le16(len1);
ret = 1;
}
/* check for overlap */
if (b1 + len1 > b2) {
newext->ee_len = cpu_to_le16(b2 - b1);
ret = 1;
}
out:
return ret;
}
| 7,730 |
162,693 | 0 | void BaseRenderingContext2D::InflateStrokeRect(FloatRect& rect) const {
static const double kRoot2 = sqrtf(2);
double delta = GetState().LineWidth() / 2;
if (GetState().GetLineJoin() == kMiterJoin)
delta *= GetState().MiterLimit();
else if (GetState().GetLineCap() == kSquareCap)
delta *= kRoot2;
rect.Inflate(delta);
}
| 7,731 |
76,324 | 0 | xfs_attr_refillstate(xfs_da_state_t *state)
{
xfs_da_state_path_t *path;
xfs_da_state_blk_t *blk;
int level, error;
trace_xfs_attr_refillstate(state->args);
/*
* Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path".
*/
path = &state->path;
ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
if (blk->disk_blkno) {
error = xfs_da3_node_read(state->args->trans,
state->args->dp,
blk->blkno, blk->disk_blkno,
&blk->bp, XFS_ATTR_FORK);
if (error)
return error;
} else {
blk->bp = NULL;
}
}
/*
* Roll down the "altpath" in the state structure, storing the on-disk
* block number for those buffers in the "altpath".
*/
path = &state->altpath;
ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
if (blk->disk_blkno) {
error = xfs_da3_node_read(state->args->trans,
state->args->dp,
blk->blkno, blk->disk_blkno,
&blk->bp, XFS_ATTR_FORK);
if (error)
return error;
} else {
blk->bp = NULL;
}
}
return 0;
}
| 7,732 |
140,293 | 0 | void Editor::applyStyleToSelection(StylePropertySet* style,
InputEvent::InputType inputType) {
if (!style || style->isEmpty() || !canEditRichly())
return;
applyStyle(style, inputType);
}
| 7,733 |
136,085 | 0 | views::View* WebsiteSettingsPopupView::CreatePermissionsTab() {
views::View* pane = new views::View();
pane->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 1));
cookie_dialog_link_ = new views::Link(
l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_SHOW_SITE_DATA));
cookie_dialog_link_->set_listener(this);
site_data_content_ = new views::View();
views::View* site_data_section =
CreateSection(l10n_util::GetStringUTF16(
IDS_WEBSITE_SETTINGS_TITLE_SITE_DATA),
site_data_content_,
cookie_dialog_link_);
pane->AddChildView(site_data_section);
return pane;
}
| 7,734 |
93,489 | 0 | static int l_read_publickey (lua_State *L) {
FILE *fd;
char c;
const char* publickeyfile = luaL_checkstring(L, 1);
luaL_Buffer publickey_data;
fd = fopen(publickeyfile, "r");
if (!fd)
return luaL_error(L, "Error reading file");
luaL_buffinit(L, &publickey_data);
while (fread(&c, 1, 1, fd) && c!= '\r' && c != '\n' && c != ' ') {
continue;
}
while (fread(&c, 1, 1, fd) && c!= '\r' && c != '\n' && c != ' ') {
luaL_addchar(&publickey_data, c);
}
fclose(fd);
lua_getglobal(L, "require");
lua_pushstring(L, "base64");
lua_call(L, 1, 1);
lua_getfield(L, -1, "dec");
luaL_pushresult(&publickey_data);
lua_call(L, 1, 1);
return 1;
}
| 7,735 |
185,591 | 1 | void SynchronousCompositorImpl::PostInvalidate() {
DCHECK(CalledOnValidThread());
DCHECK(compositor_client_);
compositor_client_->PostInvalidate();
}
| 7,736 |
1,376 | 0 | static void rpc_lookup_req(int prog, int ver)
{
uint32_t data[16];
data[0] = 0; data[1] = 0; /* auth credential */
data[2] = 0; data[3] = 0; /* auth verifier */
data[4] = htonl(prog);
data[5] = htonl(ver);
data[6] = htonl(17); /* IP_UDP */
data[7] = 0;
rpc_req(PROG_PORTMAP, PORTMAP_GETPORT, data, 8);
}
| 7,737 |
94,273 | 0 | static enum test_return test_binary_quitq(void) {
return test_binary_quit_impl(PROTOCOL_BINARY_CMD_QUITQ);
}
| 7,738 |
111,682 | 0 | void EditorClientBlackBerry::checkSpellingOfString(const UChar* text, int textLength, int* misspellLocation, int* misspellLength)
{
notImplemented();
}
| 7,739 |
136,476 | 0 | cc::EffectTree& PropertyTreeManager::GetEffectTree() {
return property_trees_.effect_tree;
}
| 7,740 |
161,484 | 0 | Response TargetHandler::SetAttachToFrames(bool value) {
auto_attacher_.SetAttachToFrames(value);
if (!auto_attacher_.ShouldThrottleFramesNavigation())
ClearThrottles();
return Response::OK();
}
| 7,741 |
139,133 | 0 | void RenderProcessHostImpl::CreateSharedRendererHistogramAllocator() {
if (!base::GlobalHistogramAllocator::Get())
return;
base::ProcessHandle destination = GetHandle();
if (destination == base::kNullProcessHandle)
return;
if (!metrics_allocator_) {
std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory());
if (!shm->CreateAndMapAnonymous(2 << 20)) // 2 MiB
return;
metrics_allocator_.reset(new base::SharedPersistentMemoryAllocator(
std::move(shm), GetID(), "RendererMetrics", /*readonly=*/false));
}
base::SharedMemoryHandle shm_handle;
metrics_allocator_->shared_memory()->ShareToProcess(destination, &shm_handle);
Send(new ChildProcessMsg_SetHistogramMemory(
shm_handle, metrics_allocator_->shared_memory()->mapped_size()));
}
| 7,742 |
131,175 | 0 | static void activityLoggingAccessPerWorldBindingsLongAttributeAttributeSetterForMainWorld(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
ExceptionState exceptionState(ExceptionState::SetterContext, "activityLoggingAccessPerWorldBindingsLongAttribute", "TestObjectPython", info.Holder(), info.GetIsolate());
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState);
imp->setActivityLoggingAccessPerWorldBindingsLongAttribute(cppValue);
}
| 7,743 |
109,328 | 0 | void InspectorPageAgent::setScriptExecutionDisabled(ErrorString*, bool value)
{
m_state->setBoolean(PageAgentState::pageAgentScriptExecutionDisabled, value);
if (!mainFrame())
return;
Settings* settings = mainFrame()->settings();
if (settings) {
m_ignoreScriptsEnabledNotification = true;
settings->setScriptEnabled(!value);
m_ignoreScriptsEnabledNotification = false;
}
}
| 7,744 |
16,804 | 0 | static void inc_refcounts(BlockDriverState *bs,
BdrvCheckResult *res,
uint16_t *refcount_table,
int refcount_table_size,
int64_t offset, int64_t size)
{
BDRVQcowState *s = bs->opaque;
int64_t start, last, cluster_offset;
int k;
if (size <= 0)
return;
start = start_of_cluster(s, offset);
last = start_of_cluster(s, offset + size - 1);
for(cluster_offset = start; cluster_offset <= last;
cluster_offset += s->cluster_size) {
k = cluster_offset >> s->cluster_bits;
if (k < 0) {
fprintf(stderr, "ERROR: invalid cluster offset=0x%" PRIx64 "\n",
cluster_offset);
res->corruptions++;
} else if (k >= refcount_table_size) {
fprintf(stderr, "Warning: cluster offset=0x%" PRIx64 " is after "
"the end of the image file, can't properly check refcounts.\n",
cluster_offset);
res->check_errors++;
} else {
if (++refcount_table[k] == 0) {
fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64
"\n", cluster_offset);
res->corruptions++;
}
}
}
}
| 7,745 |
26,165 | 0 | static void perf_swevent_cancel_hrtimer(struct perf_event *event)
{
struct hw_perf_event *hwc = &event->hw;
if (is_sampling_event(event)) {
ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer);
local64_set(&hwc->period_left, ktime_to_ns(remaining));
hrtimer_cancel(&hwc->hrtimer);
}
}
| 7,746 |
139,540 | 0 | StaticRangeVector* RangesFromCurrentSelectionOrExtendCaret(
const LocalFrame& frame,
SelectionModifyDirection direction,
TextGranularity granularity) {
frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
SelectionModifier selection_modifier(
frame, frame.Selection().ComputeVisibleSelectionInDOMTreeDeprecated());
if (selection_modifier.Selection().IsCaret())
selection_modifier.Modify(SelectionModifyAlteration::kExtend, direction,
granularity);
StaticRangeVector* ranges = new StaticRangeVector;
if (selection_modifier.Selection().IsNone())
return ranges;
ranges->push_back(StaticRange::Create(
FirstEphemeralRangeOf(selection_modifier.Selection())));
return ranges;
}
| 7,747 |
177,297 | 0 | status_t ACodec::setCyclicIntraMacroblockRefresh(const sp<AMessage> &msg, int32_t mode) {
OMX_VIDEO_PARAM_INTRAREFRESHTYPE params;
InitOMXParams(¶ms);
params.nPortIndex = kPortIndexOutput;
params.eRefreshMode = static_cast<OMX_VIDEO_INTRAREFRESHTYPE>(mode);
if (params.eRefreshMode == OMX_VIDEO_IntraRefreshCyclic ||
params.eRefreshMode == OMX_VIDEO_IntraRefreshBoth) {
int32_t mbs;
if (!msg->findInt32("intra-refresh-CIR-mbs", &mbs)) {
return INVALID_OPERATION;
}
params.nCirMBs = mbs;
}
if (params.eRefreshMode == OMX_VIDEO_IntraRefreshAdaptive ||
params.eRefreshMode == OMX_VIDEO_IntraRefreshBoth) {
int32_t mbs;
if (!msg->findInt32("intra-refresh-AIR-mbs", &mbs)) {
return INVALID_OPERATION;
}
params.nAirMBs = mbs;
int32_t ref;
if (!msg->findInt32("intra-refresh-AIR-ref", &ref)) {
return INVALID_OPERATION;
}
params.nAirRef = ref;
}
status_t err = mOMX->setParameter(
mNode, OMX_IndexParamVideoIntraRefresh,
¶ms, sizeof(params));
return err;
}
| 7,748 |
163,973 | 0 | void PaymentRequestState::HasEnrolledInstrument(StatusCallback callback) {
if (!get_all_instruments_finished_) {
DCHECK(!has_enrolled_instrument_callback_);
has_enrolled_instrument_callback_ = std::move(callback);
return;
}
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&PaymentRequestState::CheckHasEnrolledInstrument,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
| 7,749 |
15,650 | 0 | static void tsc210x_reset(TSC210xState *s)
{
s->state = 0;
s->pin_func = 2;
s->enabled = 0;
s->busy = 0;
s->nextfunction = 0;
s->ref = 0;
s->timing = 0;
s->irq = 0;
s->dav = 0;
s->audio_ctrl1 = 0x0000;
s->audio_ctrl2 = 0x4410;
s->audio_ctrl3 = 0x0000;
s->pll[0] = 0x1004;
s->pll[1] = 0x0000;
s->pll[2] = 0x1fff;
s->volume = 0xffff;
s->dac_power = 0x8540;
s->softstep = 1;
s->volume_change = 0;
s->powerdown = 0;
s->filter_data[0x00] = 0x6be3;
s->filter_data[0x01] = 0x9666;
s->filter_data[0x02] = 0x675d;
s->filter_data[0x03] = 0x6be3;
s->filter_data[0x04] = 0x9666;
s->filter_data[0x05] = 0x675d;
s->filter_data[0x06] = 0x7d83;
s->filter_data[0x07] = 0x84ee;
s->filter_data[0x08] = 0x7d83;
s->filter_data[0x09] = 0x84ee;
s->filter_data[0x0a] = 0x6be3;
s->filter_data[0x0b] = 0x9666;
s->filter_data[0x0c] = 0x675d;
s->filter_data[0x0d] = 0x6be3;
s->filter_data[0x0e] = 0x9666;
s->filter_data[0x0f] = 0x675d;
s->filter_data[0x10] = 0x7d83;
s->filter_data[0x11] = 0x84ee;
s->filter_data[0x12] = 0x7d83;
s->filter_data[0x13] = 0x84ee;
s->i2s_tx_rate = 0;
s->i2s_rx_rate = 0;
s->kb.scan = 1;
s->kb.debounce = 0;
s->kb.mask = 0x0000;
s->kb.mode = 3;
s->kb.intr = 0;
qemu_set_irq(s->pint, !s->irq);
qemu_set_irq(s->davint, !s->dav);
qemu_irq_raise(s->kbint);
}
| 7,750 |
26,127 | 0 | static void perf_group_detach(struct perf_event *event)
{
struct perf_event *sibling, *tmp;
struct list_head *list = NULL;
/*
* We can have double detach due to exit/hot-unplug + close.
*/
if (!(event->attach_state & PERF_ATTACH_GROUP))
return;
event->attach_state &= ~PERF_ATTACH_GROUP;
/*
* If this is a sibling, remove it from its group.
*/
if (event->group_leader != event) {
list_del_init(&event->group_entry);
event->group_leader->nr_siblings--;
goto out;
}
if (!list_empty(&event->group_entry))
list = &event->group_entry;
/*
* If this was a group event with sibling events then
* upgrade the siblings to singleton events by adding them
* to whatever list we are on.
*/
list_for_each_entry_safe(sibling, tmp, &event->sibling_list, group_entry) {
if (list)
list_move_tail(&sibling->group_entry, list);
sibling->group_leader = sibling;
/* Inherit group flags from the previous leader */
sibling->group_flags = event->group_flags;
}
out:
perf_event__header_size(event->group_leader);
list_for_each_entry(tmp, &event->group_leader->sibling_list, group_entry)
perf_event__header_size(tmp);
}
| 7,751 |
145,140 | 0 | void CreateMemoryCoordinatorHandleForGpuProcess(
int gpu_process_id,
mojom::MemoryCoordinatorHandleRequest request) {
MemoryCoordinatorImpl::GetInstance()->CreateHandle(gpu_process_id,
std::move(request));
}
| 7,752 |
85,522 | 0 | static void ocfs2_write_failure(struct inode *inode,
struct ocfs2_write_ctxt *wc,
loff_t user_pos, unsigned user_len)
{
int i;
unsigned from = user_pos & (PAGE_SIZE - 1),
to = user_pos + user_len;
struct page *tmppage;
if (wc->w_target_page)
ocfs2_zero_new_buffers(wc->w_target_page, from, to);
for(i = 0; i < wc->w_num_pages; i++) {
tmppage = wc->w_pages[i];
if (tmppage && page_has_buffers(tmppage)) {
if (ocfs2_should_order_data(inode))
ocfs2_jbd2_file_inode(wc->w_handle, inode);
block_commit_write(tmppage, from, to);
}
}
}
| 7,753 |
69,216 | 0 | ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, size_t len)
{
zend_ulong h;
uint32_t nIndex;
uint32_t idx;
Bucket *p;
Bucket *prev = NULL;
IS_CONSISTENT(ht);
HT_ASSERT(GC_REFCOUNT(ht) == 1);
h = zend_inline_hash_func(str, len);
nIndex = h | ht->nTableMask;
idx = HT_HASH(ht, nIndex);
while (idx != HT_INVALID_IDX) {
p = HT_HASH_TO_BUCKET(ht, idx);
if ((p->h == h)
&& p->key
&& (ZSTR_LEN(p->key) == len)
&& !memcmp(ZSTR_VAL(p->key), str, len)) {
if (Z_TYPE(p->val) == IS_INDIRECT) {
zval *data = Z_INDIRECT(p->val);
if (UNEXPECTED(Z_TYPE_P(data) == IS_UNDEF)) {
return FAILURE;
} else {
if (ht->pDestructor) {
ht->pDestructor(data);
}
ZVAL_UNDEF(data);
ht->u.v.flags |= HASH_FLAG_HAS_EMPTY_IND;
}
} else {
_zend_hash_del_el_ex(ht, idx, p, prev);
}
return SUCCESS;
}
prev = p;
idx = Z_NEXT(p->val);
}
return FAILURE;
}
| 7,754 |
150,681 | 0 | PageInfo::PageInfo(
PageInfoUI* ui,
Profile* profile,
TabSpecificContentSettings* tab_specific_content_settings,
content::WebContents* web_contents,
const GURL& url,
security_state::SecurityLevel security_level,
const security_state::VisibleSecurityState& visible_security_state)
: TabSpecificContentSettings::SiteDataObserver(
tab_specific_content_settings),
content::WebContentsObserver(web_contents),
ui_(ui),
show_info_bar_(false),
site_url_(url),
site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN),
site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN),
show_ssl_decision_revoke_button_(false),
content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)),
chrome_ssl_host_state_delegate_(
ChromeSSLHostStateDelegateFactory::GetForProfile(profile)),
did_revoke_user_ssl_decisions_(false),
profile_(profile),
security_level_(security_state::NONE),
#if defined(FULL_SAFE_BROWSING)
password_protection_service_(
safe_browsing::ChromePasswordProtectionService::
GetPasswordProtectionService(profile_)),
#endif
show_change_password_buttons_(false),
did_perform_action_(false) {
ComputeUIInputs(url, security_level, visible_security_state);
PresentSitePermissions();
PresentSiteIdentity();
PresentSiteData();
PresentPageFeatureInfo();
RecordPageInfoAction(PAGE_INFO_OPENED);
start_time_ = base::TimeTicks::Now();
}
| 7,755 |
121,717 | 0 | ServiceWorkerVersionBrowserTest() : next_registration_id_(1) {}
| 7,756 |
82,419 | 0 | JsVarFloat jsvGetFloatAndUnLock(JsVar *v) { return _jsvGetFloatAndUnLock(v); }
| 7,757 |
50,288 | 0 | static void sig_winch(int sig) {
unsigned short width,height;
struct mt_packet data;
int plen;
/* terminal height/width has changed, inform server */
if (get_terminal_size(&width, &height) != -1) {
init_packet(&data, MT_PTYPE_DATA, srcmac, dstmac, sessionkey, outcounter);
width = htole16(width);
height = htole16(height);
plen = add_control_packet(&data, MT_CPTYPE_TERM_WIDTH, &width, 2);
plen += add_control_packet(&data, MT_CPTYPE_TERM_HEIGHT, &height, 2);
outcounter += plen;
send_udp(&data, 1);
}
/* reinstate signal handler */
signal(SIGWINCH, sig_winch);
}
| 7,758 |
54,553 | 0 | static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
int err;
if (atom.size < 8)
return 0; /* continue */
if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
avio_skip(pb, atom.size - 4);
return 0;
}
atom.type = avio_rl32(pb);
atom.size -= 8;
if (atom.type != MKTAG('m','d','a','t')) {
avio_skip(pb, atom.size);
return 0;
}
err = mov_read_mdat(c, pb, atom);
return err;
}
| 7,759 |
107,135 | 0 | void LayerTreeHostQt::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time)
{
}
| 7,760 |
110,230 | 0 | NaClProcessHost::~NaClProcessHost() {
int exit_code;
process_->GetTerminationStatus(&exit_code);
std::string message =
base::StringPrintf("NaCl process exited with status %i (0x%x)",
exit_code, exit_code);
if (exit_code == 0) {
LOG(INFO) << message;
} else {
LOG(ERROR) << message;
}
for (size_t i = 0; i < internal_->sockets_for_renderer.size(); i++) {
if (nacl::Close(internal_->sockets_for_renderer[i]) != 0) {
NOTREACHED() << "nacl::Close() failed";
}
}
for (size_t i = 0; i < internal_->sockets_for_sel_ldr.size(); i++) {
if (nacl::Close(internal_->sockets_for_sel_ldr[i]) != 0) {
NOTREACHED() << "nacl::Close() failed";
}
}
if (reply_msg_) {
reply_msg_->set_reply_error();
chrome_render_message_filter_->Send(reply_msg_);
}
#if defined(OS_WIN)
if (process_launched_by_broker_) {
NaClBrokerService::GetInstance()->OnLoaderDied();
}
#endif
}
| 7,761 |
96,128 | 0 | static void timer_init(Unit *u) {
Timer *t = TIMER(u);
assert(u);
assert(u->load_state == UNIT_STUB);
t->next_elapse_monotonic_or_boottime = USEC_INFINITY;
t->next_elapse_realtime = USEC_INFINITY;
t->accuracy_usec = u->manager->default_timer_accuracy_usec;
}
| 7,762 |
154,045 | 0 | void GLES2DecoderImpl::DoPauseTransformFeedback() {
DCHECK(state_.bound_transform_feedback.get());
if (!state_.bound_transform_feedback->active() ||
state_.bound_transform_feedback->paused()) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPauseTransformFeedback",
"transform feedback is not active or already paused");
return;
}
state_.bound_transform_feedback->DoPauseTransformFeedback();
}
| 7,763 |
179,995 | 1 | krb5_gss_process_context_token(minor_status, context_handle,
token_buffer)
OM_uint32 *minor_status;
gss_ctx_id_t context_handle;
gss_buffer_t token_buffer;
{
krb5_gss_ctx_id_rec *ctx;
OM_uint32 majerr;
ctx = (krb5_gss_ctx_id_t) context_handle;
if (! ctx->established) {
*minor_status = KG_CTX_INCOMPLETE;
return(GSS_S_NO_CONTEXT);
}
/* "unseal" the token */
if (GSS_ERROR(majerr = kg_unseal(minor_status, context_handle,
token_buffer,
GSS_C_NO_BUFFER, NULL, NULL,
KG_TOK_DEL_CTX)))
return(majerr);
/* that's it. delete the context *
return(krb5_gss_delete_sec_context(minor_status, &context_handle,
GSS_C_NO_BUFFER));
}
| 7,764 |
170,310 | 0 | bool UsbChooserContext::IsValidObject(const base::DictionaryValue& object) {
return object.size() == 4 && object.HasKey(kDeviceNameKey) &&
object.HasKey(kVendorIdKey) && object.HasKey(kProductIdKey) &&
object.HasKey(kSerialNumberKey);
}
| 7,765 |
122,727 | 0 | void Extension::UpdateTabSpecificPermissions(
int tab_id,
scoped_refptr<const PermissionSet> permissions) const {
base::AutoLock auto_lock(runtime_data_lock_);
runtime_data_.UpdateTabSpecificPermissions(tab_id, permissions);
}
| 7,766 |
119,979 | 0 | DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client)
: client_(client),
use_surfaces_(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseSurfaces)),
last_output_surface_id_(0),
pending_delegated_ack_count_(0),
skipped_frames_(false),
can_lock_compositor_(YES_CAN_LOCK),
delegated_frame_evictor_(new DelegatedFrameEvictor(this)) {
ImageTransportFactory::GetInstance()->AddObserver(this);
}
| 7,767 |
87,457 | 0 | static void add_coins(Coin* c1, const Coin* c2)
{
size_t i;
for(i = 0; i < c2->symbols.size; i++) uivector_push_back(&c1->symbols, c2->symbols.data[i]);
c1->weight += c2->weight;
}
| 7,768 |
75,428 | 0 | static int opinc(RAsm *a, ut8 *data, const Opcode *op) {
if (op->operands[1].type) {
eprintf ("Error: Invalid operands\n");
return -1;
}
int l = 0;
int size = op->operands[0].type & ALL_SIZE;
if (op->operands[0].explicit_size) {
size = op->operands[0].dest_size;
}
if (size & OT_WORD) {
data[l++] = 0x66;
}
int rex = 1 << 6;
bool use_rex = false;
if (size & OT_QWORD) { //W field
use_rex = true;
rex |= 1 << 3;
}
if (op->operands[0].extended) { //B field
use_rex = true;
rex |= 1;
}
int opcode;
if (size & OT_BYTE) {
opcode = 0xfe;
} else {
opcode = 0xff;
}
if (!(op->operands[0].type & OT_MEMORY)) {
if (use_rex) {
data[l++] = rex;
}
if (a->bits > 32 || size & OT_BYTE) {
data[l++] = opcode;
}
if (a->bits == 32 && size & (OT_DWORD | OT_WORD)) {
data[l++] = 0x40 | op->operands[0].reg;
} else {
data[l++] = 0xc0 | op->operands[0].reg;
}
return l;
}
bool rip_rel = op->operands[0].regs[0] == X86R_RIP;
int offset = op->operands[0].offset * op->operands[0].offset_sign;
int modrm = 0;
int mod;
int reg = 0;
int rm;
bool use_sib = false;
int sib = 0;
if (offset == 0) {
mod = 0;
} else if (offset < 128 && offset > -129) {
mod = 1;
} else {
mod = 2;
}
if (op->operands[0].regs[0] & OT_WORD) {
if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) {
rm = B0000;
} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) {
rm = B0001;
} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) {
rm = B0010;
} else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) {
rm = B0011;
} else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) {
rm = B0100;
} else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) {
rm = B0101;
} else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) {
rm = B0111;
} else {
return -1;
}
modrm = (mod << 6) | (reg << 3) | rm;
} else {
if (op->operands[0].extended) {
rm = op->operands[0].reg;
} else {
rm = op->operands[0].regs[0];
}
if (rm == 5 && mod == 0) {
mod = 1;
}
int index = op->operands[0].regs[1];
int scale = getsib(op->operands[0].scale[1]);
if (index != -1) {
use_sib = true;
sib = (scale << 6) | (index << 3) | rm;
} else if (rm == 4) {
use_sib = true;
sib = 0x24;
}
if (use_sib) {
rm = B0100;
}
if (rip_rel) {
modrm = (B0000 << 6) | (reg << 3) | B0101;
sib = (scale << 6) | (B0100 << 3) | B0101;
} else {
modrm = (mod << 6) | (reg << 3) | rm;
}
}
if (use_rex) {
data[l++] = rex;
}
data[l++] = opcode;
data[l++] = modrm;
if (use_sib) {
data[l++] = sib;
}
if (mod == 1) {
data[l++] = offset;
} else if (op->operands[0].regs[0] & OT_WORD && mod == 2) {
data[l++] = offset;
data[l++] = offset >> 8;
} else if (mod == 2 || rip_rel) {
data[l++] = offset;
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
return l;
}
| 7,769 |
183,194 | 1 | chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length)
{
u_int proto;
proto = EXTRACT_16BITS(&p[2]);
if (ndo->ndo_eflag) {
ND_PRINT((ndo, "%s, ethertype %s (0x%04x), length %u: ",
tok2str(chdlc_cast_values, "0x%02x", p[0]),
tok2str(ethertype_values, "Unknown", proto),
proto,
length));
}
length -= CHDLC_HDRLEN;
p += CHDLC_HDRLEN;
switch (proto) {
case ETHERTYPE_IP:
ip_print(ndo, p, length);
break;
case ETHERTYPE_IPV6:
ip6_print(ndo, p, length);
break;
case CHDLC_TYPE_SLARP:
chdlc_slarp_print(ndo, p, length);
break;
#if 0
case CHDLC_TYPE_CDP:
chdlc_cdp_print(p, length);
break;
#endif
case ETHERTYPE_MPLS:
case ETHERTYPE_MPLS_MULTI:
mpls_print(ndo, p, length);
break;
case ETHERTYPE_ISO:
/* is the fudge byte set ? lets verify by spotting ISO headers */
if (*(p+1) == 0x81 ||
*(p+1) == 0x82 ||
*(p+1) == 0x83)
isoclns_print(ndo, p + 1, length - 1, ndo->ndo_snapend - p - 1);
else
isoclns_print(ndo, p, length, ndo->ndo_snapend - p);
break;
default:
if (!ndo->ndo_eflag)
ND_PRINT((ndo, "unknown CHDLC protocol (0x%04x)", proto));
break;
}
return (CHDLC_HDRLEN);
}
| 7,770 |
14,036 | 0 | PanoramiXRenderCreateLinearGradient (ClientPtr client)
{
REQUEST(xRenderCreateLinearGradientReq);
PanoramiXRes *newPict;
int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPict->type = XRT_PICTURE;
newPict->info[0].id = stuff->pid;
newPict->u.pict.root = FALSE;
for(j = 1; j < PanoramiXNumScreens; j++)
newPict->info[j].id = FakeClientID(client->index);
FOR_NSCREENS_BACKWARD(j) {
stuff->pid = newPict->info[j].id;
result = (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client);
if(result != Success) break;
}
if (result == Success)
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
free(newPict);
return result;
}
| 7,771 |
75,582 | 0 | static void hwahc_destroy(struct hwahc *hwahc)
{
struct wusbhc *wusbhc = &hwahc->wusbhc;
mutex_lock(&wusbhc->mutex);
__wa_destroy(&hwahc->wa);
wusbhc_destroy(&hwahc->wusbhc);
hwahc_security_release(hwahc);
hwahc->wusbhc.dev = NULL;
uwb_rc_put(wusbhc->uwb_rc);
usb_put_intf(hwahc->wa.usb_iface);
usb_put_dev(hwahc->wa.usb_dev);
mutex_unlock(&wusbhc->mutex);
}
| 7,772 |
162,016 | 0 | base::PortProvider* BrowserChildProcessHost::GetPortProvider() {
return MachBroker::GetInstance();
}
| 7,773 |
174,912 | 0 | status_t Camera2Client::removeFrameListener(int32_t minId, int32_t maxId,
wp<camera2::FrameProcessor::FilteredListener> listener) {
return mFrameProcessor->removeListener(minId, maxId, listener);
}
| 7,774 |
76,702 | 0 | static void t1_puts(PDF pdf, const char *s)
{
if (s != t1_line_array)
strcpy(t1_line_array, s);
t1_line_ptr = strend(t1_line_array);
t1_putline(pdf);
}
| 7,775 |
63,906 | 0 | static int do_timerfd_gettime(int ufd, struct itimerspec *t)
{
struct fd f;
struct timerfd_ctx *ctx;
int ret = timerfd_fget(ufd, &f);
if (ret)
return ret;
ctx = f.file->private_data;
spin_lock_irq(&ctx->wqh.lock);
if (ctx->expired && ctx->tintv) {
ctx->expired = 0;
if (isalarm(ctx)) {
ctx->ticks +=
alarm_forward_now(
&ctx->t.alarm, ctx->tintv) - 1;
alarm_restart(&ctx->t.alarm);
} else {
ctx->ticks +=
hrtimer_forward_now(&ctx->t.tmr, ctx->tintv)
- 1;
hrtimer_restart(&ctx->t.tmr);
}
}
t->it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
t->it_interval = ktime_to_timespec(ctx->tintv);
spin_unlock_irq(&ctx->wqh.lock);
fdput(f);
return 0;
}
| 7,776 |
101,293 | 0 | void SyncerUtil::CreateNewEntry(syncable::WriteTransaction *trans,
const syncable::Id& id) {
syncable::MutableEntry entry(trans, syncable::GET_BY_ID, id);
if (!entry.good()) {
syncable::MutableEntry new_entry(trans, syncable::CREATE_NEW_UPDATE_ITEM,
id);
}
}
| 7,777 |
76,661 | 0 | static void t1_read_subrs(void)
{
int i, s;
cs_entry *ptr;
t1_getline();
while (!(t1_charstrings() || t1_subrs())) {
t1_scan_param();
t1_putline();
t1_getline();
}
found:
t1_cs = true;
t1_scan = false;
if (!t1_subrs())
return;
subr_size_pos = strlen("/Subrs") + 1;
/* subr_size_pos points to the number indicating dict size after "/Subrs" */
subr_size = t1_scan_num(t1_line_array + subr_size_pos, 0);
if (subr_size == 0) {
while (!t1_charstrings())
t1_getline();
return;
}
subr_tab = xtalloc(subr_size, cs_entry);
for (ptr = subr_tab; ptr - subr_tab < subr_size; ptr++)
init_cs_entry(ptr);
subr_array_start = xstrdup(t1_line_array);
t1_getline();
while (t1_cslen) {
store_subr();
t1_getline();
}
/* mark the first four entries without parsing */
for (i = 0; i < subr_size && i < 4; i++)
subr_tab[i].used = true;
/* the end of the Subrs array might have more than one line so we need to
concatnate them to subr_array_end. Unfortunately some fonts don't have
the Subrs array followed by the CharStrings dict immediately (synthetic
fonts). If we cannot find CharStrings in next POST_SUBRS_SCAN lines then
we will treat the font as synthetic and ignore everything until next
Subrs is found
*/
#define POST_SUBRS_SCAN 5
s = 0;
*t1_buf_array = 0;
for (i = 0; i < POST_SUBRS_SCAN; i++) {
if (t1_charstrings())
break;
s += t1_line_ptr - t1_line_array;
alloc_array(t1_buf, s, T1_BUF_SIZE);
strcat(t1_buf_array, t1_line_array);
t1_getline();
}
subr_array_end = xstrdup(t1_buf_array);
if (i == POST_SUBRS_SCAN) { /* CharStrings not found;
suppose synthetic font */
for (ptr = subr_tab; ptr - subr_tab < subr_size; ptr++)
if (ptr->valid)
xfree(ptr->data);
xfree(subr_tab);
xfree(subr_array_start);
xfree(subr_array_end);
cs_init();
t1_cs = false;
t1_synthetic = true;
while (!(t1_charstrings() || t1_subrs()))
t1_getline();
goto found;
}
}
| 7,778 |
125,272 | 0 | void RenderViewImpl::OnEnumerateDirectoryResponse(
int id,
const std::vector<FilePath>& paths) {
if (!enumeration_completions_[id])
return;
WebVector<WebString> ws_file_names(paths.size());
for (size_t i = 0; i < paths.size(); ++i)
ws_file_names[i] = webkit_base::FilePathToWebString(paths[i]);
enumeration_completions_[id]->didChooseFile(ws_file_names);
enumeration_completions_.erase(id);
}
| 7,779 |
91,285 | 0 | static void ipmi_request_event(struct ipmi_smi *intf)
{
/* No event requests when in maintenance mode. */
if (intf->maintenance_mode_enable)
return;
if (!intf->in_shutdown)
intf->handlers->request_events(intf->send_info);
}
| 7,780 |
58,481 | 0 | _SSL_set_verify (SSL_CTX *ctx, void *verify_callback, char *cacert)
{
if (!SSL_CTX_set_default_verify_paths (ctx))
{
__SSL_fill_err_buf ("SSL_CTX_set_default_verify_paths");
return (err_buf);
}
/*
if (cacert)
{
if (!SSL_CTX_load_verify_locations (ctx, cacert, NULL))
{
__SSL_fill_err_buf ("SSL_CTX_load_verify_locations");
return (err_buf);
}
}
*/
SSL_CTX_set_verify (ctx, SSL_VERIFY_PEER, verify_callback);
return (NULL);
}
| 7,781 |
140,342 | 0 | bool Editor::isSelectTrailingWhitespaceEnabled() const {
if (Settings* settings = frame().settings())
return settings->getSelectTrailingWhitespaceEnabled();
return false;
}
| 7,782 |
60,893 | 0 | file_info_cancel (NautilusDirectory *directory)
{
if (directory->details->get_info_in_progress != NULL)
{
g_cancellable_cancel (directory->details->get_info_in_progress->cancellable);
directory->details->get_info_in_progress->directory = NULL;
directory->details->get_info_in_progress = NULL;
directory->details->get_info_file = NULL;
async_job_end (directory, "file info");
}
}
| 7,783 |
29,669 | 0 | int dm_persistent_snapshot_init(void)
{
int r;
r = dm_exception_store_type_register(&_persistent_type);
if (r) {
DMERR("Unable to register persistent exception store type");
return r;
}
r = dm_exception_store_type_register(&_persistent_compat_type);
if (r) {
DMERR("Unable to register old-style persistent exception "
"store type");
dm_exception_store_type_unregister(&_persistent_type);
return r;
}
return r;
}
| 7,784 |
11,463 | 0 | fbFetch_x4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed)
{
const CARD16 *pixel = (const CARD16 *)bits + x;
const CARD16 *end = pixel + width;
while (pixel < end) {
CARD32 p = READ(pixel++);
CARD32 r,g,b;
r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
b = ((p & 0x000f) | ((p & 0x000f) << 4));
WRITE(buffer++, (0xff000000 | r | g | b));
}
}
| 7,785 |
148,458 | 0 | void WebContentsImpl::NotifyWebContentsLostFocus() {
for (auto& observer : observers_)
observer.OnWebContentsLostFocus();
}
| 7,786 |
47,314 | 0 | static int rmd256_init(struct shash_desc *desc)
{
struct rmd256_ctx *rctx = shash_desc_ctx(desc);
rctx->byte_count = 0;
rctx->state[0] = RMD_H0;
rctx->state[1] = RMD_H1;
rctx->state[2] = RMD_H2;
rctx->state[3] = RMD_H3;
rctx->state[4] = RMD_H5;
rctx->state[5] = RMD_H6;
rctx->state[6] = RMD_H7;
rctx->state[7] = RMD_H8;
memset(rctx->buffer, 0, sizeof(rctx->buffer));
return 0;
}
| 7,787 |
47,355 | 0 | static inline void LOAD_OP(int I, u32 *W, const u8 *input)
{
W[I] = get_unaligned_be32((__u32 *)input + I);
}
| 7,788 |
129,443 | 0 | error::Error GLES2DecoderImpl::HandleWaitAllAsyncTexImage2DCHROMIUM(
uint32 immediate_data_size, const cmds::WaitAllAsyncTexImage2DCHROMIUM& c) {
TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleWaitAsyncTexImage2DCHROMIUM");
GetAsyncPixelTransferManager()->WaitAllAsyncTexImage2D();
ProcessFinishedAsyncTransfers();
return error::kNoError;
}
| 7,789 |
134,715 | 0 | void GuestViewBase::DidAttach(int guest_proxy_routing_id) {
DCHECK(guest_proxy_routing_id_ == MSG_ROUTING_NONE ||
guest_proxy_routing_id == guest_proxy_routing_id_);
guest_proxy_routing_id_ = guest_proxy_routing_id;
opener_lifetime_observer_.reset();
SetUpSizing(*attach_params());
DidAttachToEmbedder();
embedder_web_contents()->Send(new GuestViewMsg_GuestAttached(
element_instance_id_,
guest_proxy_routing_id));
SendQueuedEvents();
}
| 7,790 |
56,697 | 0 | static inline void ext4_show_quota_options(struct seq_file *seq,
struct super_block *sb)
{
#if defined(CONFIG_QUOTA)
struct ext4_sb_info *sbi = EXT4_SB(sb);
if (sbi->s_jquota_fmt) {
char *fmtname = "";
switch (sbi->s_jquota_fmt) {
case QFMT_VFS_OLD:
fmtname = "vfsold";
break;
case QFMT_VFS_V0:
fmtname = "vfsv0";
break;
case QFMT_VFS_V1:
fmtname = "vfsv1";
break;
}
seq_printf(seq, ",jqfmt=%s", fmtname);
}
if (sbi->s_qf_names[USRQUOTA])
seq_show_option(seq, "usrjquota", sbi->s_qf_names[USRQUOTA]);
if (sbi->s_qf_names[GRPQUOTA])
seq_show_option(seq, "grpjquota", sbi->s_qf_names[GRPQUOTA]);
#endif
}
| 7,791 |
83,468 | 0 | str_free(char *s)
{
free(s);
}
| 7,792 |
112,054 | 0 | virtual void SetUp() {
dir_maker_.SetUp();
mock_server_.reset(new MockConnectionManager(directory()));
EnableDatatype(syncable::BOOKMARKS);
EnableDatatype(syncable::NIGORI);
EnableDatatype(syncable::PREFERENCES);
EnableDatatype(syncable::NIGORI);
worker_ = new FakeModelWorker(GROUP_PASSIVE);
std::vector<SyncEngineEventListener*> listeners;
listeners.push_back(this);
context_.reset(
new SyncSessionContext(
mock_server_.get(), directory(), this,
&extensions_activity_monitor_, listeners, NULL,
&traffic_recorder_));
ASSERT_FALSE(context_->resolver());
syncer_ = new Syncer();
session_.reset(MakeSession());
ReadTransaction trans(FROM_HERE, directory());
syncable::Directory::ChildHandles children;
directory()->GetChildHandlesById(&trans, trans.root_id(), &children);
ASSERT_EQ(0u, children.size());
saw_syncer_event_ = false;
root_id_ = TestIdFactory::root();
parent_id_ = ids_.MakeServer("parent id");
child_id_ = ids_.MakeServer("child id");
}
| 7,793 |
165,162 | 0 | void HTMLFormElement::Trace(blink::Visitor* visitor) {
visitor->Trace(past_names_map_);
visitor->Trace(radio_button_group_scope_);
visitor->Trace(listed_elements_);
visitor->Trace(image_elements_);
visitor->Trace(planned_navigation_);
HTMLElement::Trace(visitor);
}
| 7,794 |
68,145 | 0 | static int sctp_msghdr_parse(const struct msghdr *msg, sctp_cmsgs_t *cmsgs)
{
struct cmsghdr *cmsg;
struct msghdr *my_msg = (struct msghdr *)msg;
for_each_cmsghdr(cmsg, my_msg) {
if (!CMSG_OK(my_msg, cmsg))
return -EINVAL;
/* Should we parse this header or ignore? */
if (cmsg->cmsg_level != IPPROTO_SCTP)
continue;
/* Strictly check lengths following example in SCM code. */
switch (cmsg->cmsg_type) {
case SCTP_INIT:
/* SCTP Socket API Extension
* 5.3.1 SCTP Initiation Structure (SCTP_INIT)
*
* This cmsghdr structure provides information for
* initializing new SCTP associations with sendmsg().
* The SCTP_INITMSG socket option uses this same data
* structure. This structure is not used for
* recvmsg().
*
* cmsg_level cmsg_type cmsg_data[]
* ------------ ------------ ----------------------
* IPPROTO_SCTP SCTP_INIT struct sctp_initmsg
*/
if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_initmsg)))
return -EINVAL;
cmsgs->init = CMSG_DATA(cmsg);
break;
case SCTP_SNDRCV:
/* SCTP Socket API Extension
* 5.3.2 SCTP Header Information Structure(SCTP_SNDRCV)
*
* This cmsghdr structure specifies SCTP options for
* sendmsg() and describes SCTP header information
* about a received message through recvmsg().
*
* cmsg_level cmsg_type cmsg_data[]
* ------------ ------------ ----------------------
* IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo
*/
if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_sndrcvinfo)))
return -EINVAL;
cmsgs->srinfo = CMSG_DATA(cmsg);
if (cmsgs->srinfo->sinfo_flags &
~(SCTP_UNORDERED | SCTP_ADDR_OVER |
SCTP_SACK_IMMEDIATELY | SCTP_PR_SCTP_MASK |
SCTP_ABORT | SCTP_EOF))
return -EINVAL;
break;
case SCTP_SNDINFO:
/* SCTP Socket API Extension
* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO)
*
* This cmsghdr structure specifies SCTP options for
* sendmsg(). This structure and SCTP_RCVINFO replaces
* SCTP_SNDRCV which has been deprecated.
*
* cmsg_level cmsg_type cmsg_data[]
* ------------ ------------ ---------------------
* IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo
*/
if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_sndinfo)))
return -EINVAL;
cmsgs->sinfo = CMSG_DATA(cmsg);
if (cmsgs->sinfo->snd_flags &
~(SCTP_UNORDERED | SCTP_ADDR_OVER |
SCTP_SACK_IMMEDIATELY | SCTP_PR_SCTP_MASK |
SCTP_ABORT | SCTP_EOF))
return -EINVAL;
break;
default:
return -EINVAL;
}
}
return 0;
}
| 7,795 |
186,259 | 1 | DrawingBuffer::DrawingBuffer(
std::unique_ptr<WebGraphicsContext3DProvider> context_provider,
std::unique_ptr<Extensions3DUtil> extensions_util,
Client* client,
bool discard_framebuffer_supported,
bool want_alpha_channel,
bool premultiplied_alpha,
PreserveDrawingBuffer preserve,
WebGLVersion web_gl_version,
bool want_depth,
bool want_stencil,
ChromiumImageUsage chromium_image_usage,
const CanvasColorParams& color_params)
: client_(client),
preserve_drawing_buffer_(preserve),
web_gl_version_(web_gl_version),
context_provider_(WTF::WrapUnique(new WebGraphicsContext3DProviderWrapper(
std::move(context_provider)))),
gl_(this->ContextProvider()->ContextGL()),
extensions_util_(std::move(extensions_util)),
discard_framebuffer_supported_(discard_framebuffer_supported),
want_alpha_channel_(want_alpha_channel),
premultiplied_alpha_(premultiplied_alpha),
software_rendering_(this->ContextProvider()->IsSoftwareRendering()),
want_depth_(want_depth),
want_stencil_(want_stencil),
color_space_(color_params.GetGfxColorSpace()),
chromium_image_usage_(chromium_image_usage) {
// Used by browser tests to detect the use of a DrawingBuffer.
TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation",
TRACE_EVENT_SCOPE_GLOBAL);
}
| 7,796 |
18,425 | 0 | void daemonize(SERVER* serve) {
FILE*pidf;
if(serve && !(serve->port)) {
return;
}
if(daemon(0,0)<0) {
err("daemon");
}
if(!*pidftemplate) {
if(serve) {
strncpy(pidftemplate, "/var/run/nbd-server.%d.pid", 255);
} else {
strncpy(pidftemplate, "/var/run/nbd-server.pid", 255);
}
}
snprintf(pidfname, 255, pidftemplate, serve ? serve->port : 0);
pidf=fopen(pidfname, "w");
if(pidf) {
fprintf(pidf,"%d\n", (int)getpid());
fclose(pidf);
} else {
perror("fopen");
fprintf(stderr, "Not fatal; continuing");
}
}
| 7,797 |
115,749 | 0 | void JingleSessionManager::Init(
const std::string& local_jid,
SignalStrategy* signal_strategy,
Listener* listener,
crypto::RSAPrivateKey* private_key,
const std::string& certificate,
bool allow_nat_traversal) {
DCHECK(CalledOnValidThread());
DCHECK(signal_strategy);
DCHECK(listener);
local_jid_ = local_jid;
signal_strategy_ = signal_strategy;
listener_ = listener;
private_key_.reset(private_key);
certificate_ = certificate;
allow_nat_traversal_ = allow_nat_traversal;
if (!network_manager_.get()) {
VLOG(1) << "Creating talk_base::NetworkManager.";
network_manager_.reset(new talk_base::BasicNetworkManager());
}
if (!socket_factory_.get()) {
VLOG(1) << "Creating talk_base::BasicPacketSocketFactory.";
socket_factory_.reset(new talk_base::BasicPacketSocketFactory(
talk_base::Thread::Current()));
}
int port_allocator_flags = cricket::PORTALLOCATOR_DISABLE_TCP;
if (allow_nat_traversal) {
http_port_allocator_ = new cricket::HttpPortAllocator(
network_manager_.get(), socket_factory_.get(), "transp2");
port_allocator_.reset(http_port_allocator_);
} else {
port_allocator_flags |= cricket::PORTALLOCATOR_DISABLE_STUN |
cricket::PORTALLOCATOR_DISABLE_RELAY;
port_allocator_.reset(
new cricket::BasicPortAllocator(
network_manager_.get(), socket_factory_.get()));
}
port_allocator_->set_flags(port_allocator_flags);
cricket_session_manager_.reset(
new cricket::SessionManager(port_allocator_.get()));
cricket_session_manager_->AddClient(kChromotingXmlNamespace, this);
jingle_signaling_connector_.reset(new JingleSignalingConnector(
signal_strategy_, cricket_session_manager_.get()));
if (allow_nat_traversal) {
jingle_info_request_.reset(new JingleInfoRequest(signal_strategy_));
jingle_info_request_->Send(base::Bind(
&JingleSessionManager::OnJingleInfo, base::Unretained(this)));
} else {
listener_->OnSessionManagerInitialized();
}
}
| 7,798 |
176,216 | 0 | static Handle<FixedArrayBase> ConvertElementsWithCapacity(
Handle<JSObject> object, Handle<FixedArrayBase> old_elements,
ElementsKind from_kind, uint32_t capacity, int copy_size) {
return ConvertElementsWithCapacity(object, old_elements, from_kind,
capacity, 0, 0, copy_size);
}
| 7,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.