code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
public void checkAccess(Thread t) {
if (RobocodeProperties.isSecurityOff()) {
return;
}
Thread c = Thread.currentThread();
if (isSafeThread(c)) {
return;
}
super.checkAccess(t);
// Threads belonging to other thread groups is not allowed to access threads belonging to other thread groups
// Bug... | Class | 2 |
public EfficiencyStatement getUserEfficiencyStatementByCourseRepositoryEntry(RepositoryEntry courseRepoEntry, Identity identity){
UserEfficiencyStatementImpl s = getUserEfficiencyStatementFull(courseRepoEntry, identity);
if(s == null || s.getStatementXml() == null) {
return null;
}
return (EfficiencyStateme... | Base | 1 |
public void translate(ServerBossBarPacket packet, GeyserSession session) {
BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid());
switch (packet.getAction()) {
case ADD:
long entityId = session.getEntityCache().getNextEntityId().incrementAndGet();
... | Class | 2 |
public ModelAndView recover(HttpServletRequest request, HttpServletResponse response) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String usernameOrEmail = StringUtils.trimToNull(request.getParameter("usernameOrEmail"));
if (usernameOrEmail != null) {
... | Base | 1 |
public Stream<URL> getResources(String path) {
Enumeration<URL> all;
try {
all = classLoader.getResources(prefixPath(path));
} catch (IOException e) {
return Stream.empty();
}
Stream.Builder<URL> builder = Stream.builder();
while (all.hasMoreEl... | Base | 1 |
public void translate(ServerDisplayScoreboardPacket packet, GeyserSession session) {
session.getWorldCache().getScoreboard()
.displayObjective(packet.getName(), packet.getPosition());
} | Class | 2 |
public void testComputeLength() {
byte[] aad = new byte[]{0, 1, 2, 3}; // 32 bits
byte[] expectedBitLength = new byte[]{0, 0, 0, 0, 0, 0, 0, 32};
assertTrue(Arrays.equals(expectedBitLength, AAD.computeLength(aad)));
} | Class | 2 |
private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
String oldName = request.getParameter("groupName");
String newName = request.getParameter("newName");
if (StringUtils.hasText(oldName) && StringUtils.hasText(newNam... | Base | 1 |
public BCXMSSMTPrivateKey(PrivateKeyInfo keyInfo)
throws IOException
{
XMSSMTKeyParams keyParams = XMSSMTKeyParams.getInstance(keyInfo.getPrivateKeyAlgorithm().getParameters());
this.treeDigest = keyParams.getTreeDigest().getAlgorithm();
XMSSPrivateKey xmssMtPrivateKey = XMSSPri... | Base | 1 |
protected Object extractPrincipalFromWebToken(Jwt jwt) {
Map body = (Map) jwt.getBody();
String base64Principal = (String) body.get("serialized-principal");
byte[] serializedPrincipal = Base64.decode(base64Principal);
Object principal;
ClassLoader loader = Thread.currentThrea... | Base | 1 |
private static boolean appendOneByte(Bytes buf, int cp, boolean wasSlash, boolean isPath) {
if (cp == 0x7F) {
// Reject the control character: 0x7F
return false;
}
if (cp >>> 5 == 0) {
// Reject the control characters: 0x00..0x1F
if (isPath) {... | Base | 1 |
private String createRuntimeSource(RuntimeModel model, String baseClassName, boolean scriptInDocs) {
if (scriptInDocs) {
throw new RuntimeException("Do no know how to clean the block comments yet");
}
SourceWriter writer = new SourceWriter(model);
writer.setScript(stripC... | Base | 1 |
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,
byte[] ciphertext, int ciphertextOffset, int length)
throws ShortBufferException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (!haskey) {
// The k... | Base | 1 |
private void checkParams()
throws Exception
{
if (vi == null)
{
throw new Exception("no layers defined.");
}
if (vi.length > 1)
{
for (int i = 0; i < vi.length - 1; i++)
{
if (vi[i] >= vi[i + 1])
... | Base | 1 |
public void translate(ServerSettingsRequestPacket packet, GeyserSession session) {
CustomForm window = SettingsUtils.buildForm(session);
int windowId = session.getFormCache().addForm(window);
// Fixes https://bugs.mojang.com/browse/MCPE-94012 because of the delay
session.getConnecto... | Class | 2 |
public void testEscapeSingleQuotesOnArgument()
{
Shell sh = newShell();
sh.setWorkingDirectory( "/usr/bin" );
sh.setExecutable( "chmod" );
String[] args = { "arg'withquote" };
List shellCommandLine = sh.getShellCommandLine( args );
String cli = StringUtils.joi... | Base | 1 |
static void setFeature(DocumentBuilderFactory dbf, String featureName) throws ParserConfigurationException {
try {
dbf.setFeature(featureName, true);
} catch (ParserConfigurationException e) {
if (Boolean.getBoolean(SYSTEM_PROPERTY_IGNORE_XXE_PROTECTION_FAILURES)) {
... | Base | 1 |
public void translate(ServerWindowItemsPacket packet, GeyserSession session) {
Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId());
if (inventory == null)
return;
inventory.setStateId(packet.getStateId());
for (int i = 0; i < packet.getItems... | Class | 2 |
private void sendResponse(HttpServletResponse pResp, HttpServletRequest pReq, JSONAware pJson) throws IOException {
String callback = pReq.getParameter(ConfigKey.CALLBACK.getKeyValue());
setContentType(pResp, callback != null ? "text/javascript" : getMimeType(pReq));
pResp.setStatus(HttpSer... | Base | 1 |
public void translate(ServerEntityPropertiesPacket packet, GeyserSession session) {
Entity entity;
if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {
entity = session.getPlayerEntity();
} else {
entity = session.getEntityCache().getEntityByJavaId(p... | Class | 2 |
private static ECPrivateKey generateECPrivateKey(final ECKey.Curve curve)
throws Exception {
final ECParameterSpec ecParameterSpec = curve.toECParameterSpec();
KeyPairGenerator generator = KeyPairGenerator.getInstance("EC");
generator.initialize(ecParameterSpec);
KeyPair keyPair = generator.generateKey... | Base | 1 |
private static IRubyObject getSchema(ThreadContext context, RubyClass klazz, Source source) {
String moduleName = klazz.getName();
if ("Nokogiri::XML::Schema".equals(moduleName)) {
return XmlSchema.createSchemaInstance(context, klazz, source);
} else if ("Nokogiri::XML::RelaxNG".... | Base | 1 |
public void fatalError(SAXParseException e) {
} | Base | 1 |
public void setXMLFilter(XMLFilter filter) {
this.xmlFilter = filter;
} | Base | 1 |
public void translate(ServerPlayerSetExperiencePacket packet, GeyserSession session) {
SessionPlayerEntity entity = session.getPlayerEntity();
AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience());
entity.getAttributes().put(GeyserAttributeType.EXPER... | Class | 2 |
public Response attachTaskFile(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId,
@Context HttpServletRequest request) {
ICourse course = CoursesWebService.loadCourse(courseId);
CourseEditorTreeNode parentNode = getParentNode(course, nodeId);
if(course == null) {
return Response.ser... | Base | 1 |
public void overridingSubClassExample() throws Exception {
assertThat(ConstraintViolations.format(validator.validate(new OverridingExample())))
.isEmpty();
assertThat(TestLoggerFactory.getAllLoggingEvents())
.isEmpty();
} | Class | 2 |
public static UnsafeAccess getInstance() {
SecurityCheck.getInstance();
return INSTANCE;
} | Class | 2 |
public void switchToConversationAndQuote(Conversation conversation, String text) {
switchToConversation(conversation, text, true, null, false);
} | Class | 2 |
public static void endRequest() {
final List<RequestScopedItem> result = CACHE.get();
CACHE.remove();
if (result != null) {
for (final RequestScopedItem item : result) {
item.invalidate();
}
}
} | Class | 2 |
setStringInputSource(ThreadContext context, IRubyObject data, IRubyObject url)
{
source = new InputSource();
ParserContext.setUrl(context, source, url);
Ruby ruby = context.getRuntime();
if (!(data instanceof RubyString)) {
throw ruby.newArgumentError("must be kind_of String");
}
Ru... | Base | 1 |
public void notExistingDocumentFromUIButNameTooLong() throws Exception
{
// current document = xwiki:Main.WebHome
DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("Main"), "WebHome");
XWikiDocument document = mock(XWikiDocument.class);
when(docum... | Class | 2 |
public static void fillArticleInfo(Log data, HttpServletRequest request, String suffix) {
data.put("alias", data.get("alias") + suffix);
data.put("url", WebTools.getHomeUrl(request) + Constants.getArticleUri() + data.get("alias"));
data.put("noSchemeUrl", WebTools.getHomeUrlWithHost(request)... | Base | 1 |
public static String getPropertyDef(InputSpec inputSpec, Map<String, Integer> indexes,
String pattern, DefaultValueProvider defaultValueProvider) {
int index = indexes.get(inputSpec.getName());
StringBuffer buffer = new StringBuffer();
inputSpec.appendField(buffer, index, "String");
inputSpec.appendCommonA... | Class | 2 |
public boolean isStripWhitespaceText() {
return stripWhitespaceText;
} | Base | 1 |
public InternetAddress getUserEmail()
{
return userEmail;
} | Base | 1 |
public void getAllReturnsEmptyListForUnknownName() {
final HttpHeadersBase headers = newEmptyHeaders();
assertThat(headers.getAll("noname").size()).isEqualTo(0);
} | Class | 2 |
public void archive(OLATResourceable ores, File exportDirectory) {
ObjectOutputStream out = null;
try {
File file = new File(exportDirectory, "chat.xml");
Writer writer = new FileWriter(file);
out = logXStream.createObjectOutputStream(writer);
int counter = 0;
List<InstantMessage> messages;
d... | Base | 1 |
public static void beforeClass() throws IOException {
final Random r = new Random();
for (int i = 0; i < BYTES.length; i++) {
BYTES[i] = (byte) r.nextInt(255);
}
tmp = File.createTempFile("netty-traffic", ".tmp");
tmp.deleteOnExit();
FileOutputStream out ... | Base | 1 |
public RainbowParameters(int[] vi)
{
this.vi = vi;
try
{
checkParams();
}
catch (Exception e)
{
e.printStackTrace();
}
} | Base | 1 |
public PlayerRobustConcise(TimingStyle type, String full, ISkinParam skinParam, TimingRuler ruler,
boolean compact) {
super(full, skinParam, ruler, compact);
this.type = type;
this.suggestedHeight = 0;
} | Base | 1 |
public String invokeServletAndReturnAsString(String url)
{
return this.xwiki.invokeServletAndReturnAsString(url, getXWikiContext());
} | Class | 2 |
public void translate(ServerScoreboardObjectivePacket packet, GeyserSession session) {
WorldCache worldCache = session.getWorldCache();
Scoreboard scoreboard = worldCache.getScoreboard();
Objective objective = scoreboard.getObjective(packet.getName());
int pps = worldCache.increaseAn... | Class | 2 |
private Runnable getStandardRequestSetup() {
return new Runnable() {
public void run() {
expect(request.getHeader("Origin")).andReturn(null);
expect(request.getRemoteHost()).andReturn("localhost");
expect(request.getRemoteAddr()).andReturn("127.0.0... | Compound | 4 |
public static void setRequestMethod(HttpURLConnection conn, RequestMethod method) {
try {
conn.setRequestMethod(getRequestMethodAsString(method));
} catch (ProtocolException e) {
throw ErrorUtil.createCommandException(e.getMessage());
}
} | Base | 1 |
public void testReadBytesAndWriteBytesWithFileChannel() throws IOException {
File file = File.createTempFile("file-channel", ".tmp");
RandomAccessFile randomAccessFile = null;
try {
randomAccessFile = new RandomAccessFile(file, "rw");
FileChannel channel = randomAcces... | Base | 1 |
protected BigDecimal bcdToBigDecimal() {
if (usingBytes) {
// Converting to a string here is faster than doing BigInteger/BigDecimal arithmetic.
BigDecimal result = new BigDecimal(toNumberString());
if (isNegative()) {
result = result.negate();
... | Base | 1 |
public SAXReader() {
} | Base | 1 |
public static void zipFolder(String srcFolder, String destZipFile, String ignore) throws Exception {
try (FileOutputStream fileWriter = new FileOutputStream(destZipFile);
ZipOutputStream zip = new ZipOutputStream(fileWriter)){
addFolderToZip("", srcFolder, zip, ignore);
... | Base | 1 |
public static boolean isAbsolute(String url)
{
if (url.startsWith("//")) // //www.domain.com/start
{
return true;
}
if (url.startsWith("/")) // /somePage.html
{
return false;
}
boolean result = false;
try
{
URI uri = new URI(url);
result = uri.isAbsolute();
}
catch (URISyntax... | Base | 1 |
public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode(
"getSource(" + (sourceClass != null ? sourceClass.getSimpleName() + ".class" : "null") + ')');
}
checkReadabl... | Base | 1 |
public boolean isCorsAccessAllowed(String pOrigin) {
return isAllowed;
} | Compound | 4 |
public JWECryptoParts encrypt(final JWEHeader header, final byte[] clearText)
throws JOSEException {
JWEAlgorithm alg = header.getAlgorithm();
if (! alg.equals(JWEAlgorithm.DIR)) {
throw new JOSEException(AlgorithmSupportMessage.unsupportedJWEAlgorithm(alg, SUPPORTED_ALGORITHMS));
}
// Check key length... | Class | 2 |
public void testQuoteWorkingDirectoryAndExecutable_WDPathWithSingleQuotes_BackslashFileSep()
{
Shell sh = newShell();
sh.setWorkingDirectory( "\\usr\\local\\'something else'" );
sh.setExecutable( "chmod" );
String executable = StringUtils.join( sh.getShellCommandLine( new Strin... | Base | 1 |
private static TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[] {};
}
public void checkClientTrusted(java.security.cert.X509Certificate[... | Base | 1 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteMulParams*>(node->builtin_data);
OpData* data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
const TfLiteTensor* input2 = GetInput(context, nod... | Base | 1 |
MONGO_EXPORT int bson_append_regex( bson *b, const char *name, const char *pattern, const char *opts ) {
const int plen = strlen( pattern )+1;
const int olen = strlen( opts )+1;
if ( bson_append_estart( b, BSON_REGEX, name, plen + olen ) == BSON_ERROR )
return BSON_ERROR;
if ( bson_check_string(... | Base | 1 |
explicit UnravelIndexOp(OpKernelConstruction* ctx) : OpKernel(ctx) {} | Base | 1 |
TfLiteStatus MaxEval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data);
OpData* data = reinterpret_cast<OpData*>(node->user_data);
TfLiteTensor* output = GetOutput(context, node, 0);
const TfLiteTensor* input = GetInput(context, node, 0);
switc... | Base | 1 |
static QSvgNode *createPathNode(QSvgNode *parent,
const QXmlStreamAttributes &attributes,
QSvgHandler *)
{
QStringView data = attributes.value(QLatin1String("d"));
QPainterPath qpath;
qpath.setFillRule(Qt::WindingFill);
//XXX do error hand... | Base | 1 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* data = GetInput(context, node, kInputDataTensor);
const TfLiteTensor* segment_ids =
GetInput(context, node, kInputSegmentIdsTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
if (IsDynamicTensor(output... | Base | 1 |
TfLiteStatus HardSwishEval(TfLiteContext* context, TfLiteNode* node) {
HardSwishData* data = static_cast<HardSwishData*>(node->user_data);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(context, node, 0);
switch (input->type) {
case kTfLiteFloat32: {
if (kern... | Base | 1 |
static int lookup1_values(int entries, int dim)
{
int r = (int) floor(exp((float) log((float) entries) / dim));
if ((int) floor(pow((float) r+1, dim)) <= entries) // (int) cast for MinGW warning;
++r; // floor() to avoid _ftol() when non-CRT
assert(pow((floa... | Base | 1 |
int64_t TensorByteSize(const TensorProto& t) {
// num_elements returns -1 if shape is not fully defined.
int64_t num_elems = TensorShape(t.tensor_shape()).num_elements();
return num_elems < 0 ? -1 : num_elems * DataTypeSize(t.dtype());
} | Base | 1 |
inline void AveragePool(const float* input_data, const Dims<4>& input_dims,
int stride_width, int stride_height, int pad_width,
int pad_height, int kwidth, int kheight,
float output_activation_min,
float output_activation_ma... | Base | 1 |
FdInStream::FdInStream(int fd_, FdInStreamBlockCallback* blockCallback_,
int bufSize_)
: fd(fd_), timeoutms(0), blockCallback(blockCallback_),
timing(false), timeWaitedIn100us(5), timedKbits(0),
bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
{
ptr = end = start = new U8[bu... | Base | 1 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
const TfLiteTensor* multipliers = GetInput(context, node, kInputMultipliers);
if (IsDynamicTensor(output)) {
TF_LI... | Base | 1 |
TEST(ImmutableConstantOpTest, FromFile) {
const TensorShape kFileTensorShape({1000, 1});
Env* env = Env::Default();
auto root = Scope::NewRootScope().ExitOnError();
string two_file, three_file;
TF_ASSERT_OK(CreateTempFile(env, 2.0f, 1000, &two_file));
TF_ASSERT_OK(CreateTempFile(env, 3.0f, 1000, &three_fil... | Base | 1 |
inline int StringData::size() const { return m_len; } | Base | 1 |
static int putint(jas_stream_t *out, int sgnd, int prec, long val)
{
int n;
int c;
bool s;
ulong tmp;
assert((!sgnd && prec >= 1) || (sgnd && prec >= 2));
if (sgnd) {
val = encode_twos_comp(val, prec);
}
assert(val >= 0);
val &= (1 << prec) - 1;
n = (prec + 7) / 8;
while (--n >= 0) {
c = (val >> (n * 8))... | Class | 2 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
if (type == kGenericOptimized) {
optimized_ops::Floor(GetTensorShape(input), GetTensorData<float>(input),
... | Base | 1 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* axis_tensor = GetInput(context, node, kAxisTensor);
int axis = GetTensorData<int32_t>(axis_tensor)[0];
const int rank = NumDimensions(input);
if (axis < 0) {
... | Base | 1 |
bool MemFile::seek(int64_t offset, int whence /* = SEEK_SET */) {
assertx(m_len != -1);
if (whence == SEEK_CUR) {
if (offset > 0 && offset < bufferedLen()) {
setReadPosition(getReadPosition() + offset);
setPosition(getPosition() + offset);
return true;
}
offset += getPosition();
wh... | Base | 1 |
String HHVM_FUNCTION(ldap_escape,
const String& value,
const String& ignores /* = "" */,
int flags /* = 0 */) {
char esc[256] = {};
if (flags & k_LDAP_ESCAPE_FILTER) { // llvm.org/bugs/show_bug.cgi?id=18389
esc['*'*1u] = esc['('*1u] = esc[')'*1u] =... | Base | 1 |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
// Reinterprete the opaque data provided by user.
OpData* data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input1 = GetInput... | Base | 1 |
MONGO_EXPORT int bson_finish( bson *b ) {
int i;
if( b->err & BSON_NOT_UTF8 )
return BSON_ERROR;
if ( ! b->finished ) {
if ( bson_ensure_space( b, 1 ) == BSON_ERROR ) return BSON_ERROR;
bson_append_byte( b, 0 );
i = b->cur - b->data;
bson_little_endian32( b->data, &... | Base | 1 |
void* TFE_HandleToDLPack(TFE_TensorHandle* h, TF_Status* status) {
const Tensor* tensor = GetTensorFromHandle(h, status);
TF_DataType data_type = static_cast<TF_DataType>(tensor->dtype());
TensorReference tensor_ref(*tensor); // This will call buf_->Ref()
auto* tf_dlm_tensor_ctx = new TfDlManagedTensorCtx(ten... | Base | 1 |
void gen_SEK() {
vector<char> errMsg(1024, 0);
int err_status = 0;
vector <uint8_t> encrypted_SEK(1024, 0);
uint32_t enc_len = 0;
SAFE_CHAR_BUF(SEK, 65);
spdlog::info("Generating backup key. Will be stored in backup_key.txt ... ");
sgx_status_t status = trustedGenerateSEK(eid, &err_status... | Base | 1 |
void FormatConverter<T>::Populate(const T* src_data, std::vector<int> indices,
int level, int prev_idx, int* src_data_ptr,
T* dest_data) {
if (level == indices.size()) {
int orig_rank = dense_shape_.size();
std::vector<int> orig_idx;
orig... | Base | 1 |
bool Router::MatchView(const std::string& method, const std::string& url,
bool* stream) {
assert(stream != nullptr);
*stream = false;
for (auto& route : routes_) {
if (std::find(route.methods.begin(), route.methods.end(), method) ==
route.methods.end()) {
continue;
}
... | Base | 1 |
void MainWindow::on_actionUpgrade_triggered()
{
if (Settings.askUpgradeAutmatic()) {
QMessageBox dialog(QMessageBox::Question,
qApp->applicationName(),
tr("Do you want to automatically check for updates in the future?"),
QMessageBox::No |
QMessageBox::Yes,
... | Base | 1 |
int FdInStream::pos()
{
return offset + ptr - start;
} | Base | 1 |
static int StreamTcpTest10 (void)
{
Packet *p = SCMalloc(SIZE_OF_PACKET);
FAIL_IF(unlikely(p == NULL));
Flow f;
ThreadVars tv;
StreamTcpThread stt;
TCPHdr tcph;
uint8_t payload[4];
memset(p, 0, SIZE_OF_PACKET);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset (&f, 0,... | Class | 2 |
inline void StringData::setSize(int len) {
assertx(!isImmutable() && !hasMultipleRefs());
assertx(len >= 0 && len <= capacity());
mutableData()[len] = 0;
m_lenAndHash = len;
assertx(m_hash == 0);
assertx(checkSane());
} | Base | 1 |
TEST_F(QuantizedConv2DTest, Small32Bit) {
const int stride = 1;
TF_ASSERT_OK(NodeDefBuilder("quantized_conv_op", "QuantizedConv2D")
.Input(FakeInput(DT_QUINT8))
.Input(FakeInput(DT_QUINT8))
.Input(FakeInput(DT_FLOAT))
.Input(FakeInput(DT_FL... | Base | 1 |
void readBytes(void* data, int length) {
U8* dataPtr = (U8*)data;
U8* dataEnd = dataPtr + length;
while (dataPtr < dataEnd) {
int n = check(1, dataEnd - dataPtr);
memcpy(dataPtr, ptr, n);
ptr += n;
dataPtr += n;
}
} | Base | 1 |
error_t coapServerFormatReset(CoapServerContext *context, uint16_t mid)
{
CoapMessageHeader *header;
//Point to the CoAP response header
header = (CoapMessageHeader *) context->response.buffer;
//Format Reset message
header->version = COAP_VERSION_1;
header->type = COAP_TYPE_RST;
header->tokenLen... | Class | 2 |
void FrameFactory::rebuildAggregateFrames(ID3v2::Tag *tag) const
{
if(tag->header()->majorVersion() < 4 &&
tag->frameList("TDRC").size() == 1 &&
tag->frameList("TDAT").size() == 1)
{
TextIdentificationFrame *tdrc =
static_cast<TextIdentificationFrame *>(tag->frameList("TDRC").front());
Unkno... | Base | 1 |
void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon const * pInitPoly )
{
//Can't fit this in :-(, throw ?
if (mnPoints + nSpace > USHRT_MAX)
return;
const sal_uInt16 nNewSize = mnPoints + nSpace;
const std::size_t nSpaceSize = static_cast<std::size_t>(nSpace) * si... | Base | 1 |
int TLSInStream::readTLS(U8* buf, int len, bool wait)
{
int n;
n = in->check(1, 1, wait);
if (n == 0)
return 0;
n = gnutls_record_recv(session, (void *) buf, len);
if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN)
return 0;
if (n < 0) throw TLSException("readTLS", n);
return n;
} | Base | 1 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
switch (output->type) {
case kTfLiteFloat32: {
return ReverseSequenceHelper<float>(context, node);
}
case kTfLiteUInt8: {
return ReverseSequenceHelper<uint8_t>(conte... | Base | 1 |
void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0,
int c0, int r1, int c1)
{
int i;
if (mat0->data_) {
if (!(mat0->flags_ & JAS_MATRIX_REF)) {
jas_free(mat0->data_);
}
mat0->data_ = 0;
mat0->datasize_ = 0;
}
if (mat0->rows_) {
jas_free(mat0->rows_);
mat0->rows_ = 0;
}
mat0->... | Class | 2 |
_forceinline void Unpack::CopyString(uint Length,uint Distance)
{
size_t SrcPtr=UnpPtr-Distance;
if (SrcPtr<MaxWinSize-MAX_LZ_MATCH && UnpPtr<MaxWinSize-MAX_LZ_MATCH)
{
// If we are not close to end of window, we do not need to waste time
// to "& MaxWinMask" pointer protection.
byte *Src=Window+SrcP... | Base | 1 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
OpData* data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);
TfLiteTensor* output = GetOutput(context, node, kOut... | Base | 1 |
void Transform::interpolate_nearestneighbour( RawTile& in, unsigned int resampled_width, unsigned int resampled_height ){
// Pointer to input buffer
unsigned char *input = (unsigned char*) in.data;
int channels = in.channels;
unsigned int width = in.width;
unsigned int height = in.height;
// Pointer to o... | Base | 1 |
const std::string& get_id() const {
ceph_assert(t != Wildcard && t != Tenant);
return u.id;
} | Base | 1 |
static TfLiteRegistration DelegateRegistration() {
TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr};
reg.prepare = [](TfLiteContext* context, TfLiteNode* node) {
// If tensors are resized, the runtime should propagate shapes
// automatically if correct flag is set. Ensure values are ... | Base | 1 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
TfLiteTensor* output_values = GetOutput(context, node, kOutputValues);
TfLiteTensor* output_indexes = GetOutput(context, node, kOutputIndexes);
if (IsDynamicTensor(output_values)) {
TF_LITE_ENSURE_OK(context, ResizeOutput(context, node));
}
con... | Base | 1 |
gdImagePtr gdImageCreateTrueColor (int sx, int sy)
{
int i;
gdImagePtr im;
if (overflow2(sx, sy)) {
return NULL;
}
if (overflow2(sizeof(unsigned char *), sy)) {
return NULL;
}
if (overflow2(sizeof(int) + sizeof(unsigned char), sx * sy)) {
return NULL;
}
// Check for OOM before doing a ... | Base | 1 |
int ZlibOutStream::overrun(int itemSize, int nItems)
{
#ifdef ZLIBOUT_DEBUG
vlog.debug("overrun");
#endif
if (itemSize > bufSize)
throw Exception("ZlibOutStream overrun: max itemSize exceeded");
checkCompressionLevel();
while (end - ptr < itemSize) {
zs->next_in = start;
zs->avail_in = ptr - star... | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.