repo_name
stringlengths
6
101
path
stringlengths
4
300
text
stringlengths
7
1.31M
snipextt/Rocket.Chat
client/views/omnichannel/analytics/InterchangeableChart.js
import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; import React, { useRef, useEffect } from 'react'; import { drawLineChart } from '../../../../app/livechat/client/lib/chartHandler'; import { useMethod } from '../../../contexts/ServerContext'; import { useToastMessageDispatch } from '../../../contexts/ToastMessagesContext'; import { useTranslation } from '../../../contexts/TranslationContext'; import Chart from '../realTimeMonitoring/charts/Chart'; const InterchangeableChart = ({ departmentId, dateRange, chartName, ...props }) => { const t = useTranslation(); const dispatchToastMessage = useToastMessageDispatch(); const canvas = useRef(); const context = useRef(); const { start, end } = dateRange; const loadData = useMethod('livechat:getAnalyticsChartData'); const draw = useMutableCallback(async (params) => { try { if (!params?.daterange?.from || !params?.daterange?.to) { return; } const result = await loadData(params); if (!result?.chartLabel || !result?.dataLabels || !result?.dataPoints) { throw new Error( 'Error! fetching chart data. Details: livechat:getAnalyticsChartData => Missing Data', ); } context.current = await drawLineChart( canvas.current, context.current, [result.chartLabel], result.dataLabels, [result.dataPoints], ); } catch (error) { dispatchToastMessage({ type: 'error', message: error }); } }); useEffect(() => { draw({ daterange: { from: start, to: end, }, chartOptions: { name: chartName }, ...(departmentId && { departmentId }), }); }, [chartName, departmentId, draw, end, start, t, loadData]); return <Chart border='none' pi='none' ref={canvas} {...props} />; }; export default InterchangeableChart;
zamorajavi/google-input-tools
client/text_range/text_range_reconvert.cc
<reponame>zamorajavi/google-input-tools /* Copyright 2014 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "text_range/text_range_reconvert.h" #include "base/logging.h" #include "common/debug.h" namespace ime_goopy { static const int kReconvertBufSize = 256; TextRangeReconvert::TextRangeReconvert( TextRangeInterface* text_range, EngineReconvertCallback* engine_reconvert_callback, ContextReconvertCallback* context_reconvert_callback, ShouldReconvertCallback* should_reconvert_callback) : text_range_(text_range), engine_reconvert_callback_(engine_reconvert_callback), context_reconvert_callback_(context_reconvert_callback), should_reconvert_callback_(should_reconvert_callback) { } bool TextRangeReconvert::IsTextCanBeReconverted(const wstring& text) { TextManipulatorEn en_manipulator; TextManipulatorZhCn zh_manipulator; for (int index = 0; index < text.size(); ++index) { if (!en_manipulator.IsValidCharInSentence(text[index])) { if (!zh_manipulator.IsValidCharInSentence(text[index])) { return false; } } } return true; } bool TextRangeReconvert::Reconvert(ReconvertAlignType align_type) { DVLOG(3) << __SHORT_FUNCTION__ << " align_type: " << align_type; // TODO(zengjian): Implement sentense alignment. DCHECK_EQ(ALIGN_TO_WORD, align_type); if (!text_range_) return false; wstring selection_text = text_range_->GetText(); // Check validity of selection text. if (!selection_text.empty() && !IsTextCanBeReconverted(selection_text)) { return false; } int left_offset = 0; int right_offset = 0; scoped_ptr<TextRangeInterface> left_range(text_range_->Clone()); left_range->CollapseToStart(); left_range->ShiftStart(-kReconvertBufSize, NULL); wstring left_text = left_range->GetText(); scoped_ptr<TextRangeInterface> right_range(text_range_->Clone()); right_range->CollapseToEnd(); right_range->ShiftEnd(kReconvertBufSize, NULL); wstring right_text = right_range->GetText(); // Try expanding to an English word. { TextManipulatorEn en_manipulator_; if (selection_text.empty() || en_manipulator_.IsValidCharInWord(selection_text[0])) { left_offset = en_manipulator_.ExpandToWordBegin( left_text, left_text.size()); } if (selection_text.empty() || en_manipulator_.IsValidCharInWord( selection_text[selection_text.length() - 1])) { right_offset = en_manipulator_.ExpandToWordEnd(right_text, 0); } if (left_offset > 0 ) text_range_->ShiftStart(-left_offset, NULL); if (right_offset > 0 ) text_range_->ShiftEnd(right_offset, NULL); } // If empty, try expanding to a Unicode word. if (text_range_->IsEmpty()) { DCHECK_EQ(0, left_offset); DCHECK_EQ(0, right_offset); TextManipulatorZhCn zh_manipulator_; left_offset = zh_manipulator_.ExpandToWordBegin( left_text, left_text.size()); right_offset = zh_manipulator_.ExpandToWordEnd(right_text, 0); text_range_->ShiftStart(-left_offset, NULL); text_range_->ShiftEnd(right_offset, NULL); } wstring text = text_range_->GetText(); DVLOG(3) << __SHORT_FUNCTION__ << L"range->GetText: " << text; DVLOG(3) << __SHORT_FUNCTION__ << L"left_offset: " << left_offset; if (should_reconvert_callback_ && !should_reconvert_callback_->Run(text)) { // Should delete callbacks that are not invoked. if (context_reconvert_callback_ && !context_reconvert_callback_->IsRepeatable()) { delete context_reconvert_callback_; } if (engine_reconvert_callback_ && !engine_reconvert_callback_->IsRepeatable()) { delete engine_reconvert_callback_; } return false; } if (context_reconvert_callback_) context_reconvert_callback_->Run(); if (engine_reconvert_callback_) engine_reconvert_callback_->Run(text, left_offset); return true; } } // namespace ime_goopy
Evangelize/classes
dev/getLastWednesdayInQtr.js
var moment = require('moment-timezone'), beginYear = 2015, beginYearMonth = 8, lengthDivision = 3, currentQtr = 3, day = moment() .year(2015) .month(beginYearMonth + (lengthDivision*(currentQtr - 1))) .add(2, 'month') .endOf('month'); result = day; while (result.day() !== 3) { result.subtract(1, 'day'); } //console.log(result.format());
jwhitfieldseed/advent-of-code
2015/5b.js
function hasRepeatingPair(s) { for (let i = 0; i < s.length - 2; i ++) { const pair = s.slice(i, i + 2); if (s.lastIndexOf(pair) >= i + 2) { return true; } } return false; } function hasSplitPair(s) { for (let i = 0; i < s.length - 2; i ++) { if (s[i] === s[i + 2]) { return true; } } return false; } let matches = input.split("\n") .filter(s => hasRepeatingPair(s) && hasSplitPair(s)); console.log(matches.length);
pirocorp/JS-Advanced
07. JQUERY/Exercises/07. Calendar/calendar.js
<filename>07. JQUERY/Exercises/07. Calendar/calendar.js function calendar(inputDate) { let [day, month, year] = inputDate; const currentDate = new Date(year, month - 1, day); const selector = '#content'; var days = [6, 0, 1, 2, 3, 4, 5]; const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; const currentMonthIndex = currentDate.getMonth(); const currentMonthFullName = monthNames[currentDate.getMonth()]; const currentYear = currentDate.getFullYear(); const $calendar = $('<table>') .append($('<caption>') .text(`${currentMonthFullName} ${currentYear}`)) .append($('<tbody>') .append($('<tr>') .append($('<th>').text('Mon')) .append($('<th>').text('Tue')) .append($('<th>').text('Wed')) .append($('<th>').text('Thu')) .append($('<th>').text('Fri')) .append($('<th>').text('Sat')) .append($('<th>').text('Sun')) ) ) .appendTo($(selector)); const calendarDate = new Date(currentYear, currentMonthIndex, 1); let isNewWeek = true; let $currentWeek; while(calendarDate.getMonth() === currentMonthIndex) { const dayOfWeek = days[calendarDate.getDay()]; if(dayOfWeek === 0) { isNewWeek = true; } if(isNewWeek) { isNewWeek = false; $currentWeek = $('<tr>') .append($('<td>')) .append($('<td>')) .append($('<td>')) .append($('<td>')) .append($('<td>')) .append($('<td>')) .append($('<td>')) .appendTo($calendar); } $currentWeek.find('td')[dayOfWeek].textContent = calendarDate.getDate(); if (calendarDate.getDate() === currentDate.getDate()) { $($currentWeek.find('td')[dayOfWeek]) .addClass('today'); } calendarDate.setDate(calendarDate.getDate() + 1); } }
ShawnSunVip/xlite-separation
xlite-base-support/xlite-system/src/main/java/com/kedacom/xlite/sys/core/listener/ConstantsInitListener.java
<filename>xlite-base-support/xlite-system/src/main/java/com/kedacom/xlite/sys/core/listener/ConstantsInitListener.java package com.kedacom.xlite.sys.core.listener; import cn.hutool.core.util.ObjectUtil; import cn.hutool.db.DbUtil; import cn.hutool.db.Entity; import cn.hutool.db.handler.EntityListHandler; import cn.hutool.db.sql.SqlExecutor; import cn.hutool.log.Log; import com.kedacom.xlite.core.context.constant.ConstantContext; import com.kedacom.xlite.core.enums.CommonStatusEnum; import com.kedacom.xlite.core.exception.ServiceException; import com.kedacom.xlite.sys.modular.consts.enums.SysConfigExceptionEnum; import org.springframework.boot.context.event.ApplicationContextInitializedEvent; import org.springframework.context.ApplicationListener; import org.springframework.core.Ordered; import org.springframework.core.env.ConfigurableEnvironment; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.List; /** * 初始化常量的监听器 * <p> * 当spring装配好配置后,就去数据库读constants * * @author nixiaohan * @date 2020/6/6 23:39 */ public class ConstantsInitListener implements ApplicationListener<ApplicationContextInitializedEvent>, Ordered { private static final Log log = Log.get(); private static final String CONFIG_LIST_SQL = "select code,value from sys_config where status = ?"; @Override public int getOrder() { return Ordered.HIGHEST_PRECEDENCE; } @Override public void onApplicationEvent(ApplicationContextInitializedEvent applicationContextInitializedEvent) { ConfigurableEnvironment environment = applicationContextInitializedEvent.getApplicationContext().getEnvironment(); // 获取数据库连接配置 String dataSourceUrl = environment.getProperty("spring.datasource.url"); String dataSourceUsername = environment.getProperty("spring.datasource.username"); String dataSourcePassword = environment.getProperty("spring.datasource.password"); // 如果有为空的配置,终止执行 if (ObjectUtil.hasEmpty(dataSourceUrl, dataSourceUsername, dataSourcePassword)) { throw new ServiceException(SysConfigExceptionEnum.DATA_SOURCE_NOT_EXIST); } Connection conn = null; try { Class.forName("com.mysql.cj.jdbc.Driver"); assert dataSourceUrl != null; conn = DriverManager.getConnection(dataSourceUrl, dataSourceUsername, dataSourcePassword); // 获取sys_config表的数据 List<Entity> entityList = SqlExecutor.query(conn, CONFIG_LIST_SQL, new EntityListHandler(), CommonStatusEnum.ENABLE.getCode()); // 将查询到的参数配置添加到缓存 if (ObjectUtil.isNotEmpty(entityList)) { entityList.forEach(sysConfig -> ConstantContext.putConstant(sysConfig.getStr("code"), sysConfig.getStr("value"))); } } catch (SQLException | ClassNotFoundException e) { log.error(">>> 读取数据库constants配置信息出错:{}", e.getMessage()); throw new ServiceException(SysConfigExceptionEnum.DATA_SOURCE_NOT_EXIST); } finally { DbUtil.close(conn); } } }
onigoetz/swagger-doclet
swagger-doclet/src/main/java/com/tenxerconsulting/swagger/doclet/json/MapperModule.java
<reponame>onigoetz/swagger-doclet package com.tenxerconsulting.swagger.doclet.json; import com.fasterxml.jackson.databind.module.SimpleModule; import io.swagger.oas.models.media.Schema; import io.swagger.oas.models.parameters.Parameter; public class MapperModule extends SimpleModule { public MapperModule() { super(); this.addDeserializer(Parameter.class, new ParameterDeserializer()); this.addDeserializer(Schema.class, new SchemaDeserializer()); } }
alipay/Antchain-MPC
morse-stf/unittest/test_NN.py
<gh_stars>10-100 import unittest from stensorflow.ml.nn.networks.DNN_with_SL import DNN_with_SL2, DNN_with_SL from stensorflow.ml.nn.networks.DNN import DNN import tensorflow as tf from stensorflow.basic.basic_class.private import PrivateTensor import time from stensorflow.engine.start_server import start_local_server import os stf_home = os.environ.get("stf_home", "..") start_local_server(os.path.join(stf_home, "conf", "config.json")) predict_file_name = "/dev/null" class MyTestCase(unittest.TestCase): def setUp(self): self.sess = tf.compat.v1.Session("grpc://0.0.0.0:8887") def tearDown(self): self.sess.close() def test_DNN_train_and_predict_secure_level2(self): featureNumL = 5 featureNumR = 5 record_num = 6 epoch = 1 batch_size = 3 l2_regularization = 0.0 batch_num_per_epoch = record_num // batch_size train_batch_num = epoch * batch_num_per_epoch + 1 learning_rate = 0.01 xL_train = PrivateTensor(owner='L') xyR_train = PrivateTensor(owner='R') xL_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumL])) xyR_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumR + 1])) xR_train, y_train = xyR_train.split(size_splits=[featureNumR, 1], axis=1) num_features = featureNumL + featureNumR model = DNN_with_SL2(feature=xL_train, label=y_train, dense_dims=[num_features, 3, 3, 1], feature_another=xR_train, secure_config=[2, 1, 1]) model.compile() start_time = time.time() model.train_sgd(learning_rate=learning_rate, batch_num=train_batch_num, l2_regularization=l2_regularization, sess=self.sess) end_time = time.time() print("train time=", end_time - start_time) xL_test = PrivateTensor(owner='L') xRy_test = PrivateTensor(owner='R') xL_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumL])) id = xRy_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumR + 1])) xR_test, y_test = xRy_test.split(size_splits=[-1, 1], axis=1) model.predict_to_file(self.sess, x=xL_test, x_another=xR_test, predict_file_name=predict_file_name, batch_num=1, idx=id, model_file_machine='R', record_num_ceil_mod_batch_size=3) def test_DNN_train_and_predict_secure_level(self): featureNumX = 5 featureNumY = 0 record_num = 6 epoch = 1 batch_size = 3 learning_rate = 0.01 l2_regularization = 0.0 train_batch_num = epoch * record_num // batch_size + 1 x_train = PrivateTensor(owner='L') y_train = PrivateTensor(owner='R') x_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumX])) y_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumY + 1])) num_features = featureNumX + featureNumY model = DNN_with_SL(feature=x_train, label=y_train, dense_dims=[num_features, 3, 3, 1], secure_config=[1, 2, 1]) model.compile() start_time = time.time() model.train_sgd(learning_rate=learning_rate, batch_num=train_batch_num, l2_regularization=l2_regularization, sess=self.sess) end_time = time.time() print("train time=", end_time - start_time) x_test = PrivateTensor(owner='L') y_test = PrivateTensor(owner='R') x_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumX])) id = y_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumY + 1])) model.predict_to_file(self.sess, x_test, predict_file_name, batch_num=1, idx=id, model_file_machine='R', record_num_ceil_mod_batch_size=3) def test_DNN_train_and_predict(self): featureNumX = 5 featureNumY = 0 record_num = 6 epoch = 1 batch_size = 3 learning_rate = 0.01 l2_regularization = 0.0 train_batch_num = epoch * record_num // batch_size + 1 x_train = PrivateTensor(owner='L') y_train = PrivateTensor(owner='R') x_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumX])) y_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumY + 1])) num_features = featureNumX + featureNumY model = DNN(feature=x_train, label=y_train, dense_dims=[num_features, 3, 3, 1]) model.compile() start_time = time.time() model.train_sgd(learning_rate=learning_rate, batch_num=train_batch_num, l2_regularization=l2_regularization, sess=self.sess) end_time = time.time() print("train time=", end_time - start_time) x_test = PrivateTensor(owner='L') y_test = PrivateTensor(owner='R') x_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumX])) id = y_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumY + 1])) model.predict_to_file(self.sess, x_test, predict_file_name, batch_num=1, idx=id, model_file_machine='R', record_num_ceil_mod_batch_size=3) def test_DNN_train_and_predict2(self): featureNumL= 5 featureNumR = 5 record_num = 6 epoch = 1 batch_size = 3 l2_regularization = 0.0 batch_num_per_epoch = record_num // batch_size train_batch_num = epoch * batch_num_per_epoch + 1 learning_rate = 0.01 xL_train = PrivateTensor(owner='L') xyR_train = PrivateTensor(owner='R') xL_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumL])) xyR_train.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumR + 1])) xR_train, y_train = xyR_train.split(size_splits=[featureNumR, 1], axis=1) num_features = featureNumL + featureNumR model = DNN(feature=xL_train, label=y_train, dense_dims=[num_features, 3, 3, 1], feature_another=xR_train) model.compile() start_time = time.time() model.train_sgd(learning_rate=learning_rate, batch_num=train_batch_num, l2_regularization=l2_regularization, sess=self.sess) end_time = time.time() print("train time=", end_time - start_time) xL_test = PrivateTensor(owner='L') xRy_test = PrivateTensor(owner='R') xL_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumL])) id = xRy_test.load_from_tf_tensor(tf.random.normal(shape=[batch_size, featureNumR + 1])) xR_test, y_test = xRy_test.split(size_splits=[-1, 1], axis=1) model.predict_to_file(self.sess, xL_test, predict_file_name, x_another=xR_test, batch_num=1, idx=id, model_file_machine='R', record_num_ceil_mod_batch_size=3) if __name__ == '__main__': unittest.main()
jpchagas/hfa3
hellfireos-master/app/ramdisk/ramdisk_test.c
#include <hellfire.h> #include <device.h> #include <block.h> #include <ramdisk.h> #include <uhfs.h> void app_main(void){ struct device ramdisk0 = {ramdisk_open, ramdisk_read, ramdisk_write, ramdisk_close, ramdisk_ioctl, 0}; struct blk_info ramdisk0info; struct file *fptr; struct fs_direntry direntry; int8_t str[30]; hf_dev_ioctl(&ramdisk0, DISK_INIT, (void *)50); hf_dev_ioctl(&ramdisk0, DISK_GETINFO, (void *)&ramdisk0info); hf_mkfs(&ramdisk0, ramdisk0info.bytes_sector); hf_mount(&ramdisk0); hf_getlabel(&ramdisk0, str); printf("\nfreeblks: %d, label: %s", hf_getfree(&ramdisk0), str); hf_mkdir(&ramdisk0, "/root"); /* hf_mkdir(&ramdisk0, "/root/coisa"); hf_mkdir(&ramdisk0, "/root/cao"); hf_mkdir(&ramdisk0, "/root/mu"); hf_mkdir(&ramdisk0, "/root/mu2"); hf_mkdir(&ramdisk0, "/root/mu3"); hf_mkdir(&ramdisk0, "/root/mu4"); hf_mkdir(&ramdisk0, "/root/mu5"); hf_mkdir(&ramdisk0, "/root/coisa/abcdef"); hf_mkdir(&ramdisk0, "/root/coisa/fedcba"); hf_mkdir(&ramdisk0, "/root/coisa/abcdef/22"); hf_mkdir(&ramdisk0, "/root/coisa/abcdef/22/uuuuuuu"); hf_mkdir(&ramdisk0, "/root/coisa/fedcba/uuuuuuu"); hf_mkdir(&ramdisk0, "/root/coisa/fedcba/uuuuuuu/33"); hf_mkdir(&ramdisk0, "/root/mu/oper"); hf_mkdir(&ramdisk0, "/root/mu5/1"); hf_mkdir(&ramdisk0, "/root/mu5/2"); hf_mkdir(&ramdisk0, "/root/mu5/3"); hf_mkdir(&ramdisk0, "/root/mu5/4"); hf_mkdir(&ramdisk0, "/root/mu5/5"); hf_mkdir(&ramdisk0, "/root/mu5/3/1"); hf_mkdir(&ramdisk0, "/root/mu5/3/2"); hf_mkdir(&ramdisk0, "/root/mu5/3/3"); hf_mkdir(&ramdisk0, "/root/mu5/3/4"); hf_mkdir(&ramdisk0, "/root/mu5/3/5"); hf_mkdir(&ramdisk0, "/root/mu5/3/1/0"); hf_mkdir(&ramdisk0, "/root/mu5/3/5/666"); hf_mkdir(&ramdisk0, "/root/mu/12345678"); hf_mkdir(&ramdisk0, "/root/mu/12345678/111"); hf_mkdir(&ramdisk0, "/root/les"); hf_mkdir(&ramdisk0, "/root/les2"); hf_mkdir(&ramdisk0, "/root/les3"); hf_mkdir(&ramdisk0, "/root/les4"); hf_mkdir(&ramdisk0, "/root/les5"); fptr = hf_opendir(&ramdisk0, "/root/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); } hf_closedir(fptr); fptr = hf_opendir(&ramdisk0, "/root/coisa/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); } hf_closedir(fptr); fptr = hf_opendir(&ramdisk0, "/root/mu5/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); } hf_closedir(fptr); fptr = hf_opendir(&ramdisk0, "/root/coisa/abcdef/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); } hf_closedir(fptr); fptr = hf_opendir(&ramdisk0, "/root/mu5/3/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); } hf_closedir(fptr); hf_rmdir(&ramdisk0, "/root/mu5/3/5/666/."); hf_rmdir(&ramdisk0, "/root/mu5/3/1/0/."); hf_rmdir(&ramdisk0, "/root/mu5/3/5/."); hf_rmdir(&ramdisk0, "/root/mu5/3/4/."); hf_rmdir(&ramdisk0, "/root/mu5/3/3/."); hf_rmdir(&ramdisk0, "/root/mu5/3/2/."); hf_rmdir(&ramdisk0, "/root/mu5/3/1/."); hf_rmdir(&ramdisk0, "/root/mu5/5/."); hf_rmdir(&ramdisk0, "/root/mu5/4/."); hf_rmdir(&ramdisk0, "/root/mu5/3/."); hf_rmdir(&ramdisk0, "/root/mu5/2/."); hf_rmdir(&ramdisk0, "/root/mu5/1/."); hf_rmdir(&ramdisk0, "/root/mu/12345678/111/."); hf_rmdir(&ramdisk0, "/root/mu/12345678/."); hf_rmdir(&ramdisk0, "/root/coisa/abcdef/22/uuuuuuu/."); hf_rmdir(&ramdisk0, "/root/coisa/abcdef/22/."); hf_rmdir(&ramdisk0, "/root/coisa/fedcba/uuuuuuu/33/."); hf_rmdir(&ramdisk0, "/root/coisa/fedcba/uuuuuuu/."); hf_rmdir(&ramdisk0, "/root/coisa/abcdef/."); hf_rmdir(&ramdisk0, "/root/coisa/fedcba/."); hf_rmdir(&ramdisk0, "/root/coisa/."); hf_rmdir(&ramdisk0, "/root/cao/."); hf_rmdir(&ramdisk0, "/root/mu/oper/."); hf_rmdir(&ramdisk0, "/root/mu/."); hf_rmdir(&ramdisk0, "/root/mu2/."); hf_rmdir(&ramdisk0, "/root/mu3/."); hf_rmdir(&ramdisk0, "/root/mu4/."); hf_rmdir(&ramdisk0, "/root/mu5/."); hf_rmdir(&ramdisk0, "/root/les/."); hf_rmdir(&ramdisk0, "/root/les2/."); hf_rmdir(&ramdisk0, "/root/les3/."); hf_rmdir(&ramdisk0, "/root/les4/."); hf_rmdir(&ramdisk0, "/root/les5/."); fptr = hf_opendir(&ramdisk0, "/root/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); if (direntry.attributes & UHFS_ATTRFREE) printf("*"); } hf_closedir(fptr); hf_rmdir(&ramdisk0, "/root/."); hf_mkdir(&ramdisk0, "/root"); */ hf_create(&ramdisk0, "/root/pig"); hf_create(&ramdisk0, "/root/pig2"); hf_create(&ramdisk0, "/root/pig3"); hf_unlink(&ramdisk0, "/root/pig2"); printf("\nsize %d", hf_size(&ramdisk0, "/root/pig")); fptr = hf_opendir(&ramdisk0, "/root/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); } hf_closedir(fptr); hf_rename(&ramdisk0, "/root/pig", "pig1"); fptr = hf_opendir(&ramdisk0, "/root/."); while (!hf_readdir(fptr, &direntry)){ printf("\nfile: %s", direntry.filename); if (direntry.attributes & UHFS_ATTRFREE) putchar('*'); } hf_closedir(fptr); printf("\nfreeblks: %d, label: %s", hf_getfree(&ramdisk0), str); hf_umount(&ramdisk0); hf_dev_ioctl(&ramdisk0, DISK_FINISH, 0); }
Earthcomputer/mutliconnect
src/main/java/net/earthcomputer/multiconnect/mixin/bridge/MixinDecoderHandler.java
package net.earthcomputer.multiconnect.mixin.bridge; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.earthcomputer.multiconnect.impl.PacketSystem; import net.minecraft.network.DecoderHandler; import net.minecraft.network.Packet; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.List; @Mixin(DecoderHandler.class) public class MixinDecoderHandler { @Inject(method = "decode", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", shift = At.Shift.AFTER, remap = false)) private void onAddPacket(ChannelHandlerContext ctx, ByteBuf buf, List<Object> outPackets, CallbackInfo ci) { PacketSystem.Internals.setUserData((Packet<?>) outPackets.get(outPackets.size() - 1), PacketSystem.Internals.getUserData(buf)); } }
laipaang/Paddle
python/paddle/fluid/tests/unittests/test_data.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function import unittest import paddle.fluid as fluid import paddle.fluid.layers as layers from paddle.fluid import Program, program_guard class TestApiDataError(unittest.TestCase): def test_fluid_data(self): with program_guard(Program(), Program()): # 1. The type of 'name' in fluid.data must be str. def test_name_type(): fluid.data(name=1, shape=[2, 25], dtype="bool") self.assertRaises(TypeError, test_name_type) # 2. The type of 'shape' in fluid.data must be list or tuple. def test_shape_type(): fluid.data(name='data1', shape=2, dtype="bool") self.assertRaises(TypeError, test_shape_type) def test_layers_data(self): with program_guard(Program(), Program()): # 1. The type of 'name' in layers.data must be str. def test_name_type(): layers.data(name=1, shape=[2, 25], dtype="bool") self.assertRaises(TypeError, test_name_type) # 2. The type of 'shape' in layers.data must be list or tuple. def test_shape_type(): layers.data(name='data1', shape=2, dtype="bool") self.assertRaises(TypeError, test_shape_type) if __name__ == "__main__": unittest.main()
embeddery/stackrox
central/vulnerabilityrequest/suppressor/singleton.go
package suppressor import ( "github.com/stackrox/rox/central/vulnerabilityrequest/cache" "github.com/stackrox/rox/pkg/sync" ) var ( once sync.Once instance CVESuppressor ) func initialize() { instance = New(cache.ActiveReqsCacheSingleton()) } // Singleton provides the instance of CVESuppressor to use. func Singleton() CVESuppressor { once.Do(initialize) return instance } // New returns an initialized cve suppressor. func New(cache cache.VulnReqCache) CVESuppressor { return &cveSuppressorImpl{ cache: cache, } }
vesor/bayes-filters-lib
src/BayesFilters/src/SIS.cpp
<filename>src/BayesFilters/src/SIS.cpp<gh_stars>1-10 /* * Copyright (C) 2016-2019 Istituto Italiano di Tecnologia (IIT) * * This software may be modified and distributed under the terms of the * BSD 3-Clause license. See the accompanying LICENSE file for details. */ #include <BayesFilters/SIS.h> #include <BayesFilters/utils.h> #include <fstream> #include <iostream> #include <utility> #include <Eigen/Dense> using namespace bfl; using namespace Eigen; SIS::SIS ( unsigned int num_particle, std::size_t state_size_linear, std::size_t state_size_circular, std::unique_ptr<ParticleSetInitialization> initialization, std::unique_ptr<PFPrediction> prediction, std::unique_ptr<PFCorrection> correction, std::unique_ptr<Resampling> resampling ) noexcept : ParticleFilter(std::move(initialization), std::move(prediction), std::move(correction), std::move(resampling)), num_particle_(num_particle), state_size_(state_size_linear + state_size_circular), pred_particle_(num_particle_, state_size_linear, state_size_circular), cor_particle_(num_particle_, state_size_linear, state_size_circular) { } SIS::SIS ( unsigned int num_particle, std::size_t state_size_linear, std::unique_ptr<ParticleSetInitialization> initialization, std::unique_ptr<PFPrediction> prediction, std::unique_ptr<PFCorrection> correction, std::unique_ptr<Resampling> resampling ) noexcept : SIS(num_particle, state_size_linear, 0, std::move(initialization), std::move(prediction), std::move(correction), std::move(resampling)) { } SIS::~SIS() noexcept { } SIS::SIS(SIS&& sir_pf) noexcept : ParticleFilter(std::move(sir_pf)), pred_particle_(std::move(sir_pf.pred_particle_)), cor_particle_(std::move(sir_pf.cor_particle_)), num_particle_(sir_pf.num_particle_), state_size_(sir_pf.state_size_) { } SIS& SIS::operator=(SIS&& sir_pf) noexcept { ParticleFilter::operator=(std::move(sir_pf)); num_particle_ = sir_pf.num_particle_; state_size_ = sir_pf.state_size_; pred_particle_ = std::move(sir_pf.pred_particle_); cor_particle_ = std::move(sir_pf.cor_particle_); return *this; } bool SIS::initialization() { return initialization_->initialize(pred_particle_); } void SIS::filteringStep() { if (getFilteringStep() != 0) prediction_->predict(cor_particle_, pred_particle_); correction_->correct(pred_particle_, cor_particle_); /* Normalize weights using LogSumExp. */ cor_particle_.weight().array() -= utils::log_sum_exp(cor_particle_.weight()); log(); if (resampling_->neff(cor_particle_.weight()) < static_cast<double>(num_particle_)/3.0) { ParticleSet res_particle(num_particle_, state_size_); VectorXi res_parent(num_particle_, 1); resampling_->resample(cor_particle_, res_particle, res_parent); cor_particle_ = res_particle; } } bool SIS::runCondition() { return true; } void SIS::log() { logger(pred_particle_.state().transpose(), pred_particle_.weight().transpose(), cor_particle_.state().transpose(), cor_particle_.weight().transpose()); }
riteshrao/dtdl-go
parser/parser_test.go
<reponame>riteshrao/dtdl-go package parser import ( "testing" "github.com/riteshrao/dtdl-go/model" "github.com/stretchr/testify/assert" ) func TestParseSingleInterface(t *testing.T) { a := assert.New(t) p := NewModelParser() p.Parse([]byte(` { "@context": "dtmi:dtdl:context;2", "@id": "dtmi:interface;1", "@type": "Interface", "displayName": "Test Interface", "description": "Test Interface", "comment": "Test Interface", "contents": [ { "@type": "Command", "name": "reboot", "displayName": "Reboot", "request": { "name": "delay", "displayName": "Delay", "schema": "double" }, "response": { "name": "status", "displayName": "Status", "schema": "string" } } ] } `)) i, ok := p.GetInterface("dtmi:interface;1") a.True(ok) a.IsType(&model.Interface{}, i) a.Equal("Test Interface", i.DisplayName()) a.Equal("Test Interface", i.Description()) a.Equal("Test Interface", i.Comment()) a.Equal(1, len(i.Contents())) cmd, ok := i.Contents()[0].(*model.Command) a.True(ok) a.Equal("reboot", cmd.Name()) a.Equal("Reboot", cmd.DisplayName()) a.Equal("delay", cmd.Request().Name()) a.Equal("Delay", cmd.Request().DisplayName()) a.Equal(model.DoubleSchema, cmd.Request().Schema()) a.Equal("status", cmd.Response().Name()) a.Equal("Status", cmd.Response().DisplayName()) a.Equal(model.StringSchema, cmd.Response().Schema()) } func TestParseMultipleInterface(t *testing.T) { a := assert.New(t) p := NewModelParser() err := p.Parse([]byte(` [ { "@context": "dtmi:dtdl:context;2", "@id": "dtmi:interface;1", "@type": "Interface", "displayName": "Test Interface", "description": "Test Interface", "comment": "Test Interface", "extends": ["dtmi:shared;1"], "contents": [ { "@type": "Telemetry", "name": "reboot", "displayName": "Reboot", "schema": "double" } ] }, { "@context": "dtmi:dtdl:context;2", "@id": "dtmi:shared;1", "@type": "Interface", "displayName": "Shared Interface", "description": "Shared Interface", "contents": [ { "@type": "Property", "name": "enabled", "displayName": "Enabled", "schema": "boolean" } ] } ] `)) a.Nil(err) root, ok := p.GetInterface("dtmi:interface;1") a.True(ok) shared, ok := p.GetInterface("dtmi:shared;1") a.True(ok) a.Same(shared, root.Extends()[0]) } func TestParseMultiContext(t *testing.T) { a := assert.New(t) p := NewModelParser() err := p.Parse([]byte(` { "@context": ["dtmi:dtdl:context;2", "dtmi:iotcentral:context;2"], "@id": "dtmi:interface;1", "@type": "Interface", "displayName": "Test Interface", "description": "Test Interface", "comment": "Test Interface", "contents": [ { "@type": "Command", "name": "reboot", "displayName": "Reboot", "request": { "name": "delay", "displayName": "Delay", "schema": "double" }, "response": { "name": "status", "displayName": "Status", "schema": "string" } } ] } `)) a.Nil(err) i, ok := p.GetInterface("dtmi:interface;1") a.True(ok) a.IsType(&model.Interface{}, i) a.Equal("Test Interface", i.DisplayName()) a.Equal("Test Interface", i.Description()) a.Equal("Test Interface", i.Comment()) a.Equal(1, len(i.Contents())) cmd, ok := i.Contents()[0].(*model.Command) a.True(ok) a.Equal("reboot", cmd.Name()) a.Equal("Reboot", cmd.DisplayName()) a.Equal("delay", cmd.Request().Name()) a.Equal("Delay", cmd.Request().DisplayName()) a.Equal(model.DoubleSchema, cmd.Request().Schema()) a.Equal("status", cmd.Response().Name()) a.Equal("Status", cmd.Response().DisplayName()) a.Equal(model.StringSchema, cmd.Response().Schema()) }
ciren/benchmarks
src/test/scala/benchmarks/syntax/SyntaxTests.scala
<reponame>ciren/benchmarks // package benchmarks // package syntax // import org.scalacheck._ // import org.scalacheck.Prop._ // import benchmarks.implicits._ // object SyntaxTests extends Properties("Syntax Tests") { // val doubleGen = Gen.choose(-1000.0, 1000.0) // val gen = Gen.listOf(doubleGen) // property("List mapSum") = forAll(gen) { a => // a.mapSum(_ * 1.0) === a.sum && // a.mapSum(_ * 2.0) === a.map(_ * 2.0).sum && // a.mapSum(_ * 0.0) === 0.0 // } // property("List mapProduct") = forAll(gen) { a => // a.mapProduct(_ * 1.0) === a.product && // a.mapProduct(_ * 2.0) === a.map(_ * 2.0).product && // a.mapProduct(ai => 1.0) === 1.0 // } // }
gridgentoo/ServiceFabricAzure
src/prod/src/data/integration/FactoryArgument.Test.cpp
<reponame>gridgentoo/ServiceFabricAzure // ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #include "stdafx.h" #include <stdlib.h> #include <boost/test/unit_test.hpp> #include "Common/boost-taef.h" namespace Data { namespace Integration { using namespace Common; using namespace ktl; using namespace Data::Utilities; using namespace TxnReplicator; using namespace TxnReplicator::TestCommon; StringLiteral const TraceComponent("BackupTests"); std::wstring const TestLogFileName(L"ComTransactionalReplicatorTest.log"); class FactoryArgumentTests { public: Awaitable<void> Test_FactoryArgument_PartitionId_ReplicaId( __in wstring const & workFolder, __in Data::Log::LogManager & logManager); protected: wstring CreateFileName( __in wstring const & folderName); void InitializeKtlConfig( __in std::wstring workDir, __in std::wstring fileName, __in KAllocator & allocator, __out KtlLogger::SharedLogSettingsSPtr & sharedLogSettings); KUri::CSPtr GetStateProviderName( __in int stateProviderIndex); void EndTest(); CommonConfig config; // load the config object as its needed for the tracing to work KtlSystem * underlyingSystem_; KGuid pId_; FABRIC_REPLICA_ID rId_; PartitionedReplicaId::SPtr prId_; }; Awaitable<void> FactoryArgumentTests::Test_FactoryArgument_PartitionId_ReplicaId( __in wstring const & testFolder, __in Data::Log::LogManager & logManager) { NTSTATUS status = STATUS_UNSUCCESSFUL; TxnReplicator::TestCommon::TestStateProviderFactory::SPtr stateProviderFactory = TxnReplicator::TestCommon::TestStateProviderFactory::Create(underlyingSystem_->PagedAllocator()); Replica::SPtr replica = Replica::Create( pId_, rId_, testFolder, logManager, underlyingSystem_->PagedAllocator(), stateProviderFactory.RawPtr()); co_await replica->OpenAsync(); FABRIC_EPOCH epoch1; epoch1.DataLossNumber = 1; epoch1.ConfigurationNumber = 1; epoch1.Reserved = nullptr; co_await replica->ChangeRoleAsync(epoch1, FABRIC_REPLICA_ROLE_PRIMARY); replica->SetReadStatus(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_GRANTED); replica->SetWriteStatus(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_GRANTED); KUri::CSPtr stateProviderName = GetStateProviderName(0); KStringView typeName( (PWCHAR)TestStateProvider::TypeName.cbegin(), (ULONG)TestStateProvider::TypeName.size() + 1, (ULONG)TestStateProvider::TypeName.size()); { Transaction::SPtr txn; replica->TxnReplicator->CreateTransaction(txn); KFinally([&] {txn->Dispose(); }); status = co_await replica->TxnReplicator->AddAsync( *txn, *stateProviderName, typeName); VERIFY_IS_TRUE(NT_SUCCESS(status)); co_await txn->CommitAsync(); } IStateProvider2::SPtr stateProvider; status = replica->TxnReplicator->Get(*stateProviderName, stateProvider); VERIFY_IS_TRUE(NT_SUCCESS(status)); VERIFY_IS_NOT_NULL(stateProvider); VERIFY_ARE_EQUAL(*stateProviderName, stateProvider->GetName()); TxnReplicator::TestCommon::TestStateProvider & testStateProvider = dynamic_cast<TxnReplicator::TestCommon::TestStateProvider &>(*stateProvider); // Verify the partitionId and replicaId are correctly passed in. VERIFY_IS_TRUE(pId_ == testStateProvider.PartitionId); VERIFY_IS_TRUE(rId_ == testStateProvider.ReplicaId); // Verify the correctness of passing StateProviderId through FactoryArgument. // Test in this way because if StateProviderId is not passing to the state provider and the state provider // get a random id, MetadataManager and StateProvider will get different Ids, thus the // state provider will not be registered and will throw. FABRIC_STATE_PROVIDER_ID stateProviderId = testStateProvider.StateProviderId; try { THROW_ON_FAILURE(replica->TxnReplicator->ErrorIfStateProviderIsNotRegistered(stateProviderId, 1)); } catch (Exception &) { CODING_ERROR_ASSERT(false); } replica->SetReadStatus(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_NOT_PRIMARY); replica->SetWriteStatus(FABRIC_SERVICE_PARTITION_ACCESS_STATUS_NOT_PRIMARY); co_await replica->CloseAsync(); co_return; } wstring FactoryArgumentTests::CreateFileName( __in wstring const & folderName) { wstring testFolderPath = Directory::GetCurrentDirectoryW(); Path::CombineInPlace(testFolderPath, folderName); return testFolderPath; } void FactoryArgumentTests::EndTest() { prId_.Reset(); } void FactoryArgumentTests::InitializeKtlConfig( __in std::wstring workDir, __in std::wstring fileName, __in KAllocator & allocator, __out KtlLogger::SharedLogSettingsSPtr & sharedLogSettings) { auto settings = std::make_unique<KtlLogManager::SharedLogContainerSettings>(); KString::SPtr sharedLogFileName = KPath::CreatePath(workDir.c_str(), allocator); KPath::CombineInPlace(*sharedLogFileName, fileName.c_str()); if (!Common::Directory::Exists(workDir)) { Common::Directory::Create(workDir); } KInvariant(sharedLogFileName->LengthInBytes() + sizeof(WCHAR) < 512 * sizeof(WCHAR)); // check to make sure there is space for the null terminator KMemCpySafe(&settings->Path[0], 512 * sizeof(WCHAR), sharedLogFileName->operator PVOID(), sharedLogFileName->LengthInBytes()); settings->Path[sharedLogFileName->LengthInBytes() / sizeof(WCHAR)] = L'\0'; // set the null terminator settings->LogContainerId.GetReference().CreateNew(); settings->LogSize = 1024 * 1024 * 512; // 512 MB. settings->MaximumNumberStreams = 0; settings->MaximumRecordSize = 0; settings->Flags = static_cast<ULONG>(Data::Log::LogCreationFlags::UseSparseFile); sharedLogSettings = make_shared<KtlLogger::SharedLogSettings>(std::move(settings)); }; KUri::CSPtr FactoryArgumentTests::GetStateProviderName( __in int stateProviderIndex) { wstring stateProviderName = wformatString(L"fabric:/store/{0}", stateProviderIndex); KUri::CSPtr spName; NTSTATUS status = KUri::Create(KStringView(stateProviderName.c_str()), underlyingSystem_->PagedAllocator(), spName); if (NT_SUCCESS(status) == false) { throw Exception(status); } return spName; } BOOST_FIXTURE_TEST_SUITE(FactoryArgumentTestsSuite, FactoryArgumentTests); BOOST_AUTO_TEST_CASE(FactoryArgument_PartitionId_ReplicaId) { // Setup wstring testName(L"FactoryArgument_PartitionId_ReplicaId"); wstring testFolderPath = CreateFileName(testName); // Pre-clean up Directory::Delete_WithRetry(testFolderPath, true, true); wstring workFolder = Path::Combine(testFolderPath, L"work"); TEST_TRACE_BEGIN(testName) { KtlLogger::SharedLogSettingsSPtr sharedLogSettings; InitializeKtlConfig(testFolderPath, TestLogFileName, underlyingSystem_->NonPagedAllocator(), sharedLogSettings); Data::Log::LogManager::SPtr logManager; status = Data::Log::LogManager::Create(underlyingSystem_->NonPagedAllocator(), logManager); CODING_ERROR_ASSERT(NT_SUCCESS(status)); status = SyncAwait(logManager->OpenAsync(CancellationToken::None, sharedLogSettings)); CODING_ERROR_ASSERT(NT_SUCCESS(status)); SyncAwait(Test_FactoryArgument_PartitionId_ReplicaId(workFolder, *logManager)); status = SyncAwait(logManager->CloseAsync(CancellationToken::None)); CODING_ERROR_ASSERT(NT_SUCCESS(status)); logManager = nullptr; } // Post-clean up Directory::Delete_WithRetry(testFolderPath, true, true); } BOOST_AUTO_TEST_SUITE_END(); } }
causehhc/EmployeeHome
backend/src/main/java/com/csi/emphome/demo/service/test/impl/TestServiceImpl.java
<reponame>causehhc/EmployeeHome<gh_stars>1-10 package com.csi.emphome.demo.service.test.impl; import com.csi.emphome.demo.domain.test.TestItem; import com.csi.emphome.demo.repository.test.TestRepository; import com.csi.emphome.demo.service.test.TestService; import com.csi.emphome.demo.service.test.dto.TestListQuery; import com.csi.emphome.demo.service.test.dto.TestSearchData; import com.csi.emphome.demo.service.test.dto.TestTemp; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; @Service public class TestServiceImpl implements TestService { private final TestRepository testRepository; public TestServiceImpl(TestRepository testRepository) { this.testRepository = testRepository; } @Override public HashMap<String, Object> fetchListFunc(TestListQuery data) { HashMap<String, Object> response = new HashMap<>(); HashMap<String, Object> responseData = new HashMap<>(); List<TestItem> list = testRepository.findAll(PageRequest.of(data.getPage()-1, data.getLimit())).toList(); responseData.put("total",testRepository.count()); responseData.put("items",list); response.put("code",20000); response.put("data",responseData); return response; } public static List<TestItem> splicePage(List<TestItem> list, Integer pageNum, Integer pageSize) { if(list == null){ return null; } if(list.size() == 0){ return null; } Integer count = list.size(); //记录总数 Integer pageCount = 0; //页数 if (count % pageSize == 0) { pageCount = count / pageSize; } else { pageCount = count / pageSize + 1; } int fromIndex = 0; //开始索引 int toIndex = 0; //结束索引 if(pageNum > pageCount){ pageNum = pageCount; } if (!pageNum.equals(pageCount)) { fromIndex = (pageNum - 1) * pageSize; toIndex = fromIndex + pageSize; } else { fromIndex = (pageNum - 1) * pageSize; toIndex = count; } return list.subList(fromIndex, toIndex); } @Override public HashMap<String, Object> fetchListItemFunc(TestSearchData data) { HashMap<String, Object> responseData = new HashMap<>(); if(data.getSearch().equals("")){ return fetchListFunc(data.getListQuery()); } List<TestItem> listAll = testRepository.findAllByInfo(data.getSearch()); List<TestItem> list; if(listAll.size()>0){ list = splicePage(listAll, data.getListQuery().getPage(), data.getListQuery().getLimit()); }else { list = listAll; } responseData.put("total",listAll.size()); responseData.put("items",list); HashMap<String, Object> response = new HashMap<>(); response.put("code",20000); response.put("data",responseData); return response; } @Override public HashMap<String, Object> createListItemFunc(TestTemp data) { int resCode = 20001; String resData = "failed"; TestItem tag_item = testRepository.findById(data.getId()); if (tag_item == null){ TestItem temp_item = new TestItem(data.getId(), data.getInfo(), data.getTime()); testRepository.save(temp_item); resCode = 20000; resData = "success"; } HashMap<String, Object> response = new HashMap<>(); response.put("code",resCode); response.put("data",resData); return response; } @Override public HashMap<String, Object> updateListItemFunc(TestTemp data) { int resCode = 20001; String resData = "failed"; TestItem tag_item = testRepository.findById(data.getId()); if (tag_item != null){ tag_item.setId(data.getId()); tag_item.setInfo(data.getInfo()); tag_item.setTime(data.getTime()); testRepository.save(tag_item); resCode = 20000; resData = "success"; } HashMap<String, Object> response = new HashMap<>(); response.put("code",resCode); response.put("data",resData); return response; } @Override public HashMap<String, Object> deleteListItemFunc(TestTemp data) { int resCode = 20001; String resData = "failed"; TestItem tag_item = testRepository.findById(data.getId()); if (tag_item != null){ testRepository.delete(tag_item); resCode = 20000; resData = "success"; } HashMap<String, Object> response = new HashMap<>(); response.put("code",resCode); response.put("data",resData); return response; } @Override public HashMap<String, Object> apiTestNormalFunc() { HashMap<String, Object> response = new HashMap<>(); response.put("code",20000); response.put("data","OK"); return response; } @Override public HashMap<String, Object> apiTestAdminFunc() { HashMap<String, Object> response = new HashMap<>(); response.put("code",20000); response.put("data","OK"); return response; } }
bdr08349/ladder
autoscaler/inputter.go
package autoscaler import ( "context" "fmt" "time" "github.com/themotion/ladder/autoscaler/arrange" "github.com/themotion/ladder/autoscaler/gather" "github.com/themotion/ladder/config" "github.com/themotion/ladder/log" "github.com/themotion/ladder/metrics" "github.com/themotion/ladder/types" ) type inputter struct { config *config.Inputter // Inputter configuration name string // The name of the inputter (also in the configuration) // Our gathering and arrangement objects gatherer gather.Gatherer arranger arrange.Arranger asName string // The name of the autoscaler log *log.Log // custom logger } // NewInputter creates a inputter func newInputter(ctx context.Context, cfg *config.Inputter) (*inputter, error) { asName := ctx.Value(AutoscalerCtxKey).(string) i := &inputter{ config: cfg, name: cfg.Name, asName: asName, log: log.WithFields(log.Fields{ "autoscaler": asName, "kind": "inputter", "name": cfg.Name, }), } // Set the main pieces if err := i.setGatherer(ctx); err != nil { return nil, err } if err := i.setArranger(ctx); err != nil { return nil, err } return i, nil } // setGatherer sets the correct Gatherer func (i *inputter) setGatherer(ctx context.Context) error { if i.gatherer == nil { if i.config.Gather.Kind == "" { err := fmt.Errorf("gatherer type can't be empty") i.log.Errorf("error creating gatherer: %v", err) return err } // Create new gatherer using the registry and the creators g, err := gather.Create(ctx, i.config.Gather.Kind, i.config.Gather.Config) if err != nil { i.log.Errorf("error creating gatherer: %v", err) return err } i.gatherer = g i.log.Debugf("Gatherer created") return nil } i.log.Debugf("Gatherer already created, ignoring") return nil } // setArranger returns the correct Arranger func (i *inputter) setArranger(ctx context.Context) error { if i.arranger == nil { // Allow empty arranger if i.config.Arrange.Kind == "" { i.log.Warningf("Arranger not specified, gatherer value will be passed transparently to the solver") return nil } // Create new arranger using the registry and the creators ar, err := arrange.Create(ctx, i.config.Arrange.Kind, i.config.Arrange.Config) if err != nil { i.log.Errorf("error creating arranger: %v", err) return err } i.arranger = ar i.log.Debugf("Arranger created") return nil } i.log.Debugf("Arranger already created, ignoring") return nil } // Gathers and arranges the input and returns them so the solver can make a decision func (i *inputter) gatherAndArrange(ctx context.Context, currentQ types.Quantity) (types.Quantity, error) { newQ := types.Quantity{} // Gather the input start := time.Now().UTC() inQ, err := i.gatherer.Gather(ctx) metrics.ObserveGathererDuration(time.Now().UTC().Sub(start), i.asName, i.name, i.config.Gather.Kind) if err != nil { metrics.AddGathererErrors(1, i.asName, i.name, i.config.Gather.Kind) err = fmt.Errorf("error gathering input: %s", err) return newQ, err } metrics.SetGathererQ(inQ, i.asName, i.name, i.config.Gather.Kind) i.log.Debugf("Gatherer %s:%s gathered: %s", i.name, i.config.Gather.Kind, inQ) // Make a decision to up/down scale or not (if not arranger then pass it transparently) if i.arranger != nil { newQ, err = i.arranger.Arrange(ctx, inQ, currentQ) if err != nil { err = fmt.Errorf("error making a decision: %s", err) return newQ, err } } else { newQ = inQ } i.log.Infof("Arranger %s:%s arranged: %s", i.name, i.config.Arrange.Kind, newQ) return newQ, nil }
pathorn/sirikata
libcore/src/network/IOTimer.cpp
<gh_stars>1-10 /* Sirikata Network Utilities * IOTimer.cpp * * Copyright (c) 2009, <NAME> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Sirikata nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sirikata/core/util/Standard.hh> #include <sirikata/core/network/IOTimer.hpp> #include <sirikata/core/network/IOService.hpp> #include <sirikata/core/network/IOStrandImpl.hpp> #include <sirikata/core/util/Time.hpp> #include <sirikata/core/network/Asio.hpp> #include <boost/asio.hpp> #include <boost/bind.hpp> namespace Sirikata { namespace Network { class IOTimer::TimedOut { public: static void timedOut( const boost::system::error_code &error, IOTimerWPtr wthis, uint64 tokenVal) { IOTimerPtr sharedThis (wthis.lock()); if (!sharedThis) { return; // we've been deleted already. } if (error == boost::asio::error::operation_aborted) { return; // don't care if the timer was cancelled. } if (sharedThis->mStrand != NULL) sharedThis->chk.serializedEnter(); IOTimer*st=&*sharedThis; //token only gets incremented if was canceled. Therefore, if these two //are equal, means wasn't canceled. if (tokenVal == st->mCanceled) sharedThis->mFunc(); if (sharedThis->mStrand != NULL) sharedThis->chk.serializedExit(); } }; IOTimer::IOTimer(IOService& io) : mTimer(new DeadlineTimer(io)), mStrand(NULL), mFunc(), mCanceled(0) { } IOTimer::IOTimer(IOService& io, const IOCallback& cb) : mTimer(new DeadlineTimer(io)), mStrand(NULL), mFunc(), mCanceled(0) { setCallback(cb); } IOTimer::IOTimer(IOStrand* ios) : mTimer(new DeadlineTimer(ios->service())), mStrand(ios), mFunc(), mCanceled(0) { } IOTimer::IOTimer(IOStrand* ios, const IOCallback& cb) : mTimer(new DeadlineTimer(ios->service())), mStrand(ios), mFunc(), mCanceled(0) { setCallback(cb); } IOTimerPtr IOTimer::create(IOService* io) { return IOTimerPtr(new IOTimer(*io)); } IOTimerPtr IOTimer::create(IOService& io) { return IOTimerPtr(new IOTimer(io)); } IOTimerPtr IOTimer::create(IOStrand* ios) { return IOTimerPtr(new IOTimer(ios)); } IOTimerPtr IOTimer::create(IOStrand& ios) { return IOTimerPtr(new IOTimer(&ios)); } IOTimerPtr IOTimer::create(IOService* io, const IOCallback& cb) { return IOTimerPtr(new IOTimer(*io, cb)); } IOTimerPtr IOTimer::create(IOService& io, const IOCallback& cb) { return IOTimerPtr(new IOTimer(io, cb)); } IOTimerPtr IOTimer::create(IOStrand* ios, const IOCallback& cb) { return IOTimerPtr(new IOTimer(ios, cb)); } IOTimerPtr IOTimer::create(IOStrand& ios, const IOCallback& cb) { return IOTimerPtr(new IOTimer(&ios, cb)); } IOTimer::~IOTimer() { if (mStrand != NULL) chk.serializedEnter(); cancel(); delete mTimer; if (mStrand != NULL) chk.serializedExit(); } IOService IOTimer::service() const { return IOService(&mTimer->get_io_service()); } void IOTimer::wait(const Duration &num_seconds) { mTimer->expires_from_now(boost::posix_time::microseconds(num_seconds.toMicroseconds())); IOTimerWPtr weakThisPtr(this->shared_from_this()); if (mStrand == NULL) { mTimer->async_wait( boost::bind( &IOTimer::TimedOut::timedOut, boost::asio::placeholders::error, weakThisPtr, mCanceled.read() ) ); } else { mTimer->async_wait( mStrand->wrap( boost::bind( &IOTimer::TimedOut::timedOut, boost::asio::placeholders::error, weakThisPtr, mCanceled.read() ) ) ); } } void IOTimer::wait(const Duration &num_seconds, const IOCallback& cb) { setCallback(cb); wait(num_seconds); } void IOTimer::setCallback(const IOCallback& cb) { mFunc = cb; } void IOTimer::cancel() { if (mStrand != NULL) chk.serializedEnter(); mCanceled++; mTimer->cancel(); if (mStrand != NULL) chk.serializedExit(); } Duration IOTimer::expiresFromNow() { return Duration::microseconds(mTimer->expires_from_now().total_microseconds()); } } // namespace Network } // namespace Sirikata
binglongworld/springboot-demo
chapter3-3/src/main/java/com/hl/chapter33/web/UploadController.java
<reponame>binglongworld/springboot-demo<gh_stars>1-10 package com.hl.chapter33.web; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.util.ResourceUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.nio.file.Files; @Slf4j @Controller public class UploadController { @Value("${file.upload.path}") private String path; @GetMapping(value = "/home") public String uploadPage() { return "upload"; } @PostMapping(value = "/upload") @ResponseBody public String create(@RequestPart MultipartFile file) throws IOException { File basePath = new File(ResourceUtils.getURL("classpath:").getPath()); if (!basePath.exists()) { basePath = new File(""); } log.info("path: " + basePath.getAbsolutePath()); File upload = new File(basePath.getAbsoluteFile(), path); if (!upload.exists()) { upload.mkdirs(); } String fileName = file.getOriginalFilename(); File dest = new File(upload.getAbsoluteFile() + "/" + fileName); Files.copy(file.getInputStream(), dest.toPath()); return "Upload file success : " + dest.getAbsolutePath(); } }
ScalablyTyped/SlinkyTyped
r/react-dnd/src/main/scala/typingsSlinky/reactDnd/hooksMod.scala
package typingsSlinky.reactDnd import typingsSlinky.dndCore.interfacesMod.DragDropManager import typingsSlinky.reactDnd.connectorsMod.ConnectDragPreview import typingsSlinky.reactDnd.connectorsMod.ConnectDragSource import typingsSlinky.reactDnd.connectorsMod.ConnectDropTarget import typingsSlinky.reactDnd.hooksApiMod.DragObjectWithType import typingsSlinky.reactDnd.hooksApiMod.DragSourceHookSpec import typingsSlinky.reactDnd.hooksApiMod.DropTargetHookSpec import typingsSlinky.reactDnd.monitorsMod.DragLayerMonitor import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.`|` import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} object hooksMod { @JSImport("react-dnd/lib/hooks", "useDrag") @js.native def useDrag[DragObject /* <: DragObjectWithType */, DropResult, CollectedProps](spec: DragSourceHookSpec[DragObject, DropResult, CollectedProps]): js.Tuple3[CollectedProps, ConnectDragSource, ConnectDragPreview] = js.native @JSImport("react-dnd/lib/hooks", "useDragDropManager") @js.native def useDragDropManager(): DragDropManager = js.native @JSImport("react-dnd/lib/hooks", "useDragLayer") @js.native def useDragLayer[CollectedProps](collect: js.Function1[/* monitor */ DragLayerMonitor, CollectedProps]): CollectedProps = js.native @JSImport("react-dnd/lib/hooks", "useDrop") @js.native def useDrop[DragObject /* <: DragObjectWithType */, DropResult, CollectedProps](spec: DropTargetHookSpec[DragObject, DropResult, CollectedProps]): js.Tuple2[CollectedProps, ConnectDropTarget] = js.native }
xjc90s/serenity-core
serenity-ant-task/src/test/java/net/serenitybdd/ant/util/WhenPreparingResourcePaths.java
<reponame>xjc90s/serenity-core package net.serenitybdd.ant.util; import net.serenitybdd.ant.util.PathProcessor; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; public class WhenPreparingResourcePaths { PathProcessor pathProcessor = new PathProcessor(); @Test public void shouldNotModifyUnprefixedPaths() { assertThat(pathProcessor.normalize("some/path")).isEqualTo("some/path"); } }
fossabot/DIVOC
backend/registration_api/swagger_gen/restapi/operations/register_recipient_to_program_responses.go
<gh_stars>100-1000 // Code generated by go-swagger; DO NOT EDIT. package operations // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "net/http" "github.com/go-openapi/runtime" ) // RegisterRecipientToProgramOKCode is the HTTP code returned for type RegisterRecipientToProgramOK const RegisterRecipientToProgramOKCode int = 200 /*RegisterRecipientToProgramOK OK swagger:response registerRecipientToProgramOK */ type RegisterRecipientToProgramOK struct { /* In: Body */ Payload interface{} `json:"body,omitempty"` } // NewRegisterRecipientToProgramOK creates RegisterRecipientToProgramOK with default headers values func NewRegisterRecipientToProgramOK() *RegisterRecipientToProgramOK { return &RegisterRecipientToProgramOK{} } // WithPayload adds the payload to the register recipient to program o k response func (o *RegisterRecipientToProgramOK) WithPayload(payload interface{}) *RegisterRecipientToProgramOK { o.Payload = payload return o } // SetPayload sets the payload to the register recipient to program o k response func (o *RegisterRecipientToProgramOK) SetPayload(payload interface{}) { o.Payload = payload } // WriteResponse to the client func (o *RegisterRecipientToProgramOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.WriteHeader(200) payload := o.Payload if err := producer.Produce(rw, payload); err != nil { panic(err) // let the recovery middleware deal with this } } // RegisterRecipientToProgramBadRequestCode is the HTTP code returned for type RegisterRecipientToProgramBadRequest const RegisterRecipientToProgramBadRequestCode int = 400 /*RegisterRecipientToProgramBadRequest Bad Request swagger:response registerRecipientToProgramBadRequest */ type RegisterRecipientToProgramBadRequest struct { } // NewRegisterRecipientToProgramBadRequest creates RegisterRecipientToProgramBadRequest with default headers values func NewRegisterRecipientToProgramBadRequest() *RegisterRecipientToProgramBadRequest { return &RegisterRecipientToProgramBadRequest{} } // WriteResponse to the client func (o *RegisterRecipientToProgramBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses rw.WriteHeader(400) } // RegisterRecipientToProgramUnauthorizedCode is the HTTP code returned for type RegisterRecipientToProgramUnauthorized const RegisterRecipientToProgramUnauthorizedCode int = 401 /*RegisterRecipientToProgramUnauthorized Unauthorized swagger:response registerRecipientToProgramUnauthorized */ type RegisterRecipientToProgramUnauthorized struct { } // NewRegisterRecipientToProgramUnauthorized creates RegisterRecipientToProgramUnauthorized with default headers values func NewRegisterRecipientToProgramUnauthorized() *RegisterRecipientToProgramUnauthorized { return &RegisterRecipientToProgramUnauthorized{} } // WriteResponse to the client func (o *RegisterRecipientToProgramUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses rw.WriteHeader(401) } // RegisterRecipientToProgramInternalServerErrorCode is the HTTP code returned for type RegisterRecipientToProgramInternalServerError const RegisterRecipientToProgramInternalServerErrorCode int = 500 /*RegisterRecipientToProgramInternalServerError Internal Error swagger:response registerRecipientToProgramInternalServerError */ type RegisterRecipientToProgramInternalServerError struct { } // NewRegisterRecipientToProgramInternalServerError creates RegisterRecipientToProgramInternalServerError with default headers values func NewRegisterRecipientToProgramInternalServerError() *RegisterRecipientToProgramInternalServerError { return &RegisterRecipientToProgramInternalServerError{} } // WriteResponse to the client func (o *RegisterRecipientToProgramInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses rw.WriteHeader(500) }
zvfvrv/vpp-dataplane
vpplink/binapi/vppapi/abf/abf.ba.go
// Code generated by GoVPP's binapi-generator. DO NOT EDIT. // Package abf contains generated bindings for API file abf.api. // // Contents: // 2 structs // 10 messages // package abf import ( api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" fib_types "github.com/projectcalico/vpp-dataplane/vpplink/binapi/vppapi/fib_types" interface_types "github.com/projectcalico/vpp-dataplane/vpplink/binapi/vppapi/interface_types" _ "github.com/projectcalico/vpp-dataplane/vpplink/binapi/vppapi/ip_types" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the GoVPP api package it is being compiled against. // A compilation error at this line likely means your copy of the // GoVPP api package needs to be updated. const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "abf" APIVersion = "1.0.0" VersionCrc = 0xf2367b47 ) // AbfItfAttach defines type 'abf_itf_attach'. type AbfItfAttach struct { PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"` SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` Priority uint32 `binapi:"u32,name=priority" json:"priority,omitempty"` IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` } // AbfPolicy defines type 'abf_policy'. type AbfPolicy struct { PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"` ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` } // AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'. // InProgress: the message form may change in the future versions type AbfItfAttachAddDel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` } func (m *AbfItfAttachAddDel) Reset() { *m = AbfItfAttachAddDel{} } func (*AbfItfAttachAddDel) GetMessageName() string { return "abf_itf_attach_add_del" } func (*AbfItfAttachAddDel) GetCrcString() string { return "25c8621b" } func (*AbfItfAttachAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *AbfItfAttachAddDel) Size() (size int) { if m == nil { return 0 } size += 1 // m.IsAdd size += 4 // m.Attach.PolicyID size += 4 // m.Attach.SwIfIndex size += 4 // m.Attach.Priority size += 1 // m.Attach.IsIPv6 return size } func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) buf.EncodeBool(m.IsAdd) buf.EncodeUint32(m.Attach.PolicyID) buf.EncodeUint32(uint32(m.Attach.SwIfIndex)) buf.EncodeUint32(m.Attach.Priority) buf.EncodeBool(m.Attach.IsIPv6) return buf.Bytes(), nil } func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() m.Attach.PolicyID = buf.DecodeUint32() m.Attach.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) m.Attach.Priority = buf.DecodeUint32() m.Attach.IsIPv6 = buf.DecodeBool() return nil } // AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'. // InProgress: the message form may change in the future versions type AbfItfAttachAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *AbfItfAttachAddDelReply) Reset() { *m = AbfItfAttachAddDelReply{} } func (*AbfItfAttachAddDelReply) GetMessageName() string { return "abf_itf_attach_add_del_reply" } func (*AbfItfAttachAddDelReply) GetCrcString() string { return "e8d4e804" } func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *AbfItfAttachAddDelReply) Size() (size int) { if m == nil { return 0 } size += 4 // m.Retval return size } func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) buf.EncodeInt32(m.Retval) return buf.Bytes(), nil } func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Retval = buf.DecodeInt32() return nil } // AbfItfAttachDetails defines message 'abf_itf_attach_details'. // InProgress: the message form may change in the future versions type AbfItfAttachDetails struct { Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` } func (m *AbfItfAttachDetails) Reset() { *m = AbfItfAttachDetails{} } func (*AbfItfAttachDetails) GetMessageName() string { return "abf_itf_attach_details" } func (*AbfItfAttachDetails) GetCrcString() string { return "7819523e" } func (*AbfItfAttachDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *AbfItfAttachDetails) Size() (size int) { if m == nil { return 0 } size += 4 // m.Attach.PolicyID size += 4 // m.Attach.SwIfIndex size += 4 // m.Attach.Priority size += 1 // m.Attach.IsIPv6 return size } func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) buf.EncodeUint32(m.Attach.PolicyID) buf.EncodeUint32(uint32(m.Attach.SwIfIndex)) buf.EncodeUint32(m.Attach.Priority) buf.EncodeBool(m.Attach.IsIPv6) return buf.Bytes(), nil } func (m *AbfItfAttachDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Attach.PolicyID = buf.DecodeUint32() m.Attach.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) m.Attach.Priority = buf.DecodeUint32() m.Attach.IsIPv6 = buf.DecodeBool() return nil } // AbfItfAttachDump defines message 'abf_itf_attach_dump'. // InProgress: the message form may change in the future versions type AbfItfAttachDump struct{} func (m *AbfItfAttachDump) Reset() { *m = AbfItfAttachDump{} } func (*AbfItfAttachDump) GetMessageName() string { return "abf_itf_attach_dump" } func (*AbfItfAttachDump) GetCrcString() string { return "51077d14" } func (*AbfItfAttachDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *AbfItfAttachDump) Size() (size int) { if m == nil { return 0 } return size } func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) return buf.Bytes(), nil } func (m *AbfItfAttachDump) Unmarshal(b []byte) error { return nil } // AbfPluginGetVersion defines message 'abf_plugin_get_version'. // InProgress: the message form may change in the future versions type AbfPluginGetVersion struct{} func (m *AbfPluginGetVersion) Reset() { *m = AbfPluginGetVersion{} } func (*AbfPluginGetVersion) GetMessageName() string { return "abf_plugin_get_version" } func (*AbfPluginGetVersion) GetCrcString() string { return "51077d14" } func (*AbfPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } func (m *AbfPluginGetVersion) Size() (size int) { if m == nil { return 0 } return size } func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) return buf.Bytes(), nil } func (m *AbfPluginGetVersion) Unmarshal(b []byte) error { return nil } // AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'. // InProgress: the message form may change in the future versions type AbfPluginGetVersionReply struct { Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` } func (m *AbfPluginGetVersionReply) Reset() { *m = AbfPluginGetVersionReply{} } func (*AbfPluginGetVersionReply) GetMessageName() string { return "abf_plugin_get_version_reply" } func (*AbfPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *AbfPluginGetVersionReply) Size() (size int) { if m == nil { return 0 } size += 4 // m.Major size += 4 // m.Minor return size } func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) buf.EncodeUint32(m.Major) buf.EncodeUint32(m.Minor) return buf.Bytes(), nil } func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Major = buf.DecodeUint32() m.Minor = buf.DecodeUint32() return nil } // AbfPolicyAddDel defines message 'abf_policy_add_del'. // InProgress: the message form may change in the future versions type AbfPolicyAddDel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` } func (m *AbfPolicyAddDel) Reset() { *m = AbfPolicyAddDel{} } func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" } func (*AbfPolicyAddDel) GetCrcString() string { return "c6131197" } func (*AbfPolicyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *AbfPolicyAddDel) Size() (size int) { if m == nil { return 0 } size += 1 // m.IsAdd size += 4 // m.Policy.PolicyID size += 4 // m.Policy.ACLIndex size += 1 // m.Policy.NPaths for j2 := 0; j2 < len(m.Policy.Paths); j2++ { var s2 fib_types.FibPath _ = s2 if j2 < len(m.Policy.Paths) { s2 = m.Policy.Paths[j2] } size += 4 // s2.SwIfIndex size += 4 // s2.TableID size += 4 // s2.RpfID size += 1 // s2.Weight size += 1 // s2.Preference size += 4 // s2.Type size += 4 // s2.Flags size += 4 // s2.Proto size += 1 * 16 // s2.Nh.Address size += 4 // s2.Nh.ViaLabel size += 4 // s2.Nh.ObjID size += 4 // s2.Nh.ClassifyTableIndex size += 1 // s2.NLabels for j3 := 0; j3 < 16; j3++ { size += 1 // s2.LabelStack[j3].IsUniform size += 4 // s2.LabelStack[j3].Label size += 1 // s2.LabelStack[j3].TTL size += 1 // s2.LabelStack[j3].Exp } } return size } func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) buf.EncodeBool(m.IsAdd) buf.EncodeUint32(m.Policy.PolicyID) buf.EncodeUint32(m.Policy.ACLIndex) buf.EncodeUint8(uint8(len(m.Policy.Paths))) for j1 := 0; j1 < len(m.Policy.Paths); j1++ { var v1 fib_types.FibPath // Paths if j1 < len(m.Policy.Paths) { v1 = m.Policy.Paths[j1] } buf.EncodeUint32(v1.SwIfIndex) buf.EncodeUint32(v1.TableID) buf.EncodeUint32(v1.RpfID) buf.EncodeUint8(v1.Weight) buf.EncodeUint8(v1.Preference) buf.EncodeUint32(uint32(v1.Type)) buf.EncodeUint32(uint32(v1.Flags)) buf.EncodeUint32(uint32(v1.Proto)) buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) buf.EncodeUint32(v1.Nh.ViaLabel) buf.EncodeUint32(v1.Nh.ObjID) buf.EncodeUint32(v1.Nh.ClassifyTableIndex) buf.EncodeUint8(v1.NLabels) for j2 := 0; j2 < 16; j2++ { buf.EncodeUint8(v1.LabelStack[j2].IsUniform) buf.EncodeUint32(v1.LabelStack[j2].Label) buf.EncodeUint8(v1.LabelStack[j2].TTL) buf.EncodeUint8(v1.LabelStack[j2].Exp) } } return buf.Bytes(), nil } func (m *AbfPolicyAddDel) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.IsAdd = buf.DecodeBool() m.Policy.PolicyID = buf.DecodeUint32() m.Policy.ACLIndex = buf.DecodeUint32() m.Policy.NPaths = buf.DecodeUint8() m.Policy.Paths = make([]fib_types.FibPath, m.Policy.NPaths) for j1 := 0; j1 < len(m.Policy.Paths); j1++ { m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32() m.Policy.Paths[j1].TableID = buf.DecodeUint32() m.Policy.Paths[j1].RpfID = buf.DecodeUint32() m.Policy.Paths[j1].Weight = buf.DecodeUint8() m.Policy.Paths[j1].Preference = buf.DecodeUint8() m.Policy.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) m.Policy.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) m.Policy.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32() m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() m.Policy.Paths[j1].NLabels = buf.DecodeUint8() for j2 := 0; j2 < 16; j2++ { m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() } } return nil } // AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'. // InProgress: the message form may change in the future versions type AbfPolicyAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *AbfPolicyAddDelReply) Reset() { *m = AbfPolicyAddDelReply{} } func (*AbfPolicyAddDelReply) GetMessageName() string { return "abf_policy_add_del_reply" } func (*AbfPolicyAddDelReply) GetCrcString() string { return "e8d4e804" } func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *AbfPolicyAddDelReply) Size() (size int) { if m == nil { return 0 } size += 4 // m.Retval return size } func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) buf.EncodeInt32(m.Retval) return buf.Bytes(), nil } func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Retval = buf.DecodeInt32() return nil } // AbfPolicyDetails defines message 'abf_policy_details'. // InProgress: the message form may change in the future versions type AbfPolicyDetails struct { Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` } func (m *AbfPolicyDetails) Reset() { *m = AbfPolicyDetails{} } func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" } func (*AbfPolicyDetails) GetCrcString() string { return "b7487fa4" } func (*AbfPolicyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *AbfPolicyDetails) Size() (size int) { if m == nil { return 0 } size += 4 // m.Policy.PolicyID size += 4 // m.Policy.ACLIndex size += 1 // m.Policy.NPaths for j2 := 0; j2 < len(m.Policy.Paths); j2++ { var s2 fib_types.FibPath _ = s2 if j2 < len(m.Policy.Paths) { s2 = m.Policy.Paths[j2] } size += 4 // s2.SwIfIndex size += 4 // s2.TableID size += 4 // s2.RpfID size += 1 // s2.Weight size += 1 // s2.Preference size += 4 // s2.Type size += 4 // s2.Flags size += 4 // s2.Proto size += 1 * 16 // s2.Nh.Address size += 4 // s2.Nh.ViaLabel size += 4 // s2.Nh.ObjID size += 4 // s2.Nh.ClassifyTableIndex size += 1 // s2.NLabels for j3 := 0; j3 < 16; j3++ { size += 1 // s2.LabelStack[j3].IsUniform size += 4 // s2.LabelStack[j3].Label size += 1 // s2.LabelStack[j3].TTL size += 1 // s2.LabelStack[j3].Exp } } return size } func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) buf.EncodeUint32(m.Policy.PolicyID) buf.EncodeUint32(m.Policy.ACLIndex) buf.EncodeUint8(uint8(len(m.Policy.Paths))) for j1 := 0; j1 < len(m.Policy.Paths); j1++ { var v1 fib_types.FibPath // Paths if j1 < len(m.Policy.Paths) { v1 = m.Policy.Paths[j1] } buf.EncodeUint32(v1.SwIfIndex) buf.EncodeUint32(v1.TableID) buf.EncodeUint32(v1.RpfID) buf.EncodeUint8(v1.Weight) buf.EncodeUint8(v1.Preference) buf.EncodeUint32(uint32(v1.Type)) buf.EncodeUint32(uint32(v1.Flags)) buf.EncodeUint32(uint32(v1.Proto)) buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16) buf.EncodeUint32(v1.Nh.ViaLabel) buf.EncodeUint32(v1.Nh.ObjID) buf.EncodeUint32(v1.Nh.ClassifyTableIndex) buf.EncodeUint8(v1.NLabels) for j2 := 0; j2 < 16; j2++ { buf.EncodeUint8(v1.LabelStack[j2].IsUniform) buf.EncodeUint32(v1.LabelStack[j2].Label) buf.EncodeUint8(v1.LabelStack[j2].TTL) buf.EncodeUint8(v1.LabelStack[j2].Exp) } } return buf.Bytes(), nil } func (m *AbfPolicyDetails) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) m.Policy.PolicyID = buf.DecodeUint32() m.Policy.ACLIndex = buf.DecodeUint32() m.Policy.NPaths = buf.DecodeUint8() m.Policy.Paths = make([]fib_types.FibPath, m.Policy.NPaths) for j1 := 0; j1 < len(m.Policy.Paths); j1++ { m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32() m.Policy.Paths[j1].TableID = buf.DecodeUint32() m.Policy.Paths[j1].RpfID = buf.DecodeUint32() m.Policy.Paths[j1].Weight = buf.DecodeUint8() m.Policy.Paths[j1].Preference = buf.DecodeUint8() m.Policy.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) m.Policy.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) m.Policy.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32() m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() m.Policy.Paths[j1].NLabels = buf.DecodeUint8() for j2 := 0; j2 < 16; j2++ { m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() } } return nil } // AbfPolicyDump defines message 'abf_policy_dump'. // InProgress: the message form may change in the future versions type AbfPolicyDump struct{} func (m *AbfPolicyDump) Reset() { *m = AbfPolicyDump{} } func (*AbfPolicyDump) GetMessageName() string { return "abf_policy_dump" } func (*AbfPolicyDump) GetCrcString() string { return "51077d14" } func (*AbfPolicyDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *AbfPolicyDump) Size() (size int) { if m == nil { return 0 } return size } func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) { if b == nil { b = make([]byte, m.Size()) } buf := codec.NewBuffer(b) return buf.Bytes(), nil } func (m *AbfPolicyDump) Unmarshal(b []byte) error { return nil } func init() { file_abf_binapi_init() } func file_abf_binapi_init() { api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf_itf_attach_add_del_25c8621b") api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf_itf_attach_add_del_reply_e8d4e804") api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf_itf_attach_details_7819523e") api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14") api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14") api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86") api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_c6131197") api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804") api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_b7487fa4") api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14") } // Messages returns list of all messages in this module. func AllMessages() []api.Message { return []api.Message{ (*AbfItfAttachAddDel)(nil), (*AbfItfAttachAddDelReply)(nil), (*AbfItfAttachDetails)(nil), (*AbfItfAttachDump)(nil), (*AbfPluginGetVersion)(nil), (*AbfPluginGetVersionReply)(nil), (*AbfPolicyAddDel)(nil), (*AbfPolicyAddDelReply)(nil), (*AbfPolicyDetails)(nil), (*AbfPolicyDump)(nil), } }
ExGiX/JS-Advanced-September-2021
Labs/02.Arrays and Nested Arrays/11.equalNeighbors.js
function solve(arr) { let pairs=0 arr.forEach((row , i) => { row.forEach((el , x)=> { if(el===row[x+1]) { pairs++ } if(arr[i+1]&& el===arr[i+1][x]) { pairs++ } }) }) return pairs }
SnirkImmington/shadowroller
server/update/update_test.go
<filename>server/update/update_test.go package update /* import ( mathRand "math/rand" "reflect" "testing/quick" "sr/event" ) // Scrapped due to being unable to import event.RandomEvent... func RandomUpdate(rand *mathRand.Rand) Update { ty := rand.Intn(1) switch ty { case 0: // +evt return ForNewEvent(event.RandomEvent(rand)) case 1: // ~evt evt := event.RandomEvent(rand) } // ~evt // -evt // ^roll // !init // +plr // ~plr // -plr } */
YungTsun/alameda
datahub/pkg/account-mgt/keycodes/event.go
<gh_stars>0 package keycodes import ( "fmt" EventMgt "github.com/containers-ai/alameda/internal/pkg/event-mgt" AlamedaUtils "github.com/containers-ai/alameda/pkg/utils" K8SUtils "github.com/containers-ai/alameda/pkg/utils/kubernetes" ApiEvents "github.com/containers-ai/api/alameda_api/v1alpha1/datahub/events" "github.com/golang/protobuf/ptypes/timestamp" "time" ) func NewKeycodeEvent(level ApiEvents.EventLevel, message string) *ApiEvents.Event { namespace := K8SUtils.GetRunningNamespace() clusterId, err := K8SUtils.GetClusterUID(K8SClient) if err != nil { scope.Errorf("failed to get cluster id: %s", err.Error()) } source := &ApiEvents.EventSource{ Host: "", Component: fmt.Sprintf("%s-datahub", namespace), } subject := &ApiEvents.K8SObjectReference{ Kind: "Pod", Namespace: namespace, Name: "Federator.ai", ApiVersion: "v1", } event := &ApiEvents.Event{ Time: &timestamp.Timestamp{Seconds: time.Now().Unix()}, Id: AlamedaUtils.GenerateUUID(), ClusterId: clusterId, Source: source, Type: ApiEvents.EventType_EVENT_TYPE_LICENSE, Version: ApiEvents.EventVersion_EVENT_VERSION_V1, Level: level, Subject: subject, Message: message, } return event } func PostEvent(level ApiEvents.EventLevel, message string) error { if level == ApiEvents.EventLevel_EVENT_LEVEL_INFO { scope.Info(message) } else { scope.Error(message) } request := &ApiEvents.CreateEventsRequest{} request.Events = append(request.Events, NewKeycodeEvent(level, message)) return EventMgt.PostEvents(request) }
qiyankai/foodie
foodie-dev-service/src/main/java/com/qyk/service/impl/OrderServiceImpl.java
<filename>foodie-dev-service/src/main/java/com/qyk/service/impl/OrderServiceImpl.java package com.qyk.service.impl; import com.qyk.enums.OrderStatusEnum; import com.qyk.enums.YesOrNo; import com.qyk.mapper.OrderItemsMapper; import com.qyk.mapper.OrderStatusMapper; import com.qyk.mapper.OrdersMapper; import com.qyk.pojo.*; import com.qyk.pojo.bo.ShopcartBO; import com.qyk.pojo.bo.SubmitOrderBO; import com.qyk.pojo.vo.MerchantOrdersVO; import com.qyk.pojo.vo.OrderVO; import com.qyk.service.OrderService; import com.qyk.utils.DateUtil; import org.n3r.idworker.Sid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; @Service public class OrderServiceImpl implements OrderService { @Autowired private OrdersMapper ordersMapper; @Autowired private OrderItemsMapper orderItemsMapper; @Autowired private OrderStatusMapper orderStatusMapper; @Autowired private AddressServiceImpl addressService; @Autowired private ItemServiceImpl itemService; @Autowired private Sid sid; @Transactional(propagation = Propagation.REQUIRED) @Override public OrderVO create(SubmitOrderBO submitOrderBO, List<ShopcartBO> shopcartBOList) { // 1。新订单保存 Integer payMethod = submitOrderBO.getPayMethod(); String addressId = submitOrderBO.getAddressId(); String itemSpecIds = submitOrderBO.getItemSpecIds(); String leftMsg = submitOrderBO.getLeftMsg(); String userId = submitOrderBO.getUserId(); //运费,暂时设置为0 Integer postAmount = 0; UserAddress userAddress = addressService.queryUserAddress(userId, addressId); Orders newOrders = new Orders(); String orderId = sid.nextShort(); newOrders.setId(orderId); newOrders.setUserId(userId); newOrders.setReceiverName(userAddress.getReceiver()); newOrders.setReceiverAddress(userAddress.getProvince() + " " + userAddress.getCity() + " " + userAddress.getDistrict()); newOrders.setReceiverMobile(userAddress.getMobile()); // 计算价格 newOrders.setPostAmount(postAmount); newOrders.setPayMethod(payMethod); newOrders.setLeftMsg(leftMsg); newOrders.setIsComment(YesOrNo.NO.type); newOrders.setIsDelete(YesOrNo.NO.type); newOrders.setCreatedTime(new Date()); newOrders.setUpdatedTime(new Date()); // 2。循环保存订单商品信息表 String[] itemSpecIdArr = itemSpecIds.split(","); Integer totalAmount = 0; Integer realPayAmount = 0; List<ShopcartBO> needToDeleteShopCartList = new ArrayList<>(); for (String itemSpecId : itemSpecIdArr) { // 现在从redis中找 ShopcartBO shopcartBO = getCartByRedisList(itemSpecId, shopcartBOList); needToDeleteShopCartList.add(shopcartBO); // 整合redis后,商品购买数量由redis中获取 int buyCounts = shopcartBO.getBuyCounts(); // 2。1 根据规格获取价格 ItemsSpec itemsSpec = itemService.queryItemSpecById(itemSpecId); totalAmount += itemsSpec.getPriceNormal() * buyCounts; realPayAmount += itemsSpec.getPriceDiscount() * buyCounts; // 2。2 根据商品id,获取商品的信息与图片 String itemId = itemsSpec.getItemId(); Items items = itemService.queryItemById(itemId); String mainImgUrl = itemService.queryItemMainImgById(itemId); // 2。3 保存子订单 String subOrderId = sid.nextShort(); OrderItems subOrderItems = new OrderItems(); subOrderItems.setId(subOrderId); subOrderItems.setOrderId(orderId); subOrderItems.setItemId(itemId); subOrderItems.setItemImg(mainImgUrl); subOrderItems.setItemName(items.getItemName()); subOrderItems.setBuyCounts(buyCounts); subOrderItems.setItemSpecId(itemSpecId); subOrderItems.setItemSpecName(itemsSpec.getName()); subOrderItems.setPrice(itemsSpec.getPriceDiscount()); orderItemsMapper.insert(subOrderItems); // 2。4提交订单后,规格表中,需要扣除库存 itemService.decreaseItemSpecStock(itemSpecId, buyCounts); } newOrders.setTotalAmount(totalAmount); newOrders.setRealPayAmount(realPayAmount); ordersMapper.insert(newOrders); // 3保存订单状态表 OrderStatus waitPayOrderStatus = new OrderStatus(); waitPayOrderStatus.setOrderId(orderId); waitPayOrderStatus.setOrderStatus(OrderStatusEnum.WAIT_PAY.type); waitPayOrderStatus.setCreatedTime(new Date()); orderStatusMapper.insert(waitPayOrderStatus); // 4构建商户订单,用于传送给支付中心 MerchantOrdersVO merchantOrdersVO = new MerchantOrdersVO(); merchantOrdersVO.setMerchantOrderId(orderId); int amount = realPayAmount + postAmount; // 暂时将金额设置为0。01元,方便测试, // amount = 1; merchantOrdersVO.setAmount(amount); merchantOrdersVO.setMerchantUserId(userId); merchantOrdersVO.setPayMethod(payMethod); // 5构建自定义订单VO OrderVO orderVO = new OrderVO(); orderVO.setOrderId(orderId); orderVO.setMerchantOrdersVO(merchantOrdersVO); orderVO.setNeedToDeleteShopCartList(needToDeleteShopCartList); return orderVO; } private ShopcartBO getCartByRedisList(String itemSpecId, List<ShopcartBO> shopcartBOList) { for (ShopcartBO shopcartBO : shopcartBOList) { if (shopcartBO.getSpecId().equals(itemSpecId)) { return shopcartBO; } } return null; } @Override @Transactional(propagation = Propagation.REQUIRED) public void updateOrderStatus(String orderId, Integer status) { OrderStatus orderStatus = new OrderStatus(); orderStatus.setOrderId(orderId); orderStatus.setOrderStatus(status); orderStatus.setPayTime(new Date()); orderStatusMapper.updateByPrimaryKeySelective(orderStatus); } @Override @Transactional(propagation = Propagation.SUPPORTS) public OrderStatus queryStatusByOrderId(String orderId) { OrderStatus orderStatus = orderStatusMapper.selectByPrimaryKey(orderId); return orderStatus; } @Override @Transactional(propagation = Propagation.REQUIRED) public void closeTimeOutOrder() { //查询所有未付款订单查询是否超时(目前为1day) OrderStatus orderStatus = new OrderStatus(); orderStatus.setOrderStatus(OrderStatusEnum.WAIT_PAY.type); List<OrderStatus> orderStatusList = orderStatusMapper.select(orderStatus); for (OrderStatus status : orderStatusList) { //对比时间,判断其是否超时 Date createdTime = status.getCreatedTime(); int daysBetween = DateUtil.daysBetween(createdTime, new Date()); if (daysBetween >= 1) { //已超时,关闭订单 } } } @Transactional(propagation = Propagation.REQUIRED) void doCloseOrder(String orderId) { OrderStatus closeOrderStatus = new OrderStatus(); closeOrderStatus.setOrderId(orderId); closeOrderStatus.setOrderStatus(OrderStatusEnum.CLOSE.type); closeOrderStatus.setCloseTime(new Date()); orderStatusMapper.updateByPrimaryKeySelective(closeOrderStatus); } }
ryanb93/newrelic-java-agent
newrelic-agent/src/test/java/com/newrelic/agent/instrumentation/classmatchers/ClassMatcherTest.java
<filename>newrelic-agent/src/test/java/com/newrelic/agent/instrumentation/classmatchers/ClassMatcherTest.java /* * * * Copyright 2020 New Relic Corporation. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * */ package com.newrelic.agent.instrumentation.classmatchers; import java.io.IOException; import java.util.AbstractList; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Vector; import org.junit.Assert; import org.junit.Test; import org.objectweb.asm.ClassReader; import org.objectweb.asm.Type; import com.newrelic.agent.util.asm.Utils; public class ClassMatcherTest { @Test public void interfaceMatcher() throws IOException { InterfaceMatcher matcher = new InterfaceMatcher(Type.getType(List.class).getInternalName()); assertMatch(matcher, ArrayList.class, true); assertMatch(matcher, HashMap.class, false); } @Test public void interfaceMatcher2() throws IOException { InterfaceMatcher matcher = new InterfaceMatcher(Collection.class.getName()); assertMatch(matcher, ArrayList.class, true); assertMatch(matcher, Vector.class, true); assertMatch(matcher, Object.class, false); } @Test public void interfaceMatcher_missing() throws IOException { InterfaceMatcher matcher = new InterfaceMatcher("com/test/Dude"); assertMatch(matcher, ArrayList.class, false); assertMatch(matcher, Vector.class, false); assertMatch(matcher, Object.class, false); } @Test public void interfaceMatcher_class() throws IOException { InterfaceMatcher matcher = new InterfaceMatcher(Type.getType(Object.class).getInternalName()); assertMatch(matcher, ArrayList.class, false); assertMatch(matcher, Vector.class, false); assertMatch(matcher, Object.class, false); } @Test public void orMatcherTest() throws IOException { ClassMatcher matcher = new OrClassMatcher(new ExactClassMatcher(intern(String.class)), new ExactClassMatcher( intern(HashSet.class))); assertOrMatcher(matcher); } @Test public void orMatcherStringTest() throws IOException { ClassMatcher matcher = ExactClassMatcher.or(intern(String.class), intern(HashSet.class)); assertOrMatcher(matcher); } @Test public void childClassMatcherTest1() throws IOException { Type type = Type.getType(AbstractList.class); ChildClassMatcher matcher = new ChildClassMatcher(type.getInternalName()); assertMatch(matcher, AbstractList.class, false); assertMatch(matcher, ArrayList.class, true); assertMatch(matcher, Vector.class, true); assertMatch(matcher, AbstractMap.class, false); Assert.assertTrue(matcher.getClassNames().contains(type.getInternalName())); } @Test public void childClassMatcherTest2() throws IOException { String name = "java/util/AbstractList"; String child = "java/util/ArrayList"; ChildClassMatcher matcher = new ChildClassMatcher(name, false, new String[] { child }); assertMatch(matcher, ArrayList.class, true); assertMatch(matcher, Vector.class, true); Assert.assertTrue(matcher.getClassNames().contains(child)); Assert.assertEquals(2, matcher.getClassNames().size()); } @Test public void childClassMatcherTest_missing() throws IOException { String name = "java/util/Dude"; ChildClassMatcher matcher = new ChildClassMatcher(name); assertMatch(matcher, ArrayList.class, false); assertMatch(matcher, Vector.class, false); assertMatch(matcher, AbstractMap.class, false); } @Test public void childClassMatcherTest_object() throws IOException { ChildClassMatcher matcher = new ChildClassMatcher(Type.getType(Object.class).getInternalName()); assertMatch(matcher, ArrayList.class, true); assertMatch(matcher, Vector.class, true); assertMatch(matcher, AbstractMap.class, true); assertMatch(matcher, Collections.class, true); } @Test public void allClasses() throws IOException { ClassMatcher matcher = new AllClassesMatcher(); assertMatch(matcher, ArrayList.class, true); assertMatch(matcher, Vector.class, true); assertMatch(matcher, AbstractMap.class, true); assertMatch(matcher, Collections.class, true); assertMatch(matcher, List.class, false); Assert.assertTrue(matcher.getClassNames().isEmpty()); } private void assertOrMatcher(ClassMatcher matcher) throws IOException { Assert.assertTrue(matcher.isMatch(String.class)); Assert.assertTrue(matcher.isMatch(HashSet.class)); Assert.assertFalse(matcher.isMatch(Collection.class)); Assert.assertTrue(matcher.isMatch(null, getClassReader(HashSet.class))); } private static void assertMatch(ClassMatcher matcher, Class<?> clazz, boolean isMatch) throws IOException { Assert.assertEquals(isMatch, matcher.isMatch(clazz)); ClassReader classReader = getClassReader(clazz); Assert.assertEquals(isMatch, matcher.isMatch(clazz.getClass().getClassLoader(), classReader)); } private String intern(Class<?> clazz) { return Type.getType(clazz).getInternalName(); } public static ClassReader getClassReader(Class<?> clazz) throws IOException { ClassLoader classLoader = clazz.getClassLoader(); if (classLoader == null) { classLoader = ClassLoader.getSystemClassLoader(); } return Utils.readClass(classLoader, clazz.getName().replace('.', '/')); } }
dapperlinux/application-firewall
vendor/github.com/subgraph/go-procsnitch/proc.go
package procsnitch import ( "encoding/hex" "encoding/binary" "errors" "fmt" "github.com/op/go-logging" "io/ioutil" "net" "strconv" "strings" "unsafe" ) var log = logging.MustGetLogger("go-procsockets") var isLittleEndian = -1 // SetLogger allows setting a custom go-logging instance func SetLogger(logger *logging.Logger) { log = logger } var pcache = &pidCache{} // ProcInfo represents an api that can be used to query process information about // the far side of a network connection // Note: this can aid in the construction of unit tests. type ProcInfo interface { LookupTCPSocketProcess(srcPort uint16, dstAddr net.IP, dstPort uint16) *Info LookupUNIXSocketProcess(socketFile string) *Info LookupUDPSocketProcess(srcPort uint16) *Info } // SystemProcInfo represents our real system ProcInfo api. type SystemProcInfo struct { } // LookupTCPSocketProcess returns the process information for a given TCP connection. func (r SystemProcInfo) LookupTCPSocketProcess(srcPort uint16, dstAddr net.IP, dstPort uint16) *Info { return LookupTCPSocketProcess(srcPort, dstAddr, dstPort) } // LookupUNIXSocketProcess returns the process information for a given UNIX socket connection. func (r SystemProcInfo) LookupUNIXSocketProcess(socketFile string) *Info { return LookupUNIXSocketProcess(socketFile) } // LookupUDPSocketProcess returns the process information for a given UDP socket connection. func (r SystemProcInfo) LookupUDPSocketProcess(srcPort uint16) *Info { return LookupUDPSocketProcess(srcPort) } // FindProcessForConnection returns the process information for a given connection. // So far only TCP and UNIX domain socket connections are supported. func FindProcessForConnection(conn net.Conn, procInfo ProcInfo) *Info { var info *Info if conn.LocalAddr().Network() == "tcp" { fields := strings.Split(conn.RemoteAddr().String(), ":") dstPortStr := fields[1] fields = strings.Split(conn.LocalAddr().String(), ":") dstIP := net.ParseIP(fields[0]) srcP, _ := strconv.ParseUint(dstPortStr, 10, 16) dstP, _ := strconv.ParseUint(fields[1], 10, 16) info = procInfo.LookupTCPSocketProcess(uint16(srcP), dstIP, uint16(dstP)) } else if conn.LocalAddr().Network() == "unix" { info = procInfo.LookupUNIXSocketProcess(conn.LocalAddr().String()) } return info } // LookupICMPSocketProcessAll searches for a ICMP socket a given source host, destination IP, and type func LookupICMPSocketProcessAll(srcAddr net.IP, dstAddr net.IP, code int, custdata []string) *Info { ss := findICMPSocketAll(srcAddr, dstAddr, code, custdata) if ss == nil { return nil } return pcache.lookup(ss.inode) } // LookupUDPSocketProcessAll searches for a UDP socket a given source port, destination IP, and destination port - AND source destination func LookupUDPSocketProcessAll(srcAddr net.IP, srcPort uint16, dstAddr net.IP, dstPort uint16, custdata []string, strictness int) *Info { ss := findUDPSocketAll(srcAddr, srcPort, dstAddr, dstPort, custdata, strictness) if ss == nil { return nil } return pcache.lookup(ss.inode) } // LookupUDPSocketProcess searches for a UDP socket with a source port func LookupUDPSocketProcess(srcPort uint16) *Info { ss := findUDPSocket(srcPort) if ss == nil { return nil } return pcache.lookup(ss.inode) } // LookupTCPSocketProcessAll searches for a TCP socket a given source port, destination IP, and destination port - AND source destination func LookupTCPSocketProcessAll(srcAddr net.IP, srcPort uint16, dstAddr net.IP, dstPort uint16, custdata []string) *Info { ss := findTCPSocketAll(srcAddr, srcPort, dstAddr, dstPort, custdata) if ss == nil { return nil } return pcache.lookup(ss.inode) } // LookupTCPSocketProcess searches for a TCP socket with a given source port, destination IP, and destination port func LookupTCPSocketProcess(srcPort uint16, dstAddr net.IP, dstPort uint16) *Info { ss := findTCPSocket(srcPort, dstAddr, dstPort) if ss == nil { return nil } return pcache.lookup(ss.inode) } // LookupUNIXSocketProcess searches for a UNIX domain socket with a given filename func LookupUNIXSocketProcess(socketFile string) *Info { ss := findUNIXSocket(socketFile) if ss == nil { return nil } return pcache.lookup(ss.inode) } type connectionInfo struct { pinfo *Info local *socketAddr remote *socketAddr } func (ci *connectionInfo) String() string { return fmt.Sprintf("%v %s %s", ci.pinfo, ci.local, ci.remote) } func (sa *socketAddr) parse(s string) error { ipPort := strings.Split(s, ":") if len(ipPort) != 2 { return fmt.Errorf("badly formatted socket address field: %s", s) } ip, err := ParseIP(ipPort[0]) if err != nil { return fmt.Errorf("error parsing ip field [%s]: %v", ipPort[0], err) } port, err := ParsePort(ipPort[1]) if err != nil { return fmt.Errorf("error parsing port field [%s]: %v", ipPort[1], err) } sa.ip = ip sa.port = port return nil } // ParseIP parses a string ip to a net.IP func ParseIP(ip string) (net.IP, error) { var result net.IP dst, err := hex.DecodeString(ip) if err != nil { return result, fmt.Errorf("Error parsing IP: %s", err) } // Reverse byte order -- /proc/net/tcp etc. is little-endian // TODO: Does this vary by architecture? if isLittleEndian == -1 { setEndian() } if len(dst) != 4 && len(dst) != 16 { return result, errors.New("Unsupported address type (not IPv4 or IPv16)") } if isLittleEndian > 0 { for i := 0; i < len(dst) / 4; i++ { start, end := i*4, (i+1)*4 word := dst[start:end] lval := binary.LittleEndian.Uint32(word) binary.BigEndian.PutUint32(dst[start:], lval) } } /* if len(dst) == 16 { dst2 := []byte{dst[3], dst[2], dst[1], dst[0], dst[7], dst[6], dst[5], dst[4], dst[11], dst[10], dst[9], dst[8], dst[15], dst[14], dst[13], dst[12]} return net.IP(dst2), nil } for i, j := 0, len(dst)-1; i < j; i, j = i+1, j-1 { dst[i], dst[j] = dst[j], dst[i] } */ return net.IP(dst), nil } // ParsePort parses a base16 port represented as a string to a uint16 func ParsePort(port string) (uint16, error) { p64, err := strconv.ParseInt(port, 16, 32) if err != nil { return 0, fmt.Errorf("Error parsing port: %s", err) } return uint16(p64), nil } func getConnections() ([]*connectionInfo, error) { conns, err := readConntrack() if err != nil { return nil, err } resolveProcinfo(conns) return conns, nil } func resolveProcinfo(conns []*connectionInfo) { var sockets []*socketStatus for _, line := range getSocketLines("tcp") { if len(strings.TrimSpace(line)) == 0 { continue } ss := new(socketStatus) if err := ss.parseLine(line); err != nil { log.Warningf("Unable to parse line [%s]: %v", line, err) } /* else { /* pid := findPidForInode(ss.inode) if pid > 0 { ss.pid = pid fmt.Println("Socket", ss) sockets = append(sockets, ss) } }*/ } for _, ci := range conns { ss := findContrackSocket(ci, sockets) if ss == nil { continue } pinfo := pcache.lookup(ss.inode) if pinfo != nil { ci.pinfo = pinfo } } } func findContrackSocket(ci *connectionInfo, sockets []*socketStatus) *socketStatus { for _, ss := range sockets { if ss.local.port == ci.local.port && ss.remote.ip.Equal(ci.remote.ip) && ss.remote.port == ci.remote.port { return ss } } return nil } func readConntrack() ([]*connectionInfo, error) { path := fmt.Sprintf("/proc/net/ip_conntrack") data, err := ioutil.ReadFile(path) if err != nil { return nil, err } var result []*connectionInfo lines := strings.Split(string(data), "\n") for _, line := range lines { ci, err := parseConntrackLine(line) if err != nil { return nil, err } if ci != nil { result = append(result, ci) } } return result, nil } func parseConntrackLine(line string) (*connectionInfo, error) { parts := strings.Fields(line) if len(parts) < 8 || parts[0] != "tcp" || parts[3] != "ESTABLISHED" { return nil, nil } local, err := conntrackAddr(parts[4], parts[6]) if err != nil { return nil, err } remote, err := conntrackAddr(parts[5], parts[7]) if err != nil { return nil, err } return &connectionInfo{ local: local, remote: remote, }, nil } func conntrackAddr(ipStr, portStr string) (*socketAddr, error) { ip := net.ParseIP(stripLabel(ipStr)) if ip == nil { return nil, errors.New("Could not parse IP: " + ipStr) } i64, err := strconv.Atoi(stripLabel(portStr)) if err != nil { return nil, err } return &socketAddr{ ip: ip, port: uint16(i64), }, nil } func stripLabel(s string) string { idx := strings.Index(s, "=") if idx == -1 { return s } return s[idx+1:] } // stolen from github.com/virtao/GoEndian const INT_SIZE int = int(unsafe.Sizeof(0)) func setEndian() { var i int = 0x1 bs := (*[INT_SIZE]byte)(unsafe.Pointer(&i)) if bs[0] == 0 { isLittleEndian = 0 } else { isLittleEndian = 1 } }
yuanliangding/qxcmp-framework
qxcmp-core/src/main/java/com/qxcmp/finance/OrderStatusEnum.java
package com.qxcmp.finance; /** * 平台订单状态枚举类型 * <p> * 可以表示以下订单状态 * <p> * <ol> <li>新订单: 由系统刚创建订单对象时的状态</li> <li>待付款: 订单已经生成,等待用户付款</li> <li>已付款: 用户已经付款,等待系统处理订单</li> <li>取消中: * 用户申请取消订单后的状态</li> <li>已取消: 审核要取消的订单,同意以后订单将标记为已取消状态,已取消的订单将不能继续使用</li> <li>已完成: * 表明订单已经完成,可能是系统后台标记完成,也可以是用户手动确认订单完成</li> </ol> * * @author aaric */ public enum OrderStatusEnum { /** * 已付款但是还未处理的订单 */ PAYED("已付款"), /** * 用户申请取消还未处理的订单 */ CANCELLING("取消中"), /** * 订单状态错误 */ EXCEPTION("订单异常"), /** * 用户已下单但是还未付款 */ PAYING("待付款"), /** * 已经成功取消的订单 */ CANCELED("已取消"), /** * 已经完成的订单 */ FINISHED("已完成"), /** * 系统刚生成的订单 */ NEW("新订单"), /** * 已经过期的订单 */ EXPIRED("已过期"); private String value; OrderStatusEnum(String value) { this.value = value; } public String getValue() { return value; } }
0xflotus/postgres-async-driver
src/main/java/com/github/pgasync/PgColumn.java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.pgasync; /** * Column index/type pair. * * @author <NAME> */ public class PgColumn { private final int index; private final String name; private final Oid type; public PgColumn(int index, String name, Oid type) { this.index = index; this.name = name; this.type = type; } public Oid getType() { return type; } public String getName() { return name; } public int at() { return index; } }
darthjee/azeroth
spec/support/factories/product.rb
<reponame>darthjee/azeroth<filename>spec/support/factories/product.rb # frozen_string_literal: true FactoryBot.define do factory :product, class: '::Product' do sequence(:name) { |n| "Product ###{n}" } association :factory end end
justinctlam/MarbleStrike
game/tools/guieditor/source/commandmove.cpp
<filename>game/tools/guieditor/source/commandmove.cpp ////////////////////////////////////////////////////// // INCLUDES ////////////////////////////////////////////////////// #include "commandmove.hpp" #include "common/game/guieditor/guieditorapp.hpp" #include "guieditor.hpp" ////////////////////////////////////////////////////// // GLOBALS ////////////////////////////////////////////////////// ////////////////////////////////////////////////////// // CLASS METHODS ////////////////////////////////////////////////////// CommandMove::CommandMove( GuiEditorApp* guiEditorApp ) : Command( guiEditorApp, COMMAND_MOVE ) { } //=========================================================================== CommandMove::~CommandMove() { } //=========================================================================== void CommandMove::Execute() { } //=========================================================================== void CommandMove::Undo() { GuiControl* control = mGuiEditorApp->GetGuiControl( mID ); if ( control ) { control->GoToKeyFrame( mFrame ); control->SetX( mOldPosition[0] ); control->SetY( mOldPosition[1] ); } }
aveprev/link-rest
src/test/java/com/nhl/link/rest/meta/LrjEntityBuilderTest.java
<reponame>aveprev/link-rest package com.nhl.link.rest.meta; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import org.junit.Test; import com.nhl.link.rest.it.fixture.pojo.model.P3; import com.nhl.link.rest.it.fixture.pojo.model.P4; import com.nhl.link.rest.it.fixture.pojo.model.P5; public class LrjEntityBuilderTest { @Test public void testToPropertyName() { LrEntityBuilder<P3> builder = LrEntityBuilder.builder(P3.class); assertNull(builder.toPropertyName("get")); assertNull(builder.toPropertyName("xyz")); assertNull(builder.toPropertyName("setXyz")); assertNull(builder.toPropertyName("getxyz")); assertEquals("x", builder.toPropertyName("getX")); assertEquals("xyz", builder.toPropertyName("getXyz")); assertEquals("xyzAbc", builder.toPropertyName("getXyzAbc")); assertEquals("xyz", builder.toPropertyName("isXyz")); } @Test public void testBuild_Default() { LrEntity<P3> p3e = LrEntityBuilder.build(P3.class); assertNotNull(p3e); assertEquals("P3", p3e.getName()); assertEquals(0, p3e.getRelationships().size()); assertEquals(1, p3e.getAttributes().size()); LrAttribute name = p3e.getAttribute("name"); assertNotNull(name); assertEquals("name", name.getName()); assertEquals("java.lang.String", name.getJavaType()); } @Test public void testToOneRelationship() { LrEntity<P4> p4e = LrEntityBuilder.build(P4.class); assertNotNull(p4e); assertEquals("P4", p4e.getName()); assertEquals(1, p4e.getRelationships().size()); assertEquals(0, p4e.getAttributes().size()); LrRelationship p3r = p4e.getRelationship("p3"); assertNotNull(p3r); assertEquals(P3.class, p3r.getTargetEntityType()); assertFalse(p3r.isToMany()); } @Test public void testToManyRelationship() { LrEntity<P5> p5e = LrEntityBuilder.build(P5.class); assertNotNull(p5e); assertEquals("P5", p5e.getName()); assertEquals(1, p5e.getRelationships().size()); assertEquals(0, p5e.getAttributes().size()); LrRelationship p4sr = p5e.getRelationship("p4s"); assertNotNull(p4sr); assertEquals(P4.class, p4sr.getTargetEntityType()); assertTrue(p4sr.isToMany()); } }
qianbinbin/leetcode
cpp/src/SearchInRotatedSortedArray.cpp
#include "SearchInRotatedSortedArray.h" using namespace lcpp; int Solution33_1::search(std::vector<int> &nums, int target) { auto Low = nums.begin(), High = nums.end() - 1; while (Low <= High) { auto Mid = Low + (High - Low) / 2; if (*Mid == target) return Mid - nums.begin(); if (*Low <= *Mid) { if (*Low <= target && target < *Mid) High = Mid - 1; else Low = Mid + 1; } else { if (*Mid < target && target <= *High) Low = Mid + 1; else High = Mid - 1; } } return -1; }
r00ster91/serenity
Userland/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.slice.js
<gh_stars>1000+ const TYPED_ARRAYS = [ Uint8Array, Uint8ClampedArray, Uint16Array, Uint32Array, Int8Array, Int16Array, Int32Array, Float32Array, Float64Array, ]; const BIGINT_TYPED_ARRAYS = [BigUint64Array, BigInt64Array]; test("basic functionality", () => { TYPED_ARRAYS.forEach(T => { expect(T.prototype.slice).toHaveLength(2); const typedArray = new T(3); typedArray[0] = 1; typedArray[1] = 2; typedArray[2] = 3; const first_slice = typedArray.slice(1, 2); expect(first_slice).toHaveLength(1); expect(first_slice[0]).toBe(2); const second_slice = typedArray.slice(3, 1); expect(second_slice).toHaveLength(0); }); BIGINT_TYPED_ARRAYS.forEach(T => { expect(T.prototype.slice).toHaveLength(2); const typedArray = new T(3); typedArray[0] = 1n; typedArray[1] = 2n; typedArray[2] = 3n; const first_slice = typedArray.slice(1, 2); expect(first_slice).toHaveLength(1); expect(first_slice[0]).toBe(2n); const second_slice = typedArray.slice(3, 1); expect(second_slice).toHaveLength(0); }); });
Vivian7755/joyqueue
joyqueue-console/joyqueue-data/joyqueue-data-service/src/main/java/io/chubao/joyqueue/service/impl/BrokerServiceImpl.java
<gh_stars>0 /** * Copyright 2019 The JoyQueue Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.chubao.joyqueue.service.impl; import io.chubao.joyqueue.model.ListQuery; import io.chubao.joyqueue.model.PageResult; import io.chubao.joyqueue.model.QPageQuery; import io.chubao.joyqueue.model.domain.Broker; import io.chubao.joyqueue.model.domain.BrokerGroupRelated; import io.chubao.joyqueue.model.domain.PartitionGroupReplica; import io.chubao.joyqueue.model.domain.Topic; import io.chubao.joyqueue.model.query.QBroker; import io.chubao.joyqueue.model.query.QBrokerGroupRelated; import io.chubao.joyqueue.model.query.QPartitionGroupReplica; import io.chubao.joyqueue.nsr.BrokerNameServerService; import io.chubao.joyqueue.service.BrokerGroupRelatedService; import io.chubao.joyqueue.service.BrokerService; import io.chubao.joyqueue.service.PartitionGroupReplicaService; import io.chubao.joyqueue.util.NullUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.TreeSet; import java.util.stream.Collectors; import static java.util.Comparator.comparing; /** * @author wylixiaobin * Date: 2018/10/17 */ @Service("brokerService") public class BrokerServiceImpl implements BrokerService { private final Logger logger = LoggerFactory.getLogger(BrokerServiceImpl.class); @Autowired protected BrokerNameServerService brokerNameServerService; @Autowired private BrokerGroupRelatedService brokerGroupRelatedService; @Autowired private PartitionGroupReplicaService partitionGroupReplicaService; @Override public Broker findById(Long id) throws Exception { return brokerNameServerService.findById(id); } @Override public List<Broker> findByTopic(String topic) throws Exception { QPartitionGroupReplica qReplica = new QPartitionGroupReplica(); qReplica.setTopic(new Topic(topic)); List<PartitionGroupReplica> replicas = partitionGroupReplicaService.findByQuery(qReplica); if (NullUtil.isEmpty(replicas)) { logger.error(String.format("can not find partitionGroup by topic, topic is %s", topic)); return null; } return replicas.stream().map(replica -> { try { return this.findById(new Long(replica.getBrokerId())); } catch (Exception e) { logger.error(String.format("can not find broker with id %s"), replica.getBroker().getId()); return null; } }).collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(comparing(Broker::getId))), ArrayList::new)); } @Override public PageResult<Broker> findByQuery(QPageQuery<QBroker> query) { try { if(query != null && query.getQuery() != null) { List<Long> brokerIds = getBrokerIdByGroupIds(query.getQuery()); if (brokerIds == null) { return PageResult.empty(); } query.getQuery().setInBrokerIds(brokerIds); } PageResult<Broker> pageResult = brokerNameServerService.findByQuery(query); if (pageResult !=null && pageResult.getResult() != null && pageResult.getResult().size() >0) { List<Broker> brokerList = pageResult.getResult(); brokerList.stream().map(broker -> { BrokerGroupRelated brokerRelated = brokerGroupRelatedService.findById(broker.getId()); if (brokerRelated != null && brokerRelated.getGroup() != null) { broker.setGroup(brokerRelated.getGroup()); broker.setStatus(0); } return broker; }).collect(Collectors.toList()); } return pageResult; } catch (Exception e) { logger.error("findByQuery error",e); throw new RuntimeException("findByQuery error",e); } } @Override public int add(Broker model) { try { return brokerNameServerService.add(model); } catch (Exception e) { logger.error("add error",e); } return 0; } @Override public int delete(Broker model) { try { return brokerNameServerService.delete(model); } catch (Exception e) { logger.error("delete error",e); } return 0; } @Override public int update(Broker model) { try { return brokerNameServerService.update(model); } catch (Exception e) { logger.error("update error",e); } return 0; } @Override public List<Broker> findByQuery(QBroker query) throws Exception { if(query != null) { query.setInBrokerIds(getBrokerIdByGroupIds(query)); } return brokerNameServerService.findByQuery(query); } @Override public List<Broker> queryBrokerList(QBroker qBroker) throws Exception { ListQuery<QBrokerGroupRelated> brokerListQuery = new ListQuery<>(); QBrokerGroupRelated qBrokerGroupRelated = new QBrokerGroupRelated(); qBrokerGroupRelated.setGroup(qBroker.getGroup()); brokerListQuery.setQuery(qBrokerGroupRelated); List<BrokerGroupRelated> brokerList = brokerGroupRelatedService.findByQuery(brokerListQuery); if (brokerList != null && brokerList.size() > 0) { List<Long> brokerIdList = brokerList.stream().map(broker -> broker.getId()).collect(Collectors.toList()); qBroker.setInBrokerIds(brokerIdList); } else { if (qBrokerGroupRelated.getGroup() != null) { return new ArrayList<>(); } } return brokerNameServerService.findByQuery(qBroker); } /** * 通过组获取brokerIds * @param query * @return */ private List<Long> getBrokerIdByGroupIds(QBroker query) { if (query.getBrokerGroupId() > 0) { Integer brokerGroupId = Math.toIntExact(query.getBrokerGroupId()); if (query.getBrokerGroupIds() != null) { query.getBrokerGroupIds().add(brokerGroupId); } else { query.setBrokerGroupIds(Arrays.asList(brokerGroupId)); } } if(query.getBrokerGroupIds() != null && query.getBrokerGroupIds().size() > 0) { ListQuery<QBrokerGroupRelated> brokerListQuery = new ListQuery<>(); QBrokerGroupRelated qBrokerGroupRelated = new QBrokerGroupRelated(); //数据库查询 qBrokerGroupRelated.setBrokerGroupIds(query.getBrokerGroupIds()); qBrokerGroupRelated.setNotInBrokerIds(query.getNotInBrokerIds()); brokerListQuery.setQuery(qBrokerGroupRelated); List<BrokerGroupRelated> brokerList = brokerGroupRelatedService.findByQuery(brokerListQuery); if (brokerList != null && brokerList.size() > 0) { List<Long> brokerIdList = brokerList.stream().map(broker -> broker.getId()).collect(Collectors.toList()); return brokerIdList; } else { //查询到0个 broker 则直接返回 return null; } } return new ArrayList<>(); } @Override public List<Broker> getByIdsBroker(List<Integer> ids) throws Exception { return brokerNameServerService.getByIdsBroker(ids); } @Override public List<Broker> syncBrokers() throws Exception { return brokerNameServerService.syncBrokers(); } }
minyez/cpp-primer-plus-6th
ch10/plorg.cpp
/* * Date : 2022-03-18 22:51:44 * Author: <NAME> * Usage : * TODO : */ #include <cstring> #include <iostream> #include "plorg.h" Plorg::Plorg(const char *name, int ci) { std::strcpy(m_name, name); m_ci = ci; } void Plorg::report() const { std::cout << "plorg - name: " << m_name << ", CI: " << m_ci << std::endl; } void Plorg::setCI(int ci) { this->m_ci = ci; }
Nobergan/js-scripts
js/trainning/trainning7.js
// Нужно написать условие для действий пешехода при различных сигналах светофора. // Если сигнал красный, то надо стоять, иначе, если желтый - надо приготовиться, а иначе - можно идти. const red = 'нет'; const yellow = 'да'; let message; if (red === 'да') { message = 'При красном сигнале стоим - дорогу переходить нельзя!'; } else if (yellow === 'да') { message = 'При жёлтом сигнале нужно приготовиться, но дорогу пока переходить нельзя!'; } else { message = 'Зелёный сигнал - переходим дорогу.'; } console.log(message);
qualitesys/openssl-1
docs/QcrReportFile01File686detailjsondata.js
<filename>docs/QcrReportFile01File686detailjsondata.js console.log('leListeStr main01 start json de data maDataBlocs'); var maDataBlocs = { "data00" : { "fic1" : "./qc/crypto/sha/sha1dgst.c.html" , "texte" : "File crypto/sha/sha1dgst.c 409 rule violations " , "fic2" : "./qc/crypto/sha/sha1dgst.c.xml" , "fic3" : "" } , "data01" : [ ] , "data02" : [ ] , "data03" : [ ] , "data04" : [ ] , "data05" : [ ] , "data06" : [ ] , "data07" : [ ] , "data08" : [ ] , "data11" : [ ] , "data14" : [ ] , "data13a" : [ { "ligne" : { "c1" : "BLOCKER" , "c2" : "QC-CPP000001" , "c3" : "Confusing use of the + unary expression" , "c4" : "96" }} , { "ligne" : { "c1" : "BLOCKER" , "c2" : "QC-CPP000005" , "c3" : "Check pointer declaration to unsigned char" , "c4" : "4" }} , { "ligne" : { "c1" : "BLOCKER" , "c2" : "QC-CPP000006" , "c3" : "Risk of infinite while loop" , "c4" : "3" }} , { "ligne" : { "c1" : "BLOCKER" , "c2" : "QC-CPP000012" , "c3" : "The condition expression is invariable, always true or false" , "c4" : "17" }} , { "ligne" : { "c1" : "BLOCKER" , "c2" : "QC-CPP000018" , "c3" : "A suspicious bitwise expression is compared to a numerical expression" , "c4" : "3" }} , { "ligne" : { "c1" : "MAJOR" , "c2" : "QC-CPPCWE481" , "c3" : "Assigning instead of comparing" , "c4" : "284" }} , { "ligne" : { "c1" : "MAJOR" , "c2" : "QC-CPP000014" , "c3" : "A pointer is defined but not initialized" , "c4" : "2" }} ] , "data13b" : [ { "ligne" : { "c1" : "01219" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1219" , "c2" : "MAJOR" , "c3" : "QC-CPP000014[01219] The pointer __p is declared but not initialized" }} , { "ligne" : { "c1" : "01382" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1382" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01382] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01409" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1409" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01409] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01413" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1413" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01413] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01435" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1435" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01435] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01435" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1435" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01435] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01459" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1459" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01459] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01465" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1465" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01465] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01490" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1490" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01490] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "01494" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#1494" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[01494] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "02723" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2723" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[02723] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "02728" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2728" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[02728] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "02753" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2753" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[02753] The expression 0 is invariable, always false" }} , { "ligne" : { "c1" : "02757" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2757" , "c2" : "BLOCKER" , "c3" : "QC-CPP000018[02757] Suspicious mix of Bitwise and Literal expressions in (__size|__n)&gt;=(((size_t )1)&lt;&lt;(8 * sizeof (size_t)/2))" }} , { "ligne" : { "c1" : "02760" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2760" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[02760] The expression 0 is invariable, always false" }} , { "ligne" : { "c1" : "02785" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2785" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[02785] The expression 0 is invariable, always false" }} , { "ligne" : { "c1" : "02789" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2789" , "c2" : "BLOCKER" , "c3" : "QC-CPP000018[02789] Suspicious mix of Bitwise and Literal expressions in (__size|__n)&gt;=(((size_t )1)&lt;&lt;(8 * sizeof (size_t)/2))" }} , { "ligne" : { "c1" : "02793" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2793" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[02793] The expression 0 is invariable, always false" }} , { "ligne" : { "c1" : "02801" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#2801" , "c2" : "BLOCKER" , "c3" : "QC-CPP000018[02801] Suspicious mix of Bitwise and Literal expressions in (__size|__n)&lt;(((size_t )1)&lt;&lt;(8 * sizeof (size_t)/2))" }} , { "ligne" : { "c1" : "08176" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8176" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[08176] The expression 2&gt;1 is invariable" }} , { "ligne" : { "c1" : "08223" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8223" , "c2" : "BLOCKER" , "c3" : "QC-CPP000005[08223] Suspicious declaration of a pointer to unsigned char, in case of memcpy" }} , { "ligne" : { "c1" : "08224" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8224" , "c2" : "MAJOR" , "c3" : "QC-CPP000014[08224] The pointer p is declared but not initialized" }} , { "ligne" : { "c1" : "08224" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8224" , "c2" : "BLOCKER" , "c3" : "QC-CPP000005[08224] Suspicious declaration of a pointer to unsigned char, in case of memcpy" }} , { "ligne" : { "c1" : "08286" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8286" , "c2" : "BLOCKER" , "c3" : "QC-CPP000005[08286] Suspicious declaration of a pointer to unsigned char, in case of memcpy" }} , { "ligne" : { "c1" : "08301" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8301" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08301] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08301" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8301" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08301] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08301" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8301" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08301] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08301" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8301" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08301] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08302" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8302" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08302] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08302" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8302" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08302] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08302" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8302" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08302] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08302" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8302" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08302] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08315] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "BLOCKER" , "c3" : "QC-CPP000006[08315] The condition of do while loop is always false. The loop body is run once only do{} while (0);" }} , { "ligne" : { "c1" : "08315" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8315" , "c2" : "BLOCKER" , "c3" : "QC-CPP000012[08315] The expression 0 is invariable, always false" }} , { "ligne" : { "c1" : "08341" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8341" , "c2" : "BLOCKER" , "c3" : "QC-CPP000005[08341] Suspicious declaration of a pointer to unsigned char, in case of memcpy" }} , { "ligne" : { "c1" : "08356" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8356" , "c2" : "BLOCKER" , "c3" : "QC-CPP000006[08356] The condition of for loop is empty, infinite loop risk" }} , { "ligne" : { "c1" : "08356" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8356" , "c2" : "BLOCKER" , "c3" : "QC-CPP000006[08356] The end expression of for loop is empty, infinite loop risk" }} , { "ligne" : { "c1" : "08365" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8365" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08365] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08367" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8367" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08367] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08369" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8369" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08369] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08371" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8371" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08371] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08373" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8373" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08373] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08375" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8375" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08375] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08377" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8377" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08377] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08379" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8379" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08379] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08381" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8381" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08381] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08383" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8383" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08383] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08385" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8385" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08385] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08387" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8387" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08387] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08389" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8389" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08389] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08391" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8391" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08391] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08393" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8393" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08393] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08394" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8394" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08394] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08398" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8398" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08398] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08398" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8398" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08398] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08398" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8398" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08398] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08398" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8398" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08398] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08400" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8400" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08400] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08400" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8400" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08400] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08400" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8400" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08400] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08400" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8400" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08400] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08402" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8402" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08402] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08403" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8403" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08403] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08403" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8403" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08403] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08403" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8403" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08403] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08403" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8403" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08403] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08405" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8405" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08405] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08406" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8406" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08406] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08406" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8406" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08406] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08406" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8406" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08406] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08406" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8406" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08406] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08408" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8408" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08408] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08409" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8409" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08409] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08409" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8409" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08409] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08409" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8409" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08409] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08409" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8409" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08409] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08411" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8411" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08411] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08412" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8412" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08412] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08412" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8412" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08412] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08412" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8412" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08412] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08412" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8412" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08412] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08414" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8414" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08414] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08415" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8415" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08415] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08415" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8415" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08415] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08415" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8415" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08415] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08415" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8415" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08415] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08417" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8417" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08417] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08418" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8418" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08418] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08418" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8418" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08418] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08418" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8418" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08418] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08418" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8418" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08418] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08420" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8420" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08420] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08421" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8421" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08421] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08421" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8421" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08421] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08421" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8421" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08421] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08421" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8421" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08421] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08423" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8423" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08423] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08424" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8424" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08424] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08424" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8424" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08424] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08424" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8424" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08424] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08424" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8424" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08424] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08426" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8426" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08426] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08427" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8427" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08427] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08427" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8427" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08427] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08427" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8427" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08427] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08427" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8427" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08427] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08429" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8429" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08429] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08430" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8430" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08430] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08430" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8430" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08430] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08430" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8430" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08430] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08430" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8430" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08430] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08432" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8432" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08432] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08433" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8433" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08433] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08433" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8433" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08433] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08433" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8433" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08433] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08433" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8433" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08433] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08435" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8435" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08435] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08436" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8436" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08436] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08436" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8436" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08436] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08436" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8436" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08436] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08436" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8436" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08436] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08438" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8438" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08438] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08439" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8439" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08439] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08439" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8439" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08439] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08439" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8439" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08439] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08439" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8439" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08439] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08441" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8441" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08441] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08442" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8442" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08442] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08442" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8442" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08442] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08442" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8442" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08442] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08442" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8442" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08442] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08444" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8444" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08444] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08445" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8445" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08445] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08448" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8448" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08448] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08448" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8448" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08448] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08448" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8448" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08448] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08448" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8448" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08448] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08449" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8449" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08449] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08449" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8449" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08449] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08449" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8449" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08449] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08449" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8449" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08449] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08450" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8450" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08450] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08450" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8450" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08450] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08450" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8450" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08450] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08450" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8450" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08450] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08451" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8451" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08451] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08451" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8451" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08451] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08451" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8451" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08451] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08451" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8451" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08451] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08453" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8453" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08453] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08453" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8453" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08453] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08453" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8453" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08453] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08453" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8453" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08453] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08454" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8454" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08454] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08454" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8454" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08454] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08454" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8454" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08454] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08454" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8454" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08454] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08455" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8455" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08455] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08455" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8455" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08455] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08455" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8455" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08455] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08455" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8455" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08455] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08456" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8456" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08456] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08456" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8456" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08456] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08456" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8456" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08456] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08456" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8456" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08456] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08457" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8457" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08457] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08457" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8457" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08457] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08457" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8457" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08457] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08457" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8457" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08457] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08458" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8458" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08458] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08458" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8458" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08458] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08458" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8458" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08458] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08458" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8458" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08458] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08459" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8459" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08459] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08459" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8459" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08459] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08459" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8459" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08459] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08459" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8459" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08459] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08460" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8460" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08460] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08460" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8460" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08460] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08460" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8460" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08460] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08460" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8460" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08460] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08461" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8461" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08461] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08461" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8461" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08461] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08461" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8461" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08461] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08461" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8461" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08461] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08462" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8462" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08462] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08462" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8462" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08462] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08462" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8462" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08462] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08462" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8462" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08462] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08463" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8463" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08463] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08463" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8463" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08463] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08463" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8463" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08463] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08463" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8463" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08463] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08464" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8464" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08464] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08464" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8464" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08464] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08464" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8464" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08464] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08464" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8464" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08464] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08466" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8466" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08466] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08466" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8466" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08466] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08466" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8466" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08466] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08466" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8466" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08466] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08467" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8467" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08467] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08467" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8467" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08467] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08467" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8467" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08467] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08467" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8467" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08467] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08468" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8468" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08468] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08468" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8468" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08468] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08468" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8468" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08468] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08468" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8468" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08468] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08469" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8469" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08469] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08469" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8469" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08469] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08469" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8469" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08469] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08469" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8469" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08469] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08470" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8470" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08470] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08470" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8470" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08470] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08470" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8470" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08470] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08470" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8470" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08470] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08471" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8471" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08471] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08471" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8471" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08471] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08471" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8471" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08471] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08471" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8471" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08471] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08472" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8472" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08472] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08472" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8472" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08472] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08472" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8472" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08472] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08472" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8472" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08472] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08473" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8473" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08473] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08473" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8473" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08473] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08473" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8473" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08473] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08473" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8473" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08473] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08475" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8475" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08475] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08475" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8475" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08475] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08475" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8475" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08475] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08475" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8475" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08475] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08476" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8476" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08476] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08476" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8476" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08476] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08476" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8476" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08476] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08476" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8476" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08476] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08477" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8477" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08477] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08477" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8477" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08477] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08477" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8477" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08477] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08477" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8477" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08477] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08478" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8478" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08478] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08478" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8478" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08478] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08478" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8478" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08478] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08478" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8478" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08478] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08479" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8479" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08479] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08479" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8479" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08479] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08479" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8479" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08479] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08479" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8479" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08479] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08480" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8480" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08480] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08480" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8480" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08480] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08480" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8480" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08480] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08480" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8480" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08480] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08481" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8481" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08481] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08481" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8481" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08481] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08481" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8481" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08481] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08481" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8481" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08481] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08482" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8482" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08482] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08482" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8482" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08482] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08482" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8482" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08482] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08482" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8482" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08482] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08483" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8483" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08483] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08483" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8483" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08483] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08483" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8483" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08483] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08483" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8483" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08483] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08484" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8484" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08484] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08484" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8484" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08484] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08484" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8484" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08484] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08484" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8484" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08484] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08485" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8485" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08485] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08485" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8485" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08485] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08485" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8485" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08485] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08485" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8485" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08485] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08486" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8486" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08486] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08486" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8486" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08486] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08486" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8486" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08486] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08486" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8486" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08486] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08487" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8487" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08487] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08487" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8487" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08487] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08487" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8487" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08487] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08487" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8487" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08487] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08488" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8488" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08488] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08488" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8488" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08488] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08488" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8488" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08488] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08488" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8488" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08488] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08489" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8489" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08489] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08489" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8489" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08489] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08489" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8489" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08489] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08489" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8489" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08489] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08490" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8490" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08490] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08490" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8490" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08490] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08490" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8490" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08490] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08490" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8490" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08490] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08491" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8491" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08491] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08491" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8491" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08491] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08491" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8491" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08491] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08491" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8491" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08491] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08492" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8492" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08492] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08492" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8492" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08492] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08492" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8492" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08492] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08492" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8492" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08492] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08493" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8493" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08493] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08493" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8493" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08493] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08493" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8493" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08493] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08493" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8493" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08493] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08494" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8494" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08494] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08494" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8494" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08494] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08494" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8494" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08494] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08494" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8494" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08494] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08496" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8496" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08496] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08496" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8496" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08496] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08496" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8496" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08496] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08496" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8496" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08496] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08497" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8497" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08497] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08497" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8497" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08497] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08497" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8497" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08497] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08497" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8497" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08497] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08498" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8498" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08498] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08498" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8498" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08498] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08498" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8498" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08498] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08498" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8498" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08498] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08499" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8499" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08499] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08499" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8499" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08499] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08499" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8499" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08499] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08499" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8499" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08499] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08500" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8500" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08500] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08500" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8500" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08500] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08500" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8500" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08500] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08500" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8500" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08500] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08501" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8501" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08501] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08501" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8501" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08501] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08501" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8501" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08501] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08501" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8501" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08501] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08502" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8502" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08502] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08502" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8502" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08502] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08502" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8502" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08502] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08502" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8502" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08502] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08503" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8503" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08503] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08503" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8503" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08503] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08503" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8503" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08503] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08503" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8503" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08503] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08504" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8504" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08504] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08504" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8504" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08504] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08504" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8504" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08504] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08504" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8504" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08504] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08505" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8505" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08505] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08505" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8505" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08505] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08505" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8505" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08505] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08505" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8505" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08505] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08506" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8506" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08506] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08506" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8506" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08506] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08506" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8506" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08506] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08506" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8506" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08506] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08507" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8507" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08507] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08507" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8507" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08507] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08507" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8507" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08507] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08507" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8507" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08507] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08508" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8508" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08508] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08508" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8508" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08508] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08508" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8508" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08508] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08508" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8508" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08508] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08509" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8509" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08509] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08509" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8509" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08509] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08509" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8509" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08509] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08509" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8509" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08509] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08510" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8510" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08510] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08510" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8510" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08510] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08510" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8510" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08510] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08510" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8510" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08510] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08511" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8511" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08511] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08511" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8511" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08511] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08511" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8511" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08511] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08511" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8511" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08511] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08512" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8512" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08512] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08512" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8512" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08512] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08512" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8512" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08512] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08512" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8512" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08512] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08513" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8513" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08513] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08513" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8513" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08513] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08513" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8513" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08513] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08513" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8513" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08513] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08514" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8514" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08514] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08514" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8514" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08514] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08514" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8514" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08514] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08514" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8514" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08514] The unary operator + should be avoided, confusing" }} , { "ligne" : { "c1" : "08515" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8515" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08515] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08515" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8515" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08515] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08515" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8515" , "c2" : "MAJOR" , "c3" : "QC-CPPCWE481[08515] Assigning instead of comparing (see http://cwe.mitre.org/data/definitions/481.html)" }} , { "ligne" : { "c1" : "08515" , "c1link" : "./qc/crypto/sha/sha1dgst.c.html#8515" , "c2" : "BLOCKER" , "c3" : "QC-CPP000001[08515] The unary operator + should be avoided, confusing" }} ] }; console.log('leListeStr 99 main end');
MiftahurRidho/tugas
cairo/src/cairo-xlib-screen.c
/* Cairo - a vector graphics library with display and print output * * Copyright © 2005 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it either under the terms of the GNU Lesser General Public * License version 2.1 as published by the Free Software Foundation * (the "LGPL") or, at your option, under the terms of the Mozilla * Public License Version 1.1 (the "MPL"). If you do not alter this * notice, a recipient may use your version of this file under either * the MPL or the LGPL. * * You should have received a copy of the LGPL along with this library * in the file COPYING-LGPL-2.1; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA * You should have received a copy of the MPL along with this library * in the file COPYING-MPL-1.1 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY * OF ANY KIND, either express or implied. See the LGPL or the MPL for * the specific language governing rights and limitations. * * The Original Code is the cairo graphics library. * * The Initial Developer of the Original Code is Red Hat, Inc. * * Partially on code from xftdpy.c * * Copyright © 2000 <NAME> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * <NAME> DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL <NAME> BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include "cairoint.h" #include "cairo-xlib-private.h" #include "cairo-xlib-xrender-private.h" #include "cairo-xlib-surface-private.h" #include "cairo-error-private.h" #include "cairo-fontconfig-private.h" static int parse_boolean (const char *v) { char c0, c1; c0 = *v; if (c0 == 't' || c0 == 'T' || c0 == 'y' || c0 == 'Y' || c0 == '1') return 1; if (c0 == 'f' || c0 == 'F' || c0 == 'n' || c0 == 'N' || c0 == '0') return 0; if (c0 == 'o') { c1 = v[1]; if (c1 == 'n' || c1 == 'N') return 1; if (c1 == 'f' || c1 == 'F') return 0; } return -1; } static cairo_bool_t get_boolean_default (Display *dpy, const char *option, cairo_bool_t *value) { char *v; int i; v = XGetDefault (dpy, "Xft", option); if (v) { i = parse_boolean (v); if (i >= 0) { *value = i; return TRUE; } } return FALSE; } static cairo_bool_t get_integer_default (Display *dpy, const char *option, int *value) { char *v, *e; v = XGetDefault (dpy, "Xft", option); if (v) { #if CAIRO_HAS_FC_FONT if (FcNameConstant ((FcChar8 *) v, value)) return TRUE; #endif *value = strtol (v, &e, 0); if (e != v) return TRUE; } return FALSE; } static void _cairo_xlib_init_screen_font_options (Display *dpy, cairo_xlib_screen_t *info) { cairo_bool_t xft_hinting; cairo_bool_t xft_antialias; int xft_hintstyle; int xft_rgba; int xft_lcdfilter; cairo_antialias_t antialias; cairo_subpixel_order_t subpixel_order; cairo_lcd_filter_t lcd_filter; cairo_hint_style_t hint_style; if (!get_boolean_default (dpy, "antialias", &xft_antialias)) xft_antialias = TRUE; if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) { /* -1 is an non-existant Fontconfig constant used to differentiate * the case when no lcdfilter property is available. */ xft_lcdfilter = -1; } if (!get_boolean_default (dpy, "hinting", &xft_hinting)) xft_hinting = TRUE; if (!get_integer_default (dpy, "hintstyle", &xft_hintstyle)) xft_hintstyle = FC_HINT_FULL; if (!get_integer_default (dpy, "rgba", &xft_rgba)) { cairo_xlib_display_t *display = (cairo_xlib_display_t *) info->device; xft_rgba = FC_RGBA_UNKNOWN; #if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 if (display->render_major > 0 || display->render_minor >= 6) { int render_order = XRenderQuerySubpixelOrder (dpy, XScreenNumberOfScreen (info->screen)); switch (render_order) { default: case SubPixelUnknown: xft_rgba = FC_RGBA_UNKNOWN; break; case SubPixelHorizontalRGB: xft_rgba = FC_RGBA_RGB; break; case SubPixelHorizontalBGR: xft_rgba = FC_RGBA_BGR; break; case SubPixelVerticalRGB: xft_rgba = FC_RGBA_VRGB; break; case SubPixelVerticalBGR: xft_rgba = FC_RGBA_VBGR; break; case SubPixelNone: xft_rgba = FC_RGBA_NONE; break; } } #endif } if (xft_hinting) { switch (xft_hintstyle) { case FC_HINT_NONE: hint_style = CAIRO_HINT_STYLE_NONE; break; case FC_HINT_SLIGHT: hint_style = CAIRO_HINT_STYLE_SLIGHT; break; case FC_HINT_MEDIUM: hint_style = CAIRO_HINT_STYLE_MEDIUM; break; case FC_HINT_FULL: hint_style = CAIRO_HINT_STYLE_FULL; break; default: hint_style = CAIRO_HINT_STYLE_DEFAULT; } } else { hint_style = CAIRO_HINT_STYLE_NONE; } switch (xft_rgba) { case FC_RGBA_RGB: subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB; break; case FC_RGBA_BGR: subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR; break; case FC_RGBA_VRGB: subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB; break; case FC_RGBA_VBGR: subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR; break; case FC_RGBA_UNKNOWN: case FC_RGBA_NONE: default: subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; } switch (xft_lcdfilter) { case FC_LCD_NONE: lcd_filter = CAIRO_LCD_FILTER_NONE; break; case FC_LCD_DEFAULT: lcd_filter = CAIRO_LCD_FILTER_FIR5; break; case FC_LCD_LIGHT: lcd_filter = CAIRO_LCD_FILTER_FIR3; break; case FC_LCD_LEGACY: lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL; break; default: lcd_filter = CAIRO_LCD_FILTER_DEFAULT; break; } if (xft_antialias) { if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) antialias = CAIRO_ANTIALIAS_GRAY; else antialias = CAIRO_ANTIALIAS_SUBPIXEL; } else { antialias = CAIRO_ANTIALIAS_NONE; } cairo_font_options_set_hint_style (&info->font_options, hint_style); cairo_font_options_set_antialias (&info->font_options, antialias); cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order); _cairo_font_options_set_lcd_filter (&info->font_options, lcd_filter); cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON); } void _cairo_xlib_screen_close_display (cairo_xlib_display_t *display, cairo_xlib_screen_t *info) { Display *dpy; int i; dpy = display->display; for (i = 0; i < ARRAY_LENGTH (info->gc); i++) { if ((info->gc_depths >> (8*i)) & 0xff) XFreeGC (dpy, info->gc[i]); } info->gc_depths = 0; } void _cairo_xlib_screen_destroy (cairo_xlib_screen_t *info) { while (! cairo_list_is_empty (&info->visuals)) { _cairo_xlib_visual_info_destroy (cairo_list_first_entry (&info->visuals, cairo_xlib_visual_info_t, link)); } cairo_list_del (&info->link); free (info); } cairo_status_t _cairo_xlib_screen_get (Display *dpy, Screen *screen, cairo_xlib_screen_t **out) { cairo_xlib_display_t *display; cairo_device_t *device; cairo_xlib_screen_t *info; cairo_status_t status; device = _cairo_xlib_device_create (dpy); status = device->status; if (unlikely (status)) goto CLEANUP_DEVICE; status = _cairo_xlib_display_acquire (device, &display); if (unlikely (status)) goto CLEANUP_DEVICE; info = _cairo_xlib_display_get_screen (display, screen); if (info != NULL) { *out = info; goto CLEANUP_DISPLAY; } info = malloc (sizeof (cairo_xlib_screen_t)); if (unlikely (info == NULL)) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); goto CLEANUP_DISPLAY; } info->device = device; info->screen = screen; info->has_font_options = FALSE; info->gc_depths = 0; memset (info->gc, 0, sizeof (info->gc)); cairo_list_init (&info->visuals); cairo_list_add (&info->link, &display->screens); *out = info; CLEANUP_DISPLAY: cairo_device_release (&display->base); CLEANUP_DEVICE: cairo_device_destroy (device); return status; } GC _cairo_xlib_screen_get_gc (cairo_xlib_display_t *display, cairo_xlib_screen_t *info, int depth, Drawable drawable) { GC gc = NULL; int i; for (i = 0; i < ARRAY_LENGTH (info->gc); i++) { if (((info->gc_depths >> (8*i)) & 0xff) == depth) { info->gc_depths &= ~(0xff << (8*i)); gc = info->gc[i]; break; } } if (gc == NULL) { XGCValues gcv; gcv.graphics_exposures = False; gcv.fill_style = FillTiled; gc = XCreateGC (display->display, drawable, GCGraphicsExposures | GCFillStyle, &gcv); } return gc; } void _cairo_xlib_screen_put_gc (cairo_xlib_display_t *display, cairo_xlib_screen_t *info, int depth, GC gc) { int i; for (i = 0; i < ARRAY_LENGTH (info->gc); i++) { if (((info->gc_depths >> (8*i)) & 0xff) == 0) break; } if (i == ARRAY_LENGTH (info->gc)) { cairo_status_t status; /* perform random substitution to ensure fair caching over depths */ i = rand () % ARRAY_LENGTH (info->gc); status = _cairo_xlib_display_queue_work (display, (cairo_xlib_notify_func) XFreeGC, info->gc[i], NULL); if (unlikely (status)) { /* leak the server side resource... */ XFree ((char *) info->gc[i]); } } info->gc[i] = gc; info->gc_depths &= ~(0xff << (8*i)); info->gc_depths |= depth << (8*i); } cairo_status_t _cairo_xlib_screen_get_visual_info (cairo_xlib_display_t *display, cairo_xlib_screen_t *info, Visual *v, cairo_xlib_visual_info_t **out) { cairo_xlib_visual_info_t *visual; cairo_status_t status; cairo_list_foreach_entry (visual, cairo_xlib_visual_info_t, &info->visuals, link) { if (visual->visualid == v->visualid) { *out = visual; return CAIRO_STATUS_SUCCESS; } } status = _cairo_xlib_visual_info_create (display->display, XScreenNumberOfScreen (info->screen), v->visualid, &visual); if (unlikely (status)) return status; cairo_list_add (&visual->link, &info->visuals); *out = visual; return CAIRO_STATUS_SUCCESS; } cairo_font_options_t * _cairo_xlib_screen_get_font_options (cairo_xlib_screen_t *info) { if (! info->has_font_options) { _cairo_font_options_init_default (&info->font_options); if (info->screen != NULL) { cairo_xlib_display_t *display; if (! _cairo_xlib_display_acquire (info->device, &display)) { _cairo_xlib_init_screen_font_options (display->display, info); cairo_device_release (&display->base); } } info->has_font_options = TRUE; } return &info->font_options; }
keinenamen/H2_swjtu
app/src/main/java/com/amap/navi/demo/MyApp.java
<reponame>keinenamen/H2_swjtu package com.amap.navi.demo; import android.app.Application; /** * Created by shixin on 16/8/23. * bug反馈QQ:1438734562 */ public class MyApp extends Application { @Override public void onCreate() { super.onCreate(); /** * setApiKey是静态方法,内部引用了Context,建议放在Application中 * 如果你在meta-data中配置了key,那么以meta-data中的为准,此行代码 * 可以忽略,这个方法主要是为那些不想在xml里配置key的用户使用。 * **/ // AMapNavi.setApiKey(this, "你的KEY"); } }
dbajramovic/KKKengurJS
app/models/player.server.model.js
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema; /** * Player Schema */ var PlayerSchema = new Schema({ name: { type: String, default: '', required: 'Ime igrača je obavezno!', trim: true }, created: { type: Date, default: Date.now }, user: { type: Schema.ObjectId, ref: 'User' }, year: { type: Date }, imageLink: { type: String, default: 'http://res.cloudinary.com/kengurjs/image/upload/c_pad,r_30,w_90/v1438201378/basketball-player1_ybrks8.png', trim: true }, imageLinkId: { type: String, default: '', trim: true }, imageThumb: { type: String, default: '', trim: true }, imageThumbId: { type: String, default: '', trim: true } }); mongoose.model('Player', PlayerSchema);
kelu124/pyS3
com/itextpdf/text/pdf/qrcode/WriterException.java
<gh_stars>1-10 package com.itextpdf.text.pdf.qrcode; public final class WriterException extends Exception { private static final long serialVersionUID = 1; public WriterException(String message) { super(message); } }
antonialoytorrens/kraptor
src/bomba.c
// -------------------------------------------------------- // bomba.c // -------------------------------------------------------- // Copyright (c) Kronoman // En memoria de mi querido padre // -------------------------------------------------------- // Este modulo contiene todo lo relacionado con las bombas // del jugador... // -------------------------------------------------------- #ifndef BOMBA_C #define BOMBA_C #include <allegro.h> #include "bomba.h" #include "mapa.h" #include "sonido.h" #include "explos.h" #include "kfbuffer.h" #include "azar.h" /* globales exportadas, setearlas al lanzar una bomba, ver jugador.c */ int bomba_esta_activa = FALSE; // esta la bomba funcionando en este momento? int bomba_detonacion = 0; // tiempo de detonacion (30 = 1 segundo explotando) SAMPLE *bomba_sonido = NULL; // sonido de detonacion /* mueve la bomba */ void mover_bomba() { int i; if (!bomba_esta_activa) return; // sonido de explosiones al azar... if (rand()%100 < 25) tocar_sonido_paneado(rand()%ANCHO_FB, explo_cache_snd[rand()%3], rand_ex(128, 200), rand_ex(800, 1300)); bomba_detonacion--; if (bomba_detonacion <= 0) { /* sonido estruendoso de explosion */ if (rand()%100 < 95) for (i = 0; i < rand()%3+1; i++) tocar_sonido_paneado(rand()%ANCHO_FB, explo_cache_snd[rand()%3], rand_ex(196, 256), rand_ex(800, 1300)); bomba_esta_activa = FALSE; bomba_detonacion = 0; } } /* dibuja la explosion de la bomba, actualmente, todo blanco... horrible! */ void dibujar_bomba(BITMAP *bmp) { if (!bomba_esta_activa) return; clear_to_color(bmp, makecol(255,255,255) ); } /* produce una detonacion total del piso del juego, pasarle en x el 'scroll_mapa' */ void detonar_totalmente_el_piso(int y) { int x1,y1; /* DEBUG: esto detona con retroactividad, es decir todo el mapa hacia atras! */ for (y1 = y / H_GR; y1 < GRILLA_H; y1++) for (x1 = 0; x1 < GRILLA_W; x1++) explotar_fondo(x1, y1, rand()%100+100); } #endif
ScalablyTyped/SlinkyTyped
j/jest-snapshot/src/main/scala/typingsSlinky/jestSnapshot/stateMod/SnapshotMatchOptions.scala
package typingsSlinky.jestSnapshot.stateMod import scala.scalajs.js import scala.scalajs.js.`|` import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} @js.native trait SnapshotMatchOptions extends js.Object { var error: js.UndefOr[js.Error] = js.native var inlineSnapshot: js.UndefOr[String] = js.native var isInline: Boolean = js.native var key: js.UndefOr[String] = js.native var received: js.Any = js.native var testName: String = js.native } object SnapshotMatchOptions { @scala.inline def apply(isInline: Boolean, received: js.Any, testName: String): SnapshotMatchOptions = { val __obj = js.Dynamic.literal(isInline = isInline.asInstanceOf[js.Any], received = received.asInstanceOf[js.Any], testName = testName.asInstanceOf[js.Any]) __obj.asInstanceOf[SnapshotMatchOptions] } @scala.inline implicit class SnapshotMatchOptionsOps[Self <: SnapshotMatchOptions] (val x: Self) extends AnyVal { @scala.inline def duplicate: Self = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x)).asInstanceOf[Self] @scala.inline def combineWith[Other <: js.Any](other: Other): Self with Other = (js.Dynamic.global.Object.assign(js.Dynamic.literal(), x, other.asInstanceOf[js.Any])).asInstanceOf[Self with Other] @scala.inline def set(key: String, value: js.Any): Self = { x.asInstanceOf[js.Dynamic].updateDynamic(key)(value) x } @scala.inline def setIsInline(value: Boolean): Self = this.set("isInline", value.asInstanceOf[js.Any]) @scala.inline def setReceived(value: js.Any): Self = this.set("received", value.asInstanceOf[js.Any]) @scala.inline def setTestName(value: String): Self = this.set("testName", value.asInstanceOf[js.Any]) @scala.inline def setError(value: js.Error): Self = this.set("error", value.asInstanceOf[js.Any]) @scala.inline def deleteError: Self = this.set("error", js.undefined) @scala.inline def setInlineSnapshot(value: String): Self = this.set("inlineSnapshot", value.asInstanceOf[js.Any]) @scala.inline def deleteInlineSnapshot: Self = this.set("inlineSnapshot", js.undefined) @scala.inline def setKey(value: String): Self = this.set("key", value.asInstanceOf[js.Any]) @scala.inline def deleteKey: Self = this.set("key", js.undefined) } }
nymanjens/piga
app/jvm/src/main/scala/app/api/AppEntityPermissions.scala
package app.api import app.api.ScalaJsApi.HydroPushSocketPacket.EntityModificationsWithToken import app.models.access.JvmEntityAccess import app.models.document.DocumentEntity import app.models.document.DocumentPermissionAndPlacement import app.models.document.TaskEntity import app.models.user.User import com.google.common.collect.ImmutableMultimap import com.google.inject.Inject import hydro.api.EntityPermissions import hydro.models.modification.EntityModification import hydro.models.Entity import javax.inject.Singleton import org.reactivestreams.Subscriber import org.reactivestreams.Subscription @Singleton final class AppEntityPermissions @Inject() (implicit entityAccess: JvmEntityAccess ) extends EntityPermissions { // Initialize documentToOwners lazily, mainly to avoid test startup issues @volatile private var _documentToOwners: ImmutableMultimap[Long, Long] = _ entityAccess.entityModificationPublisher.subscribe(EntityModificationSubscriber) // **************** Implementation of EntityPermissions API **************** // override def checkAllowedForWrite(modification: EntityModification)(implicit user: User): Unit = { EntityPermissions.DefaultImpl.checkAllowedForWrite(modification) modification.entityType match { case TaskEntity.Type => modification.maybeEntity[TaskEntity] match { case Some(e) => require( documentToOwners.containsEntry(e.documentId, user.id) || // The very first task in a document is created simultaneously with the document itself, so if there // are no owners, allow an edit to happen documentToOwners.get(e.documentId).isEmpty, s"$user is trying to edit a document (id = ${e.documentId}) that they don't own", ) case None => // Removal by ID is expensive to check and requires the ID, which is very hard to guess } case DocumentEntity.Type => modification match { case EntityModification.Add(_) => // Adding a document is fine case EntityModification.Update(uncastEntity) => val e = uncastEntity.asInstanceOf[DocumentEntity] require( documentToOwners.containsEntry(e.id, user.id), s"$user is trying to edit a document (id = ${e.id}) that they don't own", ) case EntityModification.Remove(_) => // Removal by ID is expensive to check and requires the ID, which is very hard to guess } case DocumentPermissionAndPlacement.Type => modification match { case EntityModification.Add( uncastEntity ) => // Adding a permission is only allowed if the document has no owners val e = uncastEntity.asInstanceOf[DocumentPermissionAndPlacement] require( documentToOwners.get(e.documentId).isEmpty, s"$user is trying to add an additional owner to a document (id = ${e.documentId}) that is already " + s"owned by userId = ${documentToOwners.get(e.documentId)}", ) require( e.userId == user.id, s"$user is trying to add an owner (userId = ${e.userId}) to a document (id = ${e.documentId}) that is " + s"not themselves", ) case EntityModification.Update(uncastEntity) => val e = uncastEntity.asInstanceOf[DocumentPermissionAndPlacement] require( documentToOwners.containsEntry(e.documentId, user.id), s"$user is trying to edit a document (id = ${e.documentId}) that they don't own", ) require( e.userId == user.id, s"$user is trying to edit a permission for an owner (userId = ${e.userId}) to a document " + s"(id = ${e.documentId}) that is not themselves", ) case EntityModification.Remove(_) => // Removal by ID is expensive to check and requires the ID, which is very hard to guess } case _ => // Do nothing } } override def isAllowedToRead(entity: Entity)(implicit user: User): Boolean = { val isDocumentAccesssible = entity match { case e: TaskEntity => // Hide document content from unauthorized readers documentToOwners.containsEntry(e.documentId, user.id) case e: DocumentEntity => // Don't expose document names to unauthorized readers documentToOwners.containsEntry(e.id, user.id) case _: DocumentPermissionAndPlacement => true // Allow to see sharing relationships of all users case _ => true } EntityPermissions.DefaultImpl.isAllowedToRead(entity) && isDocumentAccesssible } // **************** Private helper methods **************** // private def documentToOwners: ImmutableMultimap[Long, Long] = { if (_documentToOwners == null) { recalculateDocumentToOwners() } _documentToOwners } private def recalculateDocumentToOwners(): Unit = { val resultBuilder = ImmutableMultimap.builder[Long, Long]() for (permission <- entityAccess.newQuerySync[DocumentPermissionAndPlacement]().data()) { resultBuilder.put(permission.documentId, permission.userId) } _documentToOwners = resultBuilder.build } private object EntityModificationSubscriber extends Subscriber[EntityModificationsWithToken] { override def onSubscribe(s: Subscription): Unit = { s.request(Long.MaxValue) } override def onNext(t: EntityModificationsWithToken): Unit = { for (modification <- t.modifications) { modification.entityType match { case DocumentPermissionAndPlacement.Type => recalculateDocumentToOwners() case _ => // Do nothing } } } override def onError(t: Throwable): Unit = {} override def onComplete(): Unit = {} } }
landonreed/GeoGit
src/core/src/main/java/org/geogit/api/plumbing/RebuildGraphOp.java
<gh_stars>0 /* Copyright (c) 2013 OpenPlans. All rights reserved. * This code is licensed under the BSD New License, available at the root * application directory. */ package org.geogit.api.plumbing; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.geogit.api.AbstractGeoGitOp; import org.geogit.api.ObjectId; import org.geogit.api.Ref; import org.geogit.api.RevCommit; import org.geogit.api.porcelain.BranchListOp; import org.geogit.api.porcelain.LogOp; import org.geogit.repository.Repository; import org.geogit.storage.GraphDatabase; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.inject.Inject; /** * Rebuilds the {@link GraphDatabase} and returns a list of {@link ObjectId}s that were found to be * missing or incomplete. */ public class RebuildGraphOp extends AbstractGeoGitOp<ImmutableList<ObjectId>> { private Repository repository; /** * Constructs a new {@code RebuildGraphOp} with the provided {@link Repository}. * * @param repository the repository */ @Inject public RebuildGraphOp(Repository repository) { this.repository = repository; } /** * Executes the {@code RebuildGraphOp} operation. * * @return a list of {@link ObjectId}s that were found to be missing or incomplete */ @Override public ImmutableList<ObjectId> call() { Preconditions.checkState(!repository.isSparse(), "Cannot rebuild the graph of a sparse repository."); List<ObjectId> updated = new LinkedList<ObjectId>(); ImmutableList<Ref> branches = command(BranchListOp.class).setLocal(true).setRemotes(true) .call(); GraphDatabase graphDb = repository.getGraphDatabase(); for (Ref ref : branches) { Iterator<RevCommit> commits = command(LogOp.class).setUntil(ref.getObjectId()).call(); while (commits.hasNext()) { RevCommit next = commits.next(); if (graphDb.put(next.getId(), next.getParentIds())) { updated.add(next.getId()); } } } return ImmutableList.copyOf(updated); } }
PacoEstrada18/moodle127
node_modules/mathjax/unpacked/jax/output/HTML-CSS/fonts/STIX/General/Bold/MiscMathSymbolsB.js
/************************************************************* * * MathJax/jax/output/HTML-CSS/fonts/STIX/General/Bold/MiscMathSymbolsB.js * * Copyright (c) 2009-2019 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ MathJax.Hub.Insert( MathJax.OutputJax['HTML-CSS'].FONTDATA.FONTS['STIXGeneral-bold'], { 0x2980: [705,200,675,105,570], // TRIPLE VERTICAL BAR DELIMITER 0x29B6: [634,130,864,50,814], // CIRCLED VERTICAL BAR 0x29B7: [634,130,864,50,814], // CIRCLED PARALLEL 0x29B8: [634,130,864,50,814], // CIRCLED REVERSE SOLIDUS 0x29C0: [634,130,864,50,814], // CIRCLED LESS-THAN 0x29C1: [634,130,864,50,814], // CIRCLED GREATER-THAN 0x29C4: [661,158,910,45,865], // SQUARED RISING DIAGONAL SLASH 0x29C5: [661,158,910,45,865], // SQUARED FALLING DIAGONAL SLASH 0x29C6: [661,158,910,45,865], // SQUARED ASTERISK 0x29C7: [661,158,910,45,865] // SQUARED SMALL CIRCLE } ); MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir + "/General/Bold/MiscMathSymbolsB.js");
hpcloud/ccng-upstream-pr
app/jobs/runtime/events_cleanup.rb
module VCAP::CloudController module Jobs module Runtime class EventsCleanup < VCAP::CloudController::Jobs::CCJob attr_accessor :cutoff_age_in_days def initialize(cutoff_age_in_days) @cutoff_age_in_days = cutoff_age_in_days end def perform old_events = Event.where("created_at < CURRENT_TIMESTAMP - INTERVAL '?' DAY", cutoff_age_in_days.to_i) logger = Steno.logger('cc.background') logger.info("Cleaning up #{old_events.count} Event rows") old_events.delete end def job_name_in_configuration :events_cleanup end def max_attempts 1 end end end end end
KellyShao/tessera
config/src/main/java/com/quorum/tessera/config/keypairs/ConfigKeyPair.java
package com.quorum.tessera.config.keypairs; public interface ConfigKeyPair { String getPublicKey(); String getPrivateKey(); void withPassword(char[] password); char[] getPassword(); }
skylar-stark/springdoc-openapi
springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app167/HelloController.java
package test.org.springdoc.api.app167; import io.swagger.v3.oas.annotations.Parameter; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author bnasslahsen */ @RestController @RequestMapping("/api") public class HelloController { @GetMapping("/sample1") public ResponseEntity sample1(@Parameter(name="mySample") String mySample) { throw new UnsupportedOperationException("the body is not relevant now"); } }
mikewong-sfsu/GeneDive
frontend/docs/html/search/files_a.js
var searchData= [ ['loading_2ejs',['loading.js',['../loading_8js.html',1,'']]], ['login_2ejs',['Login.js',['../lib_2ui_2tests_2_login_8js.html',1,'(Global Namespace)'],['../node__modules_2actions_2_login_8js.html',1,'(Global Namespace)']]], ['login_2ephp',['login.php',['../login_8php.html',1,'']]] ];
micro-os-plus/web-preview
docs/reference/cmsis-plus/classos_1_1rtos_1_1clock__rtc.js
var classos_1_1rtos_1_1clock__rtc = [ [ "duration_t", "classos_1_1rtos_1_1clock__rtc.html#ga149d8b5cea55224ef5cfede8a81df04c", null ], [ "offset_t", "classos_1_1rtos_1_1clock__rtc.html#gabb59996de739574c5f5255e7b3d29c1c", null ], [ "timestamp_t", "classos_1_1rtos_1_1clock__rtc.html#ga4f6ee5cdd07c87db11f64d02e1c354d1", null ], [ "clock_rtc", "classos_1_1rtos_1_1clock__rtc.html#adb6c4c57480444009c25c59b74639f9d", null ], [ "~clock_rtc", "classos_1_1rtos_1_1clock__rtc.html#a96848bb6b4b89a9e86049e6fcf8eb865", null ], [ "internal_check_timestamps", "classos_1_1rtos_1_1clock__rtc.html#aed85a5194291acffc6f9a0e0da8426d3", null ], [ "name", "classos_1_1rtos_1_1clock__rtc.html#a3103a84c5e0521c3639306f5879526ba", null ], [ "now", "classos_1_1rtos_1_1clock__rtc.html#a2ff3189d8d88102a0e49fd094bc7c70b", null ], [ "offset", "classos_1_1rtos_1_1clock__rtc.html#a8a24755cbeb7768dbebe42f8b7ee8cae", null ], [ "offset", "classos_1_1rtos_1_1clock__rtc.html#a13b99b2fbecc82a2606fec13d2d32ca0", null ], [ "sleep_for", "classos_1_1rtos_1_1clock__rtc.html#af97cadfe288c3a56749ac70ae85c93bb", null ], [ "sleep_until", "classos_1_1rtos_1_1clock__rtc.html#a5582df6aac1fd73354589bb024f17873", null ], [ "start", "classos_1_1rtos_1_1clock__rtc.html#a76114a4e81214e9f4dfe81dfb4807d0a", null ], [ "steady_now", "classos_1_1rtos_1_1clock__rtc.html#a8b593aa571fee824ba84d66761db80c7", null ], [ "update_for_slept_time", "classos_1_1rtos_1_1clock__rtc.html#a7edf24e95388b283aa2d3f1ca39fab2b", null ], [ "wait_for", "classos_1_1rtos_1_1clock__rtc.html#a5a99215d8e93906802385eb70e921a05", null ], [ "frequency_hz", "classos_1_1rtos_1_1clock__rtc.html#a0c40d3bdecdfc88457eec8fa79a3c1fb", null ] ];
rahul-verma/daksha
daksha/src/main/java/com/testmile/daksha/tpi/guiauto/gui/DefaultGui.java
/******************************************************************************* * Copyright 2015-18 Test Mile Software Testing Pvt Ltd * * Website: www.TestMile.com * Email: support [at] testmile.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package com.testmile.daksha.tpi.guiauto.gui; import java.io.File; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import com.testmile.daksha.Daksha; import com.testmile.daksha.core.guiauto.automator.proxy.GuiAutomatorProxy; import com.testmile.daksha.core.guiauto.element.proxy.BaseGuiElementProxy; import com.testmile.daksha.core.guiauto.element.proxy.GuiElementProxy; import com.testmile.daksha.core.guiauto.element.proxy.GuiMultiElementProxy; import com.testmile.daksha.core.guiauto.enums.GuiDriverEngine; import com.testmile.daksha.core.guiauto.enums.GuiElementLoaderType; import com.testmile.daksha.core.guiauto.namestore.GuiNameStore; import com.testmile.daksha.core.guiauto.namestore.GuiNamespace; import com.testmile.daksha.core.problem.ErrorType; import com.testmile.daksha.core.problem.Problem; import com.testmile.daksha.tpi.TestContext; import com.testmile.daksha.tpi.guiauto.enums.GuiAutomationContext; import com.testmile.daksha.tpi.guiauto.enums.GuiElementType; import com.testmile.daksha.tpi.guiauto.maker.GuiNamespaceLoaderFactory; import com.testmile.daksha.tpi.sysauto.utils.DataUtils; public class DefaultGui implements Gui{ private Logger logger = Daksha.getLogger(); private TestContext testContext = null; private GuiAutomatorProxy automator = null; private GuiNamespace ns = null; private GuiAutomationContext context = null; private String label; private Gui parent = null; private GuiElementLoaderType loaderType = null; private String imagesDirectory = null; private String name = null; private String defPath = null; private Map<String, Gui> children = new HashMap<String, Gui>(); public DefaultGui( String label, GuiAutomatorProxy automator, String defPath) throws Exception{ populateGuiInfo(label, automator); this.defPath = defPath; loadNamespace(defPath); goToGui(); } public DefaultGui(GuiAutomatorProxy automator) throws Exception{ populateGuiInfo(this.getClass().getSimpleName(), automator); this.defPath = this.getDefPath(); loadNamespace(defPath); goToGui(); } public DefaultGui(String label, GuiAutomatorProxy automator) throws Exception{ populateGuiInfo(label, automator); this.defPath = this.getDefPath(); loadNamespace(defPath); goToGui(); } public DefaultGui( Gui parent, String label, GuiAutomatorProxy automator, String defPath) throws Exception { populateGuiInfo(label, automator); populateParentInfo(parent); this.defPath = defPath; loadNamespace(defPath); goToGui(); } protected String getDefPath() throws Exception{ return this.defPath; } protected void load() throws Exception{ // Child classes can override this and write any necessary loading instructions. } protected void validateLoaded() throws Throwable{ this.getAutomator().validatePageLoad(); } protected void goToGui() throws Exception { try { this.load(); this.validateLoaded(); } catch (Throwable e) { throw new Exception(String.format("UI %s did not load as expected. Error: %s", this.getName(), e.getMessage())); } } private void populateGuiInfo(String name, GuiAutomatorProxy automator) throws Exception { this.setName(name); this.setLabel(name); this.testContext = automator.getTestContext(); this.setContext(automator.getAutomatorContext()); this.setElementLoaderType(GuiElementLoaderType.GUI); this.setAutomator(automator); } protected TestContext getTestContext() { return this.testContext; } private void populateParentInfo(Gui parent) { this.setParent(parent); this.setName(parent.getName() + "." + this.getLabel()); this.setElementLoaderType(GuiElementLoaderType.COMPOSITE_GUI); } private void loadNamespace(String defPath) throws Exception { if (!GuiNameStore.INSTANCE.hasNamespace(this.getLabel())) { this.ns = GuiNameStore.INSTANCE.loadNamespace(this.getLabel(), GuiNamespaceLoaderFactory.createNamespaceLoader(this.getTestContext(), defPath)); } else { this.ns = GuiNameStore.INSTANCE.getNamespace(this.getLabel()); } } @Override public GuiNamespace getDefinition() throws Exception { return this.ns; } public String getName() { return name; } private void setName(String name) { this.name = name; } public GuiElementLoaderType getElementLoaderType() { return this.loaderType; } private void setElementLoaderType(GuiElementLoaderType type) { this.loaderType = type; } @Override public String getLabel() { return this.label; } private void setLabel(String label) { this.label = label; } @Override public GuiAutomationContext getAutomatorContext() throws Exception { return context; } private void setContext(GuiAutomationContext context) throws Exception { this.context = context; } @Override public Gui getParent() { return parent; } private void setParent(Gui parent) { this.parent = parent; } @Override public GuiAutomatorProxy getAutomator() throws Exception { return this.automator; } private void setAutomator(GuiAutomatorProxy automator) throws Exception { if (automator != null){ this.automator = automator; } else { throwNullAutomatorException("setAutomator"); } } public GuiElementProxy getElement(String elementName) throws Exception { if (elementName == null){ return (GuiElementProxy) throwNullElementException("element", elementName); } else if (!this.ns.has(elementName)) { return (GuiElementProxy) throwUndefinedElementException("element", elementName); } else { GuiElementProxy proxy = this.getAutomator().getConcreteAutomator().getIdentifier().createProxy(this, this.ns.getMetaData(elementName, this.getAutomatorContext())); return proxy; } } public GuiMultiElementProxy getElements(String elementName) throws Exception { if (elementName == null){ return (GuiMultiElementProxy) throwNullElementException("element", elementName); } else if (!this.ns.has(elementName)) { return (GuiMultiElementProxy) throwUndefinedElementException("element", elementName); } else { GuiMultiElementProxy proxy = this.getAutomator().getConcreteAutomator().getIdentifier().createMultiProxy(this, this.ns.getMetaData(elementName, this.getAutomatorContext())); return proxy; } } public GuiElementProxy element(String name) throws Exception { return getElement(name); } @Override public GuiMultiElementProxy elements(String name) throws Exception { return getElements(name); } public void addChild(String label, String defPath) throws Exception { Gui gui = new DefaultGui(this, label, this.getAutomator(), defPath); this.addChild(label, gui); } public void addChild(String label, Gui gui) { getChildMap().put(label.toLowerCase(), gui); } protected Gui throwUndefinedUiException(String method, String label) throws Exception{ throw new Problem( "gui", this.getName(), method, ErrorType.COMPOSITE_GUI_NONEXISTING_LABEL, String.format(ErrorType.COMPOSITE_GUI_NONEXISTING_LABEL, label, this.getName()) ); } protected Gui throwNullUiException(String method) throws Exception{ throw new Problem( "gui", this.getName(), method, ErrorType.COMPOSITE_GUI_NULL_LABEL, String.format(ErrorType.COMPOSITE_GUI_NULL_LABEL, this.getName() ) ); } public Gui gui(String name) throws Exception { if (name != null){ if (getChildMap().containsKey(name.toLowerCase())){ return getChildMap().get(name.toLowerCase()); } else{ return throwUndefinedUiException("gui", name); } } else { return throwNullUiException("gui"); } } protected Map<String, Gui> getChildMap() { return children; } protected void setChildMap(Map<String, Gui> guiMap) { this.children = guiMap; } protected Object throwDefaultUiException(String action, String code, String message) throws Exception { throw new Problem( "GUI Automator", this.getName(), action, code, message ); } public Object throwNullAutomatorException(String methodName) throws Exception { return throwDefaultUiException( methodName, ErrorType.GUI_NULL_AUTOMATOR, String.format( ErrorType.GUI_NULL_AUTOMATOR, Daksha.getAutomationContextName(this.getAutomatorContext()) ) ); } public Object throwUndefinedElementException(String methodName, String elementName) throws Exception { return throwDefaultUiException( methodName, ErrorType.GUI_UNDEFINED_ELEMENT, String.format( ErrorType.GUI_UNDEFINED_ELEMENT, elementName, DataUtils.toTitleCase(this.getAutomatorContext().toString()) // Batteries.toTitleCase(getDeviceType().toString()), // Batteries.toTitleCase(getAutomationType().toString()) ) ); } public Object throwNullElementException(String methodName, String elementName) throws Exception { return throwDefaultUiException( methodName, ErrorType.GUI_NULL_ELEMENT, String.format( ErrorType.GUI_NULL_ELEMENT, DataUtils.toTitleCase(this.getAutomatorContext().toString()) // Batteries.toTitleCase(getDeviceType().toString()), // Batteries.toTitleCase(getAutomationType().toString()) ) ); } private void wrapProxy(BaseGuiElementProxy proxy) { proxy.setGui(this); proxy.setLoaderType(this.getElementLoaderType()); } private GuiElementProxy updateGuiElementProxy(GuiElementProxy proxy) { wrapProxy(proxy); return proxy; } private GuiMultiElementProxy updateUiElementProxy(GuiMultiElementProxy proxy) { wrapProxy(proxy); return proxy; } @Override public GuiElementProxy elementWithId(String id) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithId(id)); } @Override public GuiElementProxy elementWithName(String name) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithName(name)); } @Override public GuiElementProxy elementWithClass(String klass) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithClass(klass)); } @Override public GuiElementProxy elementWithCss(String cssSelector) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithCss(cssSelector)); } @Override public GuiElementProxy elementWithTagName(String tag) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithTagName(tag)); } @Override public GuiElementProxy elementWithLinkText(String text) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithLinkText(text)); } @Override public GuiElementProxy elementWithPartialLinkText(String textContent) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithPartialLinkText(textContent)); } @Override public GuiElementProxy elementWithXPath(String xpath) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithXPath(xpath)); } @Override public GuiElementProxy elementWithXText(String text) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithXText(text)); } @Override public GuiElementProxy elementWithXPartialText(String textContent) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithXPartialText(textContent)); } @Override public GuiElementProxy elementWithXValue(String value) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithXValue(value)); } @Override public GuiElementProxy elementWithXTitle(String value) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithXTitle(value)); } @Override public GuiElementProxy elementWithXImageSource(String path) throws Exception { return updateGuiElementProxy(this.getAutomator().elementWithXImageSource(path)); } @Override public GuiElementProxy elementOfXType(GuiElementType type) throws Exception { return updateGuiElementProxy(this.getAutomator().elementOfXType(type)); } @Override public GuiElementProxy elementBasedOnImage(String imagePath) throws Exception { return updateGuiElementProxy(this.getAutomator().elementBasedOnImage(imagePath)); } @Override public GuiMultiElementProxy elementsWithId(String id) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithId(id)); } @Override public GuiMultiElementProxy elementsWithName(String name) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithName(name)); } @Override public GuiMultiElementProxy elementsWithClass(String klass) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithClass(klass)); } @Override public GuiMultiElementProxy elementsWithCss(String cssSelector) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithCss(cssSelector)); } @Override public GuiMultiElementProxy elementsWithTagName(String tag) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithTagName(tag)); } @Override public GuiMultiElementProxy elementsWithLinkText(String text) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithLinkText(text)); } @Override public GuiMultiElementProxy elementsWithPartialLinkText(String textContent) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithPartialLinkText(textContent)); } @Override public GuiMultiElementProxy elementsWithXPath(String xpath) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithXPath(xpath)); } @Override public GuiMultiElementProxy elementsWithXText(String text) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithXText(text)); } @Override public GuiMultiElementProxy elementsWithXPartialText(String textContent) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithXPartialText(textContent)); } @Override public GuiMultiElementProxy elementsWithXValue(String value) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithXValue(value)); } @Override public GuiMultiElementProxy elementsWithXTitle(String value) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithXTitle(value)); } @Override public GuiMultiElementProxy elementsWithXImageSource(String path) throws Exception { return updateUiElementProxy(this.getAutomator().elementsWithXImageSource(path)); } @Override public GuiMultiElementProxy elementsOfXType(GuiElementType type) throws Exception { return updateUiElementProxy(this.getAutomator().elementsOfXType(type)); } @Override public GuiMultiElementProxy elementsBasedOnImage(String imagePath) throws Exception { return updateUiElementProxy(this.getAutomator().elementsBasedOnImage(imagePath)); } @Override public GuiDriverEngine getGuiDriverEngineName() throws Exception { return this.getAutomator().getGuiDriverEngineName(); } // @Override public File takeScreenshot() throws Exception { return this.getAutomator().takeScreenshot(); } // @Override public void setAppTitle(String appTitle) throws Exception { this.getAutomator().setAppTitle(appTitle); } // @Override public String getAppTitle() throws Exception { return this.getAutomator().getAppTitle(); } // @Override public void focusOnApp() throws Exception { this.getAutomator().focusOnApp(); } // // @Override public void confirmAlertIfPresent() throws Exception { this.getAutomator().confirmAlertIfPresent(); } // @Override public void close() throws Exception { this.getAutomator().close(); } // @Override public String getCurrentWindow() throws Exception { return this.getAutomator().getCurrentWindow(); } // @Override public void switchToNewWindow() throws Exception { this.getAutomator().switchToNewWindow(); } // @Override public void switchToWindow(String windowHandle) throws Exception { this.getAutomator().switchToWindow(windowHandle); } // @Override public void closeCurrentWindow() throws Exception { this.getAutomator().closeCurrentWindow(); } // @Override public void goTo(String url) throws Exception { this.getAutomator().goTo(url); } // @Override public void refresh() throws Exception { this.getAutomator().refresh(); } // @Override public void back() throws Exception { this.getAutomator().back(); } // @Override public void forward() throws Exception { this.getAutomator().forward(); } // @Override public void waitForBody() throws Exception { this.getAutomator().waitForBody(); } // @Override public void switchToFrame(int index) throws Exception { this.getAutomator().switchToFrame(index); } // @Override public void switchToFrame(String name) throws Exception { this.getAutomator().switchToFrame(name); } // @Override public void switchToDefaultFrame() throws Exception { this.getAutomator().switchToDefaultFrame(); } // @Override public boolean areImagesSimilar(File leftImagePath, File rightImage, Double minScore) throws Exception { return this.getAutomator().areImagesSimilar(leftImagePath, rightImage, minScore); } // @Override public boolean areImagesSimilar(String leftImagePath, File rightImage) throws Exception { return this.getAutomator().areImagesSimilar(leftImagePath, rightImage); } // @Override public boolean areImagesSimilar(String leftImagePath, File rightImage, Double minScore) throws Exception { return this.getAutomator().areImagesSimilar(leftImagePath, rightImage, minScore); } // @Override public boolean areImagesSimilar(String leftImagePath, String rightImagePath) throws Exception { return this.getAutomator().areImagesSimilar(leftImagePath, rightImagePath); } // @Override public boolean areImagesSimilar(File leftImage, File rightImage) throws Exception { return this.getAutomator().areImagesSimilar(leftImage, rightImage); } @Override public void sendKeysToScreen(String text) throws Exception { this.getAutomator().sendKeysToScreen(text); } @Override public void scrollDown(int count) throws Exception { this.getAutomator().scrollDown(count); } @Override public void scrollDown() throws Exception { this.getAutomator().scrollDown(); } @Override public void scrollUp(int count) throws Exception { this.getAutomator().scrollUp(count); } @Override public void scrollUp() throws Exception { this.getAutomator().scrollUp(); } @Override public void swipeDown(int count) throws Exception { this.getAutomator().swipeDown(count); } @Override public void swipeDown() throws Exception { this.getAutomator().swipeDown(); } @Override public void swipeUp(int count) throws Exception { this.getAutomator().swipeUp(count); } @Override public void swipeUp() throws Exception { this.getAutomator().swipeUp(); } @Override public void switchToNativeView() throws Exception { this.getAutomator().switchToNativeView(); } @Override public void switchToWebView() throws Exception { this.getAutomator().switchToWebView(); } @Override public void switchToWebView(String pkg) throws Exception { this.getAutomator().switchToWebView(pkg); } }
Solana-Bridge/incognito-chain
metadata/common/mocks/Transaction.go
<gh_stars>1-10 // Code generated by mockery v0.0.0-dev. DO NOT EDIT. package mocks import ( common "github.com/incognitochain/incognito-chain/metadata/common" coin "github.com/incognitochain/incognito-chain/privacy/coin" incognito_chaincommon "github.com/incognitochain/incognito-chain/common" mock "github.com/stretchr/testify/mock" proof "github.com/incognitochain/incognito-chain/privacy/proof" statedb "github.com/incognitochain/incognito-chain/dataaccessobject/statedb" ) // Transaction is an autogenerated mock type for the Transaction type type Transaction struct { mock.Mock } // CalculateTxValue provides a mock function with given fields: func (_m *Transaction) CalculateTxValue() uint64 { ret := _m.Called() var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() } else { r0 = ret.Get(0).(uint64) } return r0 } // CheckData provides a mock function with given fields: db func (_m *Transaction) CheckData(db *statedb.StateDB) error { ret := _m.Called(db) var r0 error if rf, ok := ret.Get(0).(func(*statedb.StateDB) error); ok { r0 = rf(db) } else { r0 = ret.Error(0) } return r0 } // CheckTxVersion provides a mock function with given fields: _a0 func (_m *Transaction) CheckTxVersion(_a0 int8) bool { ret := _m.Called(_a0) var r0 bool if rf, ok := ret.Get(0).(func(int8) bool); ok { r0 = rf(_a0) } else { r0 = ret.Get(0).(bool) } return r0 } // GetInfo provides a mock function with given fields: func (_m *Transaction) GetInfo() []byte { ret := _m.Called() var r0 []byte if rf, ok := ret.Get(0).(func() []byte); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]byte) } } return r0 } // GetLockTime provides a mock function with given fields: func (_m *Transaction) GetLockTime() int64 { ret := _m.Called() var r0 int64 if rf, ok := ret.Get(0).(func() int64); ok { r0 = rf() } else { r0 = ret.Get(0).(int64) } return r0 } // GetMetadata provides a mock function with given fields: func (_m *Transaction) GetMetadata() common.Metadata { ret := _m.Called() var r0 common.Metadata if rf, ok := ret.Get(0).(func() common.Metadata); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(common.Metadata) } } return r0 } // GetMetadataType provides a mock function with given fields: func (_m *Transaction) GetMetadataType() int { ret := _m.Called() var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() } else { r0 = ret.Get(0).(int) } return r0 } // GetProof provides a mock function with given fields: func (_m *Transaction) GetProof() proof.Proof { ret := _m.Called() var r0 proof.Proof if rf, ok := ret.Get(0).(func() proof.Proof); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(proof.Proof) } } return r0 } // GetReceiverData provides a mock function with given fields: func (_m *Transaction) GetReceiverData() ([]coin.Coin, error) { ret := _m.Called() var r0 []coin.Coin if rf, ok := ret.Get(0).(func() []coin.Coin); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]coin.Coin) } } var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { r1 = ret.Error(1) } return r0, r1 } // GetReceivers provides a mock function with given fields: func (_m *Transaction) GetReceivers() ([][]byte, []uint64) { ret := _m.Called() var r0 [][]byte if rf, ok := ret.Get(0).(func() [][]byte); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([][]byte) } } var r1 []uint64 if rf, ok := ret.Get(1).(func() []uint64); ok { r1 = rf() } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]uint64) } } return r0, r1 } // GetSenderAddrLastByte provides a mock function with given fields: func (_m *Transaction) GetSenderAddrLastByte() byte { ret := _m.Called() var r0 byte if rf, ok := ret.Get(0).(func() byte); ok { r0 = rf() } else { r0 = ret.Get(0).(byte) } return r0 } // GetSig provides a mock function with given fields: func (_m *Transaction) GetSig() []byte { ret := _m.Called() var r0 []byte if rf, ok := ret.Get(0).(func() []byte); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]byte) } } return r0 } // GetSigPubKey provides a mock function with given fields: func (_m *Transaction) GetSigPubKey() []byte { ret := _m.Called() var r0 []byte if rf, ok := ret.Get(0).(func() []byte); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]byte) } } return r0 } // GetTokenID provides a mock function with given fields: func (_m *Transaction) GetTokenID() *incognito_chaincommon.Hash { ret := _m.Called() var r0 *incognito_chaincommon.Hash if rf, ok := ret.Get(0).(func() *incognito_chaincommon.Hash); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*incognito_chaincommon.Hash) } } return r0 } // GetTransferData provides a mock function with given fields: func (_m *Transaction) GetTransferData() (bool, []byte, uint64, *incognito_chaincommon.Hash) { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } var r1 []byte if rf, ok := ret.Get(1).(func() []byte); ok { r1 = rf() } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]byte) } } var r2 uint64 if rf, ok := ret.Get(2).(func() uint64); ok { r2 = rf() } else { r2 = ret.Get(2).(uint64) } var r3 *incognito_chaincommon.Hash if rf, ok := ret.Get(3).(func() *incognito_chaincommon.Hash); ok { r3 = rf() } else { if ret.Get(3) != nil { r3 = ret.Get(3).(*incognito_chaincommon.Hash) } } return r0, r1, r2, r3 } // GetTxActualSize provides a mock function with given fields: func (_m *Transaction) GetTxActualSize() uint64 { ret := _m.Called() var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() } else { r0 = ret.Get(0).(uint64) } return r0 } // GetTxBurnData provides a mock function with given fields: func (_m *Transaction) GetTxBurnData() (bool, coin.Coin, *incognito_chaincommon.Hash, error) { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } var r1 coin.Coin if rf, ok := ret.Get(1).(func() coin.Coin); ok { r1 = rf() } else { if ret.Get(1) != nil { r1 = ret.Get(1).(coin.Coin) } } var r2 *incognito_chaincommon.Hash if rf, ok := ret.Get(2).(func() *incognito_chaincommon.Hash); ok { r2 = rf() } else { if ret.Get(2) != nil { r2 = ret.Get(2).(*incognito_chaincommon.Hash) } } var r3 error if rf, ok := ret.Get(3).(func() error); ok { r3 = rf() } else { r3 = ret.Error(3) } return r0, r1, r2, r3 } // GetTxFee provides a mock function with given fields: func (_m *Transaction) GetTxFee() uint64 { ret := _m.Called() var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() } else { r0 = ret.Get(0).(uint64) } return r0 } // GetTxFeeToken provides a mock function with given fields: func (_m *Transaction) GetTxFeeToken() uint64 { ret := _m.Called() var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() } else { r0 = ret.Get(0).(uint64) } return r0 } // GetTxFullBurnData provides a mock function with given fields: func (_m *Transaction) GetTxFullBurnData() (bool, coin.Coin, coin.Coin, *incognito_chaincommon.Hash, error) { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } var r1 coin.Coin if rf, ok := ret.Get(1).(func() coin.Coin); ok { r1 = rf() } else { if ret.Get(1) != nil { r1 = ret.Get(1).(coin.Coin) } } var r2 coin.Coin if rf, ok := ret.Get(2).(func() coin.Coin); ok { r2 = rf() } else { if ret.Get(2) != nil { r2 = ret.Get(2).(coin.Coin) } } var r3 *incognito_chaincommon.Hash if rf, ok := ret.Get(3).(func() *incognito_chaincommon.Hash); ok { r3 = rf() } else { if ret.Get(3) != nil { r3 = ret.Get(3).(*incognito_chaincommon.Hash) } } var r4 error if rf, ok := ret.Get(4).(func() error); ok { r4 = rf() } else { r4 = ret.Error(4) } return r0, r1, r2, r3, r4 } // GetTxMintData provides a mock function with given fields: func (_m *Transaction) GetTxMintData() (bool, coin.Coin, *incognito_chaincommon.Hash, error) { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } var r1 coin.Coin if rf, ok := ret.Get(1).(func() coin.Coin); ok { r1 = rf() } else { if ret.Get(1) != nil { r1 = ret.Get(1).(coin.Coin) } } var r2 *incognito_chaincommon.Hash if rf, ok := ret.Get(2).(func() *incognito_chaincommon.Hash); ok { r2 = rf() } else { if ret.Get(2) != nil { r2 = ret.Get(2).(*incognito_chaincommon.Hash) } } var r3 error if rf, ok := ret.Get(3).(func() error); ok { r3 = rf() } else { r3 = ret.Error(3) } return r0, r1, r2, r3 } // GetType provides a mock function with given fields: func (_m *Transaction) GetType() string { ret := _m.Called() var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() } else { r0 = ret.Get(0).(string) } return r0 } // GetValidationEnv provides a mock function with given fields: func (_m *Transaction) GetValidationEnv() common.ValidationEnviroment { ret := _m.Called() var r0 common.ValidationEnviroment if rf, ok := ret.Get(0).(func() common.ValidationEnviroment); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(common.ValidationEnviroment) } } return r0 } // GetVersion provides a mock function with given fields: func (_m *Transaction) GetVersion() int8 { ret := _m.Called() var r0 int8 if rf, ok := ret.Get(0).(func() int8); ok { r0 = rf() } else { r0 = ret.Get(0).(int8) } return r0 } // Hash provides a mock function with given fields: func (_m *Transaction) Hash() *incognito_chaincommon.Hash { ret := _m.Called() var r0 *incognito_chaincommon.Hash if rf, ok := ret.Get(0).(func() *incognito_chaincommon.Hash); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*incognito_chaincommon.Hash) } } return r0 } // HashWithoutMetadataSig provides a mock function with given fields: func (_m *Transaction) HashWithoutMetadataSig() *incognito_chaincommon.Hash { ret := _m.Called() var r0 *incognito_chaincommon.Hash if rf, ok := ret.Get(0).(func() *incognito_chaincommon.Hash); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*incognito_chaincommon.Hash) } } return r0 } // Init provides a mock function with given fields: _a0 func (_m *Transaction) Init(_a0 interface{}) error { ret := _m.Called(_a0) var r0 error if rf, ok := ret.Get(0).(func(interface{}) error); ok { r0 = rf(_a0) } else { r0 = ret.Error(0) } return r0 } // IsCoinsBurning provides a mock function with given fields: _a0, _a1, _a2, _a3 func (_m *Transaction) IsCoinsBurning(_a0 common.ChainRetriever, _a1 common.ShardViewRetriever, _a2 common.BeaconViewRetriever, _a3 uint64) bool { ret := _m.Called(_a0, _a1, _a2, _a3) var r0 bool if rf, ok := ret.Get(0).(func(common.ChainRetriever, common.ShardViewRetriever, common.BeaconViewRetriever, uint64) bool); ok { r0 = rf(_a0, _a1, _a2, _a3) } else { r0 = ret.Get(0).(bool) } return r0 } // IsPrivacy provides a mock function with given fields: func (_m *Transaction) IsPrivacy() bool { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } return r0 } // IsSalaryTx provides a mock function with given fields: func (_m *Transaction) IsSalaryTx() bool { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } return r0 } // ListOTAHashH provides a mock function with given fields: func (_m *Transaction) ListOTAHashH() []incognito_chaincommon.Hash { ret := _m.Called() var r0 []incognito_chaincommon.Hash if rf, ok := ret.Get(0).(func() []incognito_chaincommon.Hash); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]incognito_chaincommon.Hash) } } return r0 } // ListSerialNumbersHashH provides a mock function with given fields: func (_m *Transaction) ListSerialNumbersHashH() []incognito_chaincommon.Hash { ret := _m.Called() var r0 []incognito_chaincommon.Hash if rf, ok := ret.Get(0).(func() []incognito_chaincommon.Hash); ok { r0 = rf() } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]incognito_chaincommon.Hash) } } return r0 } // LoadData provides a mock function with given fields: db func (_m *Transaction) LoadData(db *statedb.StateDB) error { ret := _m.Called(db) var r0 error if rf, ok := ret.Get(0).(func(*statedb.StateDB) error); ok { r0 = rf(db) } else { r0 = ret.Error(0) } return r0 } // SetGetSenderAddrLastByte provides a mock function with given fields: _a0 func (_m *Transaction) SetGetSenderAddrLastByte(_a0 byte) { _m.Called(_a0) } // SetInfo provides a mock function with given fields: _a0 func (_m *Transaction) SetInfo(_a0 []byte) { _m.Called(_a0) } // SetLockTime provides a mock function with given fields: _a0 func (_m *Transaction) SetLockTime(_a0 int64) { _m.Called(_a0) } // SetMetadata provides a mock function with given fields: _a0 func (_m *Transaction) SetMetadata(_a0 common.Metadata) { _m.Called(_a0) } // SetProof provides a mock function with given fields: _a0 func (_m *Transaction) SetProof(_a0 proof.Proof) { _m.Called(_a0) } // SetSig provides a mock function with given fields: _a0 func (_m *Transaction) SetSig(_a0 []byte) { _m.Called(_a0) } // SetSigPubKey provides a mock function with given fields: _a0 func (_m *Transaction) SetSigPubKey(_a0 []byte) { _m.Called(_a0) } // SetTxFee provides a mock function with given fields: _a0 func (_m *Transaction) SetTxFee(_a0 uint64) { _m.Called(_a0) } // SetType provides a mock function with given fields: _a0 func (_m *Transaction) SetType(_a0 string) { _m.Called(_a0) } // SetValidationEnv provides a mock function with given fields: _a0 func (_m *Transaction) SetValidationEnv(_a0 common.ValidationEnviroment) { _m.Called(_a0) } // SetVersion provides a mock function with given fields: _a0 func (_m *Transaction) SetVersion(_a0 int8) { _m.Called(_a0) } // String provides a mock function with given fields: func (_m *Transaction) String() string { ret := _m.Called() var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() } else { r0 = ret.Get(0).(string) } return r0 } // UnmarshalJSON provides a mock function with given fields: data func (_m *Transaction) UnmarshalJSON(data []byte) error { ret := _m.Called(data) var r0 error if rf, ok := ret.Get(0).(func([]byte) error); ok { r0 = rf(data) } else { r0 = ret.Error(0) } return r0 } // ValidateDoubleSpendWithBlockchain provides a mock function with given fields: _a0, _a1, _a2 func (_m *Transaction) ValidateDoubleSpendWithBlockchain(_a0 byte, _a1 *statedb.StateDB, _a2 *incognito_chaincommon.Hash) error { ret := _m.Called(_a0, _a1, _a2) var r0 error if rf, ok := ret.Get(0).(func(byte, *statedb.StateDB, *incognito_chaincommon.Hash) error); ok { r0 = rf(_a0, _a1, _a2) } else { r0 = ret.Error(0) } return r0 } // ValidateSanityData provides a mock function with given fields: _a0, _a1, _a2, _a3 func (_m *Transaction) ValidateSanityData(_a0 common.ChainRetriever, _a1 common.ShardViewRetriever, _a2 common.BeaconViewRetriever, _a3 uint64) (bool, error) { ret := _m.Called(_a0, _a1, _a2, _a3) var r0 bool if rf, ok := ret.Get(0).(func(common.ChainRetriever, common.ShardViewRetriever, common.BeaconViewRetriever, uint64) bool); ok { r0 = rf(_a0, _a1, _a2, _a3) } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func(common.ChainRetriever, common.ShardViewRetriever, common.BeaconViewRetriever, uint64) error); ok { r1 = rf(_a0, _a1, _a2, _a3) } else { r1 = ret.Error(1) } return r0, r1 } // ValidateSanityDataByItSelf provides a mock function with given fields: func (_m *Transaction) ValidateSanityDataByItSelf() (bool, error) { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { r1 = ret.Error(1) } return r0, r1 } // ValidateSanityDataWithBlockchain provides a mock function with given fields: chainRetriever, shardViewRetriever, beaconViewRetriever, beaconHeight func (_m *Transaction) ValidateSanityDataWithBlockchain(chainRetriever common.ChainRetriever, shardViewRetriever common.ShardViewRetriever, beaconViewRetriever common.BeaconViewRetriever, beaconHeight uint64) (bool, error) { ret := _m.Called(chainRetriever, shardViewRetriever, beaconViewRetriever, beaconHeight) var r0 bool if rf, ok := ret.Get(0).(func(common.ChainRetriever, common.ShardViewRetriever, common.BeaconViewRetriever, uint64) bool); ok { r0 = rf(chainRetriever, shardViewRetriever, beaconViewRetriever, beaconHeight) } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func(common.ChainRetriever, common.ShardViewRetriever, common.BeaconViewRetriever, uint64) error); ok { r1 = rf(chainRetriever, shardViewRetriever, beaconViewRetriever, beaconHeight) } else { r1 = ret.Error(1) } return r0, r1 } // ValidateTransaction provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 func (_m *Transaction) ValidateTransaction(_a0 map[string]bool, _a1 *statedb.StateDB, _a2 *statedb.StateDB, _a3 byte, _a4 *incognito_chaincommon.Hash) (bool, []proof.Proof, error) { ret := _m.Called(_a0, _a1, _a2, _a3, _a4) var r0 bool if rf, ok := ret.Get(0).(func(map[string]bool, *statedb.StateDB, *statedb.StateDB, byte, *incognito_chaincommon.Hash) bool); ok { r0 = rf(_a0, _a1, _a2, _a3, _a4) } else { r0 = ret.Get(0).(bool) } var r1 []proof.Proof if rf, ok := ret.Get(1).(func(map[string]bool, *statedb.StateDB, *statedb.StateDB, byte, *incognito_chaincommon.Hash) []proof.Proof); ok { r1 = rf(_a0, _a1, _a2, _a3, _a4) } else { if ret.Get(1) != nil { r1 = ret.Get(1).([]proof.Proof) } } var r2 error if rf, ok := ret.Get(2).(func(map[string]bool, *statedb.StateDB, *statedb.StateDB, byte, *incognito_chaincommon.Hash) error); ok { r2 = rf(_a0, _a1, _a2, _a3, _a4) } else { r2 = ret.Error(2) } return r0, r1, r2 } // ValidateTxByItself provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5, _a6 func (_m *Transaction) ValidateTxByItself(_a0 map[string]bool, _a1 *statedb.StateDB, _a2 *statedb.StateDB, _a3 common.ChainRetriever, _a4 byte, _a5 common.ShardViewRetriever, _a6 common.BeaconViewRetriever) (bool, error) { ret := _m.Called(_a0, _a1, _a2, _a3, _a4, _a5, _a6) var r0 bool if rf, ok := ret.Get(0).(func(map[string]bool, *statedb.StateDB, *statedb.StateDB, common.ChainRetriever, byte, common.ShardViewRetriever, common.BeaconViewRetriever) bool); ok { r0 = rf(_a0, _a1, _a2, _a3, _a4, _a5, _a6) } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func(map[string]bool, *statedb.StateDB, *statedb.StateDB, common.ChainRetriever, byte, common.ShardViewRetriever, common.BeaconViewRetriever) error); ok { r1 = rf(_a0, _a1, _a2, _a3, _a4, _a5, _a6) } else { r1 = ret.Error(1) } return r0, r1 } // ValidateTxCorrectness provides a mock function with given fields: db func (_m *Transaction) ValidateTxCorrectness(db *statedb.StateDB) (bool, error) { ret := _m.Called(db) var r0 bool if rf, ok := ret.Get(0).(func(*statedb.StateDB) bool); ok { r0 = rf(db) } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func(*statedb.StateDB) error); ok { r1 = rf(db) } else { r1 = ret.Error(1) } return r0, r1 } // ValidateTxSalary provides a mock function with given fields: _a0 func (_m *Transaction) ValidateTxSalary(_a0 *statedb.StateDB) (bool, error) { ret := _m.Called(_a0) var r0 bool if rf, ok := ret.Get(0).(func(*statedb.StateDB) bool); ok { r0 = rf(_a0) } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func(*statedb.StateDB) error); ok { r1 = rf(_a0) } else { r1 = ret.Error(1) } return r0, r1 } // ValidateTxWithBlockChain provides a mock function with given fields: chainRetriever, shardViewRetriever, beaconViewRetriever, shardID, stateDB func (_m *Transaction) ValidateTxWithBlockChain(chainRetriever common.ChainRetriever, shardViewRetriever common.ShardViewRetriever, beaconViewRetriever common.BeaconViewRetriever, shardID byte, stateDB *statedb.StateDB) error { ret := _m.Called(chainRetriever, shardViewRetriever, beaconViewRetriever, shardID, stateDB) var r0 error if rf, ok := ret.Get(0).(func(common.ChainRetriever, common.ShardViewRetriever, common.BeaconViewRetriever, byte, *statedb.StateDB) error); ok { r0 = rf(chainRetriever, shardViewRetriever, beaconViewRetriever, shardID, stateDB) } else { r0 = ret.Error(0) } return r0 } // ValidateTxWithCurrentMempool provides a mock function with given fields: _a0 func (_m *Transaction) ValidateTxWithCurrentMempool(_a0 common.MempoolRetriever) error { ret := _m.Called(_a0) var r0 error if rf, ok := ret.Get(0).(func(common.MempoolRetriever) error); ok { r0 = rf(_a0) } else { r0 = ret.Error(0) } return r0 } // ValidateType provides a mock function with given fields: func (_m *Transaction) ValidateType() bool { ret := _m.Called() var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() } else { r0 = ret.Get(0).(bool) } return r0 } // Verify provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 func (_m *Transaction) Verify(_a0 map[string]bool, _a1 *statedb.StateDB, _a2 *statedb.StateDB, _a3 byte, _a4 *incognito_chaincommon.Hash) (bool, error) { ret := _m.Called(_a0, _a1, _a2, _a3, _a4) var r0 bool if rf, ok := ret.Get(0).(func(map[string]bool, *statedb.StateDB, *statedb.StateDB, byte, *incognito_chaincommon.Hash) bool); ok { r0 = rf(_a0, _a1, _a2, _a3, _a4) } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func(map[string]bool, *statedb.StateDB, *statedb.StateDB, byte, *incognito_chaincommon.Hash) error); ok { r1 = rf(_a0, _a1, _a2, _a3, _a4) } else { r1 = ret.Error(1) } return r0, r1 } // VerifyMinerCreatedTxBeforeGettingInBlock provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5 func (_m *Transaction) VerifyMinerCreatedTxBeforeGettingInBlock(_a0 *common.MintData, _a1 byte, _a2 common.ChainRetriever, _a3 *common.AccumulatedValues, _a4 common.ShardViewRetriever, _a5 common.BeaconViewRetriever) (bool, error) { ret := _m.Called(_a0, _a1, _a2, _a3, _a4, _a5) var r0 bool if rf, ok := ret.Get(0).(func(*common.MintData, byte, common.ChainRetriever, *common.AccumulatedValues, common.ShardViewRetriever, common.BeaconViewRetriever) bool); ok { r0 = rf(_a0, _a1, _a2, _a3, _a4, _a5) } else { r0 = ret.Get(0).(bool) } var r1 error if rf, ok := ret.Get(1).(func(*common.MintData, byte, common.ChainRetriever, *common.AccumulatedValues, common.ShardViewRetriever, common.BeaconViewRetriever) error); ok { r1 = rf(_a0, _a1, _a2, _a3, _a4, _a5) } else { r1 = ret.Error(1) } return r0, r1 }
GregDevProjects/carbon-header-fix
node_modules/@carbon/icons-react/es/earth--americas/24.js
import { EarthAmericas24 } from '..'; export default EarthAmericas24;
Omnirobotic/godot
modules/scene_manager/include/std_msgs/msg/u_int64_multi_array.hpp
<reponame>Omnirobotic/godot<gh_stars>1-10 // generated from rosidl_generator_cpp/resource/msg.hpp.em // generated code does not contain a copyright notice #ifndef STD_MSGS__MSG__U_INT64_MULTI_ARRAY_HPP_ #define STD_MSGS__MSG__U_INT64_MULTI_ARRAY_HPP_ #include "std_msgs/msg/u_int64_multi_array__struct.hpp" #include "std_msgs/msg/u_int64_multi_array__traits.hpp" #endif // STD_MSGS__MSG__U_INT64_MULTI_ARRAY_HPP_
yvasyliev/deezer-api
src/test/java/api/deezer/requests/GenreRequestsTest.java
package api.deezer.requests; import api.deezer.DeezerApi; import api.deezer.http.impl.DeezerRequest; import api.deezer.http.impl.PaginationRequest; import api.deezer.objects.data.ArtistData; import api.deezer.objects.data.GenreData; import api.deezer.objects.data.RadioData; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; class GenreRequestsTest { DeezerApi deezerApi = new DeezerApi("accessToken"); @Test void getAll() { DeezerRequest<GenreData> request = deezerApi.genre().getAll(); assertEquals("https://api.deezer.com/genre", request.getUrl()); assertEquals("get", request.getParams().get("request_method")); } @Test void getArtistsByGenreId() { PaginationRequest<ArtistData> request = deezerApi.genre().getArtistsByGenreId(1).limit(5).offset(1); assertEquals("https://api.deezer.com/genre/1/artists", request.getUrl()); assertEquals("get", request.getParams().get("request_method")); assertEquals("5", request.getParams().get("limit")); assertEquals("1", request.getParams().get("offset")); } @Test void getRadiosByGenreId() { PaginationRequest<RadioData> request = deezerApi.genre().getRadiosByGenreId(1).limit(5).offset(1); assertEquals("https://api.deezer.com/genre/1/radios", request.getUrl()); assertEquals("get", request.getParams().get("request_method")); assertEquals("5", request.getParams().get("limit")); assertEquals("1", request.getParams().get("offset")); } }
ckamtsikis/cmssw
Configuration/Eras/python/Era_Phase2C12_dd4hep_cff.py
import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Phase2C12_cff import Phase2C12 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep Phase2C12_dd4hep = cms.ModifierChain(Phase2C12, dd4hep)
FTC14245RedStorm/RedStorm_2019_2020_ftc52_app
TeamCode/src/main/java/Reference/RedStorm/LastYear/FacingDepot.java
<reponame>FTC14245RedStorm/RedStorm_2019_2020_ftc52_app //package org.firstinspires.ftc.teamcode; // //import com.qualcomm.robotcore.eventloop.opmode.Autonomous; //import com.qualcomm.robotcore.eventloop.opmode.Disabled; //import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; // //import RedStorm.Robot.Robot; // ////@Autonomous(name="FacingDepot", group="FacingDepot") // //@Disabled //public class FacingDepot extends LinearOpMode { // // public Robot robot = new Robot(); // String remember = new String(); // // @Override // public void runOpMode() throws InterruptedException { // robot.initialize(hardwareMap); // Initialize the robot // robot.resetEncoders(); // Reset the encoder counts // robot.runWithEncoders(); // Tell the motors to run with encoders // //robot.setLiftServo(.4); // // telemetry.addData("Status ", "Initialized"); // telemetry.update(); // // waitForStart(); // // double startDeployTime = System.currentTimeMillis(); // // robot.setLiftServo(.6); // // Thread.sleep(250); // // robot.setLiftMotorPower(-.2); // // while (opModeIsActive() && // // robot.getLiftEncoderCount() < 135 // // && // System.currentTimeMillis() - startDeployTime < 3000) { // // } // telemetry.addData("Status ", "Deployed"); // telemetry.update(); // // robot.setLiftMotorPower(0); // // Thread.sleep(500); // // //we should be dismounted from space lander // // robot.setDriveMotorPower(.2, -.2); // // while (opModeIsActive() && // robot.getHeading() < 15) { // // } // telemetry.addData("Status ", "Turned"); // telemetry.update(); // // robot.resetEncoders(); // robot.runWithEncoders(); // robot.setDriveMotorPower(0, 0); // // //we should be out of handle // double distanceToTravel = robot.calculateEncoderCounts(4); // telemetry.addData("Status ", "DistTravCalc"); // telemetry.addData("distance to travel: ", "%5.2f", distanceToTravel); // telemetry.addData("enc count: ", "%5.2f", robot.getDriveEncoderCount()); // telemetry.update(); // // // robot.setDriveMotorPower(-.2, -.2); // while (opModeIsActive() && // robot.getDriveEncoderCount() < distanceToTravel) ; // { // telemetry.addData("Status ", "MovingAwayFromLander"); // telemetry.addData("Enc Count:", "%5.2f", robot.getDriveEncoderCount()); // telemetry.update(); // // // } // // telemetry.addData("Status ", "AwayFromLander"); // telemetry.update(); // // // robot.setDriveMotorPower(-.2, 0); // // double crntHeading = robot.getHeading(); // robot.initializeIMU(); // // while (opModeIsActive() && // robot.getHeading() < 3) { // telemetry.addData("Initial heading: ", "%5.2f", crntHeading); // telemetry.addData("heading: ", "%5.2f", robot.getHeading()); // telemetry.update(); // } // telemetry.addData("Status ", "Straight"); // telemetry.update(); // // distanceToTravel = robot.calculateEncoderCounts(42); // robot.resetEncoders(); // robot.runWithEncoders(); // robot.setDriveMotorPower(-.8, -.8); // while (opModeIsActive() && // robot.getDriveEncoderCount() < distanceToTravel) { // } // telemetry.addData("Status ", "InDepot"); // telemetry.update(); // // robot.setDriveMotorPower(0, 0); // // robot.initializeIMU(); // robot.setDriveMotorPower(.5, 0); // while (opModeIsActive() && // robot.getHeading() < 50) { // telemetry.addData("Initial heading: ", "%5.2f", crntHeading); // telemetry.addData("heading: ", "%5.2f", robot.getHeading()); // telemetry.update(); // } // // robot.setDriveMotorPower(0, 0); // robot.setTeamMarkerArm(0.1); // // Thread.sleep(1000); // // robot.setTeamMarkerGrip(.5); // // Thread.sleep(1000); // // robot.setTeamMarkerArm(-.5); // // Thread.sleep(1000); // // // Start follow the wall // // robot.resetEncoders(); // robot.runWithEncoders(); // // double wallDistanceToTravel = robot.calculateEncoderCounts(70); // // robot.setDriveMotorPower(0.5, 0.5); // double wallDistanceTraveled = 0; // // // while (opModeIsActive() && wallDistanceToTravel >= wallDistanceTraveled) { // // // double distanceFromWall = robot.getRightDistance(); // wallDistanceTraveled = robot.getDriveEncoderCount(); // // robot.setDriveMotorPower(0.5, 0.5); // // while (opModeIsActive() && wallDistanceToTravel >= wallDistanceTraveled) { // // distanceFromWall = robot.getRightDistance(); // wallDistanceTraveled = robot.getDriveEncoderCount(); // // telemetry.addData("left distance", "(%.2f)", robot.getLeftDistance()); // telemetry.addData("right distance", "(%.2f)", robot.getRightDistance()); // telemetry.addData("front distance", "(%.2f)", robot.getFrontDistance()); // telemetry.update(); // // if (distanceFromWall > 5.0) { // robot.setDriveMotorPower(0.5, 0.4); // telemetry.addLine("turning right - towards wall"); // remember = "right"; // } else { // if (distanceFromWall < 4.0) { // robot.setDriveMotorPower(0.4, 0.5); // telemetry.addLine("turning left - away from wall "); // remember = "left"; // } else { // robot.setDriveMotorPower(0.5, 0.5); // telemetry.addLine("Not turning, going straight"); // remember = "straight"; // } // } // // if (distanceFromWall > 250) { // if (remember.equals("right")) { // robot.setDriveMotorPower(0.4, 0.5); // } else { // if (remember.equals("left")) { // robot.setDriveMotorPower(0.5, 0.4); // } else { // robot.setDriveMotorPower(0.5, 0.5); // } // } // // // } // // } // } // // } // //} // // //
bill-simons/jtsgen
processor/src/test/java/dz/jtsgen/processor/helper/IdentHelperTest.java
/* * Copyright (c) 2017 <NAME> * * This file is part of jtsgen. * * jtsgen is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * jtsgen is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with jtsgen. If not, see http://www.gnu.org/licenses/ * */ package dz.jtsgen.processor.helper; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; class IdentHelperTest { @Test void identPrefix() { // following is not really useful IdentHelper identHelper = new IdentHelper(); assertEquals(IdentHelper.identPrefix(-1),""); assertEquals(IdentHelper.identPrefix(0),""); assertEquals(IdentHelper.identPrefix(1)," "); assertEquals(IdentHelper.identPrefix(2)," "); assertEquals(IdentHelper.identPrefix(10)," "); assertEquals(IdentHelper.identPrefix(11)," "); assertEquals(IdentHelper.identPrefix(12)," "); assertEquals(IdentHelper.identPrefix(13)," "); assertEquals(IdentHelper.identPrefix(14)," "); assertEquals(IdentHelper.identPrefix(20)," "); } }
caroweng/Ninja
PlayerModule/src/main/scala/player/Player.scala
package player case class Player(name: String, state: StateOfPlayer.stateOfPlayer, id: Int) extends PlayerInterface { def changeState(newState: StateOfPlayer.stateOfPlayer): PlayerInterface = this.copy(state = newState) def setName(newName: String): PlayerInterface = this.copy(name = newName) }
rykrr/Quinterac
frontend/src/test/java/ca/queensu/cisc327/afk/R8.java
package ca.queensu.cisc327.afk; import static org.junit.Assert.*; import java.util.Arrays; import org.junit.Test; public class R8 extends AppTest{ @Test public void testAppr8T1() throws Exception { // runAndTest(getListFromFile("./tests/r8/t1/console_input.txt"), getListFromFile("./tests/r8/t1/accounts.txt"), getListFromFile("./tests/r8/t1/console_output.txt"), getListFromFile("./tests/r8/t1/expected_transactions.txt")); } @Test public void testAppr8T2() throws Exception { runAndTest(getListFromFile("./tests/r8/t2/console_input.txt"), getListFromFile("./tests/r8/t2/accounts.txt"), getListFromFile("./tests/r8/t2/console_output.txt"), getListFromFile("./tests/r8/t2/expected_transactions.txt")); } @Test public void testAppr8T3() throws Exception { runAndTest(getListFromFile("./tests/r8/t3/console_input.txt"), getListFromFile("./tests/r8/t3/accounts.txt"), getListFromFile("./tests/r8/t3/console_output.txt"), getListFromFile("./tests/r8/t3/expected_transactions.txt")); } @Test public void testAppr8T4() throws Exception { runAndTest(getListFromFile("./tests/r8/t4/console_input.txt"), getListFromFile("./tests/r8/t4/accounts.txt"), getListFromFile("./tests/r8/t4/console_output.txt"), getListFromFile("./tests/r8/t4/expected_transactions.txt")); } @Test public void testAppr8T5() throws Exception { runAndTest(getListFromFile("./tests/r8/t5/console_input.txt"), getListFromFile("./tests/r8/t5/accounts.txt"), getListFromFile("./tests/r8/t5/console_output.txt"), getListFromFile("./tests/r8/t5/expected_transactions.txt")); } @Test public void testAppr8T6() throws Exception { runAndTest(getListFromFile("./tests/r8/t6/console_input.txt"), getListFromFile("./tests/r8/t6/accounts.txt"), getListFromFile("./tests/r8/t6/console_output.txt"), getListFromFile("./tests/r8/t6/expected_transactions.txt")); } @Test public void testAppr8T7() throws Exception { runAndTest(getListFromFile("./tests/r8/t7/console_input.txt"), getListFromFile("./tests/r8/t7/accounts.txt"), getListFromFile("./tests/r8/t7/console_output.txt"), getListFromFile("./tests/r8/t7/expected_transactions.txt")); } @Test public void testAppr8T8() throws Exception { runAndTest(getListFromFile("./tests/r8/t8/console_input.txt"), getListFromFile("./tests/r8/t8/accounts.txt"), getListFromFile("./tests/r8/t8/console_output.txt"), getListFromFile("./tests/r8/t8/expected_transactions.txt")); } @Test public void testAppr8T9() throws Exception { runAndTest(getListFromFile("./tests/r8/t9/console_input.txt"), getListFromFile("./tests/r8/t9/accounts.txt"), getListFromFile("./tests/r8/t9/console_output.txt"), getListFromFile("./tests/r8/t9/expected_transactions.txt")); } }
octohelm/cuemod
pkg/cuemoperator/controller_release.go
<reponame>octohelm/cuemod package cuemoperator import ( "context" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" releasev1alpha1 "github.com/octohelm/cuemod/pkg/apis/release/v1alpha1" "github.com/octohelm/cuemod/pkg/kubernetes" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "github.com/go-logr/logr" "github.com/octohelm/cuemod/pkg/plugins/kube" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" ) type ReleaseReconciler struct { Client client.Client APIReader client.Reader Log logr.Logger Scheme *runtime.Scheme } func (r *ReleaseReconciler) SetupWithManager(mgr ctrl.Manager) error { gvks, err := allWatchableGroupVersionKinds(mgr.GetConfig()) if err != nil { return err } c := ctrl.NewControllerManagedBy(mgr).For(&releasev1alpha1.Release{}) for i := range gvks { if gvks[i].Group == releasev1alpha1.SchemeGroupVersion.Group { continue } u := &unstructured.Unstructured{} u.SetGroupVersionKind(gvks[i]) c = c.Owns(u, builder.OnlyMetadata) } return c.Complete(r) } func (r *ReleaseReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { release := &releasev1alpha1.Release{} if err := r.APIReader.Get(ctx, request.NamespacedName, release); err != nil { if apierrors.IsNotFound(err) { return reconcile.Result{}, nil } return reconcile.Result{}, err } ret, err := kube.Process(release, nil) if err != nil { r.Log.Error(err, "eval template failed") return reconcile.Result{}, nil } release.Status.Resources = nil for i := range ret.Resources { o := ret.Resources[i] // skip namespace if o.GetObjectKind().GroupVersionKind().Kind == "Namespace" { continue } if err := controllerutil.SetControllerReference(release, o, r.Scheme); err != nil { r.Log.Error(err, "set controller failed") return reconcile.Result{}, nil } if err := kubernetes.ApplyOne(ctx, ClientWithoutCache(r.Client, r.APIReader), o, false); err != nil { r.Log.Error(err, "apply template failed") return reconcile.Result{}, nil } gvk := o.GetObjectKind().GroupVersionKind() release.Status.Resources = append(release.Status.Resources, releasev1alpha1.Resource{ GroupVersionKind: metav1.GroupVersionKind{ Group: gvk.Group, Version: gvk.Version, Kind: gvk.Kind, }, Namespace: o.GetNamespace(), Name: o.GetName(), }) } if err := r.Client.Status().Update(ctx, release); err != nil { r.Log.Error(err, "update status err") return reconcile.Result{}, nil } return reconcile.Result{}, nil }
mamacmm/lemon
src/main/java/com/mossle/user/rs/AvatarResource.java
<filename>src/main/java/com/mossle/user/rs/AvatarResource.java package com.mossle.user.rs; import java.io.*; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.ws.rs.DefaultValue; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import com.mossle.api.internal.StoreConnector; import com.mossle.api.internal.StoreDTO; import com.mossle.core.mapper.JsonMapper; import com.mossle.core.util.BaseDTO; import com.mossle.core.util.IoUtils; import com.mossle.core.util.StringUtils; import com.mossle.user.persistence.domain.UserBase; import com.mossle.user.persistence.manager.UserBaseManager; import com.mossle.user.service.UserAvatarService; import com.mossle.user.service.UserService; import com.mossle.user.support.UserBaseWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component @Path("avatar") public class AvatarResource { private static Logger logger = LoggerFactory .getLogger(AvatarResource.class); private UserAvatarService userAvatarService; @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) public InputStream view(@QueryParam("id") String id, @QueryParam("width") @DefaultValue("0") int width) throws Exception { logger.debug("width : {}", width); Long longId = null; try { longId = Long.parseLong(id); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } return userAvatarService.viewAvatar(longId, width).getInputStream(); } // ~ ====================================================================== @Resource public void setUserAvatarService(UserAvatarService userAvatarService) { this.userAvatarService = userAvatarService; } }
ghJo-Gaia3D/mago3d
mago3d-user/src/main/java/gaia3d/domain/data/TileInfo.java
<gh_stars>10-100 package gaia3d.domain.data; import com.fasterxml.jackson.annotation.JsonFormat; import gaia3d.domain.common.Search; import lombok.*; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; /** * 스마트 타일 정보 */ @ToString(callSuper = true) @Builder @Getter @Setter @NoArgsConstructor @AllArgsConstructor public class TileInfo extends Search { // 스마트 타일링 고유번호 private Integer tileId; // 타일명 private String tileName; // 타일 Key private String tileKey; // 스마트 타일 경로 private String tilePath; // 사용자 아이디 private String userId; // 상태. ready : 준비, success : 성공, waiting : 승인대기, fail : 실패 private String status; // true : 사용, false : 사용안함 private Boolean available; // 설명 private String description; @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul") private LocalDateTime viewUpdateDate; @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul") private LocalDateTime viewInsertDate; public LocalDateTime getViewUpdateDate() { return this.updateDate; } public LocalDateTime getViewInsertDate() { return this.insertDate; } // 수정일 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private LocalDateTime updateDate; // 등록일 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private LocalDateTime insertDate; }
chav1961/purelib
src/test/java/chav1961/purelib/basic/BPlusTreeTest.java
<gh_stars>0 package chav1961.purelib.basic; import org.junit.Assert; import org.junit.Test; public class BPlusTreeTest { @Test public void test() { } }
jomarquez/CRviz
src/App.js
<reponame>jomarquez/CRviz<gh_stars>0 import React, { Component } from "react"; import { connect } from 'react-redux'; import classNames from 'classnames'; import Modal from 'react-modal'; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCheck, faDizzy, faPlusCircle, faMinusCircle } from "@fortawesome/free-solid-svg-icons"; import { selectDataset } from 'domain/dataset'; import { selectControls } from 'domain/controls'; import { getError, clearError } from "domain/error"; import Header from 'features/header/Header'; import HierarchySelector from 'features/hierarchy-selector/HierarchySelector'; import MiscControls from 'features/misc-controls/MiscControls'; import SearchControls from 'features/search/SearchControls'; import Visualization from 'features/visualization/Visualization'; import DatasetControls from 'features/dataset-controls/DatasetControls'; import style from './App.module.css'; import datasets from './datasets'; const uuidv4 = require('uuid/v4'); Modal.setAppElement('#root'); class App extends Component { state = { showData: true, showGrouping: false, showFiltering: false, uuid1: uuidv4(), uuid2: uuidv4(), } toggleShowData = () =>{ this.setState({ showData: !this.state.showData, showGrouping: false, showFiltering: false, }); } toggleShowGrouping = () =>{ this.setState({ showData: false, showGrouping: !this.state.showGrouping, showFiltering: false }); } toggleShowFiltering = () =>{ this.setState({ showData: false, showGrouping: false, showFiltering: !this.state.showFiltering }); } onErrorClose = () => { this.props.clearError(); } render() { const { dataset, darkTheme, error } = this.props; const hasDataset = dataset && dataset.length > 0; const showData = this.state.showData; const showGrouping = this.state.showGrouping; const showFiltering = this.state.showFiltering; return ( <div className={ classNames({ [style.appContainer]: true, 'darkTheme': darkTheme }) }> <input name="hideControls" id="hideControls" type="checkbox" /> <label htmlFor="hideControls" className={ style.hideControls }> { /* <FontAwesomeIcon icon={faChevron} /> */ } <span>&lt;&lt;</span> </label> <div className={ style.controls }> <Header /> <div className={style.accordionHeader} onClick={this.toggleShowData}> Data {!showData && <FontAwesomeIcon icon={faPlusCircle} />}{showData && <FontAwesomeIcon onClick={this.toggleShowData} icon={faMinusCircle} />} </div> <div> <div className={ classNames({ [style.section]: true, [style.hidden]: !showData }) }> <DatasetControls uuid={ this.state.uuid1 } datasets={ datasets }/> </div> <div className={ classNames({ [style.section]: true, [style.hidden]: !showData }) }> <DatasetControls uuid={ this.state.uuid2 } datasets={ datasets }/> </div> </div> { hasDataset && <div className={ classNames({ [style.section]: true, [style.hidden]: !showData }) }> <SearchControls /> </div> } <div className={style.accordionHeader} onClick={this.toggleShowGrouping}> Grouping {!showGrouping && <FontAwesomeIcon icon={faPlusCircle} />}{showGrouping && <FontAwesomeIcon onClick={this.toggleShowGrouping} icon={faMinusCircle} />} </div> { hasDataset && <div className={ classNames({ [style.section]: true, [style.hierarchySection]: true, [style.hidden]: !showGrouping }) }> <HierarchySelector /> </div> } { hasDataset && <div className={ classNames({ [style.section]: true, [style.hidden]: !showGrouping }) }> <MiscControls /> </div> } { !hasDataset && <div className={ classNames({ [style.section]: true, [style.dimSection]:true, [style.hierarchySection]: true, [style.hidden]: !showGrouping }) }> Please Select a dataset to Continue </div> } <div className={style.accordionHeader} onClick={this.toggleShowFiltering}> Filtering {!showFiltering && <FontAwesomeIcon icon={faPlusCircle} />}{showFiltering && <FontAwesomeIcon onClick={this.toggleShowFiltering} icon={faMinusCircle} />} </div> <div> </div> { !hasDataset && <div className={ classNames({ [style.section]: true, [style.dimSection]:true, [style.hierarchySection]: true, [style.hidden]: !showFiltering }) }> Please Select a dataset to Continue </div> } </div> <div className={ style.canvas }> <Visualization /> </div> <Modal isOpen={ error !== null } onRequestClose={this.onErrorClose} contentLabel="An Error has occurred"> <div className={ style.modal }> <div className={ style.modalMain }> <span className={ style.justifySpan }> <div className={ style.icon } title="Error"> <FontAwesomeIcon icon={faDizzy} size="7x" color="#cc0000"/> </div> <div> { error ? error.message : ""} </div> </span> <div> <span className={ style.centerSpan }> <div className="button" title="Ok" onClick={this.onErrorClose}> <FontAwesomeIcon icon={faCheck} /> </div> </span> </div> </div> </div> </Modal> </div> ); } } const mapStateToProps = state => { const hash = Object.keys(state.dataset.datasets)[0] || "" return { dataset: selectDataset(state, hash), darkTheme: selectControls(state).darkTheme, error: getError(state) } } const mapDispatchToProps = { clearError }; export default connect(mapStateToProps, mapDispatchToProps)(App);
cmcmone/TStore
src/main/java/edu/wcsu/thestore/controller/CheckoutController.java
package edu.wcsu.thestore.controller; import edu.wcsu.thestore.domain.*; import edu.wcsu.thestore.service.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpSession; import java.lang.reflect.Array; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Optional; /** * @author <NAME> * @version 1.0 */ @Controller public class CheckoutController { @Autowired private OrderService orderService; @Autowired private OrderLineService orderLineService; @Autowired private CartService cartService; @Autowired private AddressService addressService; @Autowired private LoginService loginService; @RequestMapping("/checkout") public String checkout(HttpSession session, Model model) { List myShoppingCart = cartService.findShoppingCartByUserID((Long) session.getAttribute("userID")); model.addAttribute("myCart", myShoppingCart); double total = 0; for (Object cart : myShoppingCart) { ShoppingCart obj = (ShoppingCart) cart; total += (obj.getCost() * obj.getQuantity()); } model.addAttribute("total", total); Address myAddress = addressService.getUserAddress((Long) session.getAttribute("userID")); model.addAttribute("Address", myAddress); return "checkout"; } @RequestMapping("/payment") public String payment(@RequestParam("username") String username, @RequestParam("street") String street, @RequestParam("city") String city, @RequestParam("state") String state, @RequestParam("phone") String phone, HttpSession session) { Address myAddress = addressService.getUserAddress((Long) session.getAttribute("userID")); if (myAddress == null) { myAddress = new Address(); } Optional<User> user = loginService.findUserById((Long) session.getAttribute("userID")); if (user.isPresent()) { myAddress.setUser(user.get()); } myAddress.setName(username); myAddress.setStreet(street); myAddress.setCity(city); myAddress.setState(state); myAddress.setPhone(phone); addressService.save(myAddress); Order order = new Order(); Date now = new Date(); order.setDateOrdered(new SimpleDateFormat ("MM/dd/yyyy").format(now)); order.setStatus("Success"); List myShoppingCart = cartService.findShoppingCartByUserID((Long) session.getAttribute("userID")); double totalCost = 0; int totalItems = 0; for (Object cart : myShoppingCart) { ShoppingCart obj = (ShoppingCart) cart; totalCost += (obj.getCost() * obj.getQuantity()); totalItems += obj.getQuantity(); } order.setTotalCost(totalCost); order.setTotalItems(totalItems); order.setUserID((Long) session.getAttribute("userID")); Order saved = orderService.save(order); for (Object cart : myShoppingCart) { ShoppingCart obj = (ShoppingCart) cart; OrderLine orderLine = new OrderLine(); orderLine.setOrderID(saved.getOrderID()); orderLine.setCost(obj.getCost()); orderLine.setProduct(obj.getProduct()); //setProductID(obj.getProduct().getProductID()); orderLine.setQuantity(obj.getQuantity()); orderLineService.saveOrderLine(orderLine); cartService.delShoppingCartByID(obj.getShoppingCartID()); } return "redirect:/myaccount"; } }
kako0507/themeparks
lib/disney/waltdisneyworldhollywoodstudios.js
<reponame>kako0507/themeparks // import the base Disney park class import DisneyBase from './index'; // our simple geolocation object library import GeoLocation from '../geoLocation'; /** * Walt Disney World Hollywood Studios * @class * @extends WaltDisneyWorldPark */ class WaltDisneyWorldHollywoodStudios extends DisneyBase { static parkName = 'Hollywood Studios - Walt Disney World Florida'; static timezone = 'America/New_York'; static location = new GeoLocation({ latitude: 28.3575, longitude: -81.5582, }); /** * The identifier for the park * @name WaltDisneyWorldHollywoodStudios.parkId * @type {String} */ static parkId = '80007998'; /** * The resort ID for the park * @name WaltDisneyWorldHollywoodStudios.resortId * @type {String} */ static resortId = '80007798'; /** * The region for the park * @name WaltDisneyWorldHollywoodStudios.parkRegion * @type {String} */ static parkRegion = 'us'; // WDW doesn't support using the facilities API, so turn this off static supportFacilitiesApi = false; } export default WaltDisneyWorldHollywoodStudios;
alexhope61/bootstrap
atom/packages/atom-ide-ui/modules/nuclide-commons-ui/index.js
"use strict"; function _nuclideUri() { const data = _interopRequireDefault(require("../nuclide-commons/nuclideUri")); _nuclideUri = function () { return data; }; return data; } function _UniversalDisposable() { const data = _interopRequireDefault(require("../nuclide-commons/UniversalDisposable")); _UniversalDisposable = function () { return data; }; return data; } function _dedent() { const data = _interopRequireDefault(require("dedent")); _dedent = function () { return data; }; return data; } var _fs = _interopRequireDefault(require("fs")); function _nullthrows() { const data = _interopRequireDefault(require("nullthrows")); _nullthrows = function () { return data; }; return data; } var _path = _interopRequireDefault(require("path")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * * @format */ // Requiring this module will load all stylesheets in styles/. // The exported value can be disposed to remove the stylesheets. // eslint-disable-next-line nuclide-internal/prefer-nuclide-uri const ttfUri = _nuclideUri().default.nuclideUriToUri(_path.default.join(__dirname, 'styles', 'nuclicons.ttf')); const newStyle = document.createElement('style'); newStyle.appendChild(document.createTextNode(_dedent().default` @font-face { font-family: 'nuclicons'; src: url('${ttfUri}') format('truetype'); font-weight: normal; font-style: normal; } `)); (0, _nullthrows().default)(document.head).appendChild(newStyle); const styleDir = _path.default.join(__dirname, 'styles'); const styleDisposables = new (_UniversalDisposable().default)(..._fs.default.readdirSync(styleDir).filter(file => ['.less', '.css'].includes(_path.default.extname(file))).map(file => atom.themes.requireStylesheet(_path.default.join(styleDir, file))), () => newStyle.remove()); module.exports = styleDisposables; // eslint-disable-line nuclide-internal/no-commonjs
kbu34/SENG302
server/src/test/java/com/springvuegradle/model/ActivityTest.java
package com.springvuegradle.model; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.Calendar; import java.util.GregorianCalendar; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; public class ActivityTest { private Profile profile; private Activity activity; private final String[] passportCountries = {"USA", "UK"}; private final String[] extraEmails = {"<EMAIL>", "<EMAIL>"}; private final String[] activityTypes = {"Walking", "Running", "Jogging"}; @BeforeEach void setUp() { Calendar calendar1 = new GregorianCalendar(2000, 11, 5); this.profile = new Profile(1L, "Steve", "Tester", "The", "Stevetest", "<EMAIL>", extraEmails, "987654321", "Here to run some tests!", calendar1, "Male", 2, passportCountries, activityTypes); this.activity = new Activity("City to Surf", "15km walk/jog/run.", activityTypes, true, "2020-02-20T08:00:00+1300","2020-02-20T08:00:00+1300", "Christchurch", 100.0, 100.0); } /** * Testing the retrieveCreator method. */ @Test void testRetrieveCreatorReturnsNullWhereNoCreatorExists(){ assertNull(activity.retrieveCreator()); } @Test void testRetrieveCreatorReturnsCreatorWhereCreatorExists(){ activity.addMember(new ActivityMembership(activity, profile, ActivityMembership.Role.CREATOR)); assertEquals(profile, activity.retrieveCreator()); } /** * Testing the getCreator method. */ @Test void testGetCreatorReturnsNullWhereNoCreatorExists(){ assertNull(activity.getCreator()); } @Test void testGetCreatorReturnsCreatorFullNameWhereCreatorExists(){ activity.addMember(new ActivityMembership(activity, profile, ActivityMembership.Role.CREATOR)); assertEquals(profile.getFullName(), activity.getCreator()); } }
moneytree/by_star
spec/by_star/by_month_spec.rb
require 'spec_helper' describe "by_month" do def find_posts(time=Time.zone.now, options={}) Post.by_month(time, options) end def posts_count(time=Time.zone.now, options={}) find_posts(time, options).count end it "should be able to find posts for the current month" do posts_count.should eql(6) end it "should be able to find a single post for January" do # If it is January we'll have all the "current" posts in there. # This makes the count 10. # I'm sure you can guess what happens when it's not January. posts_count("January").should eql(6) end it "should be able to find two posts for the 2nd month" do # If it is February we'll have all the "current" posts in there. # This makes the count 10. # I'm sure you can guess what happens when it's not February. posts_count(2).should eql(1) end it "should be able to find three posts for the 3rd month, using time instance" do # If it is March we'll have all the "current" posts in there. # This makes the count 10. # I'm sure you can guess what happens when it's not March. time = Time.local(Time.zone.now.year, 3, 1) posts_count(time).should eql(1) end it "should be able to find a single post from January last year" do posts_count("January", :year => Time.zone.now.year - 1).should eql(1) end it "should fail when given incorrect months" do lambda { find_posts(0) }.should raise_error(ByStar::ParseError) lambda { find_posts(13) }.should raise_error(ByStar::ParseError) lambda { find_posts("Ryan") }.should raise_error(ByStar::ParseError) # LOL arrays lambda { find_posts([1,2,3]) }.should raise_error(NoMethodError) end it "should be able to use an alternative field" do Timecop.freeze(Time.zone.local(Time.zone.now.year, 12, 1, 0, 0, 0)) do Event.by_month(:field => "start_time").size.should eql(1) end end it "should be able to specify the year as a string" do posts_count(1, :year => (Time.zone.now.year - 1).to_s).should eql(1) end end
CarlitoBG/JavaScript-Advanced
11.UnitTesting-Exercise/test/lookup-char-tests.js
<filename>11.UnitTesting-Exercise/test/lookup-char-tests.js<gh_stars>0 let lookupChar = require("../03.CharLookup").lookupChar let expect = require("chai").expect describe("lookupChar", function() { it("with a non-string first parameter, should return correct message", function() { expect(lookupChar(13, 0)).to.equal("Incorrect Type!", "The function did not return the correct message!") }) it("with a non-number second parameter, should return correct message", function() { expect(lookupChar("pesho", "gosho")).to.equal("Incorrect Type!", "The function did not return the correct message!") }) it("with a floating point second parameter, should return correct message", function() { expect(lookupChar("pesho", 3.12)).to.equal("Incorrect Type!", "The function did not return the correct message!") }) it("with an index value equal to string length, should return correct message", function() { expect(lookupChar("pesho", 5)).to.equal("Incorrect Parameters!", "The function did not return the correct message!") }) it("with an incorrect index value, should return correct message", function() { expect(lookupChar("gosho", 13)).to.equal("Incorrect Parameters!", "The function did not return the correct message!") }) it("with a negative index value, should return correct message", function() { expect(lookupChar("stamat", -1)).to.equal("Incorrect Parameters!", "The function did not return the correct message!") }) it("with correct parameter, should return correct message", function() { expect(lookupChar("pesho", 0)).to.equal("p", "The function did not return the correct message!") }) it("with correct parameter, should return correct message", function() { expect(lookupChar("stamat", 3)).to.equal("m", "The function did not return the correct message!") }) })
rexlin600/springboot2-example
spring-boot-java8/src/test/java/xyz/rexlin600/java8/functional/interfaces/ConsumersTest.java
<filename>spring-boot-java8/src/test/java/xyz/rexlin600/java8/functional/interfaces/ConsumersTest.java package xyz.rexlin600.java8.functional.interfaces; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.function.Consumer; @RunWith(SpringRunner.class) @SpringBootTest public class ConsumersTest { private Consumers consumers; @Before public void setUp() throws Exception { consumers = new Consumers(); } @Test public void consumers() { Consumer<String> consume = consumers.getConsume(); consume.accept("A"); consume.accept("B"); // C 不会被输出,因为 adnThen 后面跟的是一个 Consumer,这个 Consumer 还没有 accpet 任何参数,所以虽然里面有打印语句,但是并不会被触发! consume.andThen(s -> { System.out.println("C"); }); Consumer<String> stringConsumer = new Consumer<String>() { @Override public void accept(String s) { System.out.println(s); } }; stringConsumer.accept("D"); consume.andThen(stringConsumer); } }
Guestfolio/barometer
lib/barometer/utils/time.rb
module Barometer module Utils module Time def self.parse(*args) return unless args.compact.size > 0 first_arg = args.first if first_arg.is_a? ::Time first_arg elsif first_arg.is_a?(::DateTime) || first_arg.is_a?(::Date) ::Time.parse(first_arg.to_s) elsif args.size == 1 || args.size == 2 strptime(*args) else ::Time.utc(*args) end end def self.strftime(time) time.strftime("%Y-%m-%d %H:%M:%S %z") end def self.strptime(str, format=nil) dt = if format ::DateTime.strptime(str, format) else ::DateTime.parse(str) end ::Time.utc(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec) - (dt.zone.to_f * 60 * 60) end def self.utc_from_base_plus_local_time(tz, base, hour, min) return unless tz && base local_base = tz.utc_to_local(base.utc) local_time = ::Time.utc(local_base.year, local_base.month, local_base.day, hour, min, 0) tz.local_to_utc(local_time) end def self.utc_merge_base_plus_time(base_time=nil, time=nil) return unless base_time && time base_time_utc = base_time.utc time_utc = time.utc ::Time.utc( base_time_utc.year, base_time_utc.month, base_time_utc.day, time_utc.hour, time_utc.min, 0 ) end def self.add_one_day(time) return unless time one_day_minus_one_second = (60 * 60 * 24 - 1) time + one_day_minus_one_second end def self.add_one_hour(time) return unless time one_hour = (60 * 60 * 1) time + one_hour end def self.start_of_day(time) ::Time.utc( time.year, time.month, time.day, 0, 0, 0 ) end def self.end_of_day(time) ::Time.utc( time.year, time.month, time.day, 23, 59, 59 ) end end end end
ChoiJunsik/Sumalyze
audio/forms.py
from django import forms from .models import AudioPost class AudioPostForm(forms.ModelForm): class Meta: model = AudioPost fields = ('pdf', 'category','lang', 'title')
cquoss/jboss-4.2.3.GA-jdk8
aspects/src/jdk15/org/jboss/aspects/asynch/FutureImplJavaUtilConcurrent.java
/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.aspects.asynch; import org.jboss.aop.Dispatcher; import org.jboss.util.id.GUID; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; /** * Comment * * @author <a href="mailto:<EMAIL>"><NAME></a> * @version $Revision: 57186 $ */ public class FutureImplJavaUtilConcurrent implements RemotableFuture { private java.util.concurrent.Future result; private GUID remoteObjectID; public FutureImplJavaUtilConcurrent(java.util.concurrent.Future result) { this.result = result; } public void setRemoteObjectID(GUID remoteObjectID) { this.remoteObjectID = remoteObjectID; } public void release() { if (remoteObjectID != null) { Dispatcher.singleton.unregisterTarget(remoteObjectID); } } public Object get() throws InterruptedException, InvocationTargetException { try { Object rtn = result.get(); release(); return rtn; } catch (ExecutionException e) { release(); throw new InvocationTargetException(e.getCause()); } } public Object get(long milliseconds) throws org.jboss.aspects.asynch.TimeoutException, InterruptedException, InvocationTargetException { try { Object rtn = result.get(milliseconds, TimeUnit.MILLISECONDS); release(); return rtn; } catch (ExecutionException e) { release(); throw new InvocationTargetException(e.getCause()); } catch (java.util.concurrent.TimeoutException e) { throw new org.jboss.aspects.asynch.TimeoutException(e); } } public boolean isDone() { return result.isDone(); } }
exxdzj/erp
erp-user/src/main/java/com/exx/dzj/entity/dictionary/DictionaryBean.java
package com.exx.dzj.entity.dictionary; import lombok.Data; /** * @Author * @Date 2019/4/16 0016 16:16 * @Description 字典数据类型 */ @Data public class DictionaryBean extends DictionaryInfo { private String describe; }
vmanley/kas-fleet-manager
internal/kafka/internal/cmd/observatorium/query_range.go
package observatorium import ( "context" "encoding/json" "github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/internal/kafka/internal/api/public" "github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/internal/kafka/internal/presenters" "github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/internal/kafka/internal/services" "github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pkg/auth" "github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pkg/client/observatorium" "github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pkg/environments" "github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pkg/flags" "github.com/golang-jwt/jwt/v4" "github.com/golang/glog" "github.com/spf13/cobra" ) func NewRunMetricsQueryRangeCommand(env *environments.Env) *cobra.Command { cmd := &cobra.Command{ Use: "query_range", Short: "Get metrics with timeseries query range by kafka id from Observatorium", Run: func(cmd *cobra.Command, args []string) { runGetMetricsByRangeQuery(env, cmd, args) }, } cmd.Flags().String(FlagID, "", "Kafka id") cmd.Flags().String(FlagOwner, "", "Username") return cmd } func runGetMetricsByRangeQuery(env *environments.Env, cmd *cobra.Command, _args []string) { id := flags.MustGetDefinedString(FlagID, cmd.Flags()) owner := flags.MustGetDefinedString(FlagOwner, cmd.Flags()) var observatoriumService services.ObservatoriumService env.MustResolveAll(&observatoriumService) kafkaMetrics := &observatorium.KafkaMetrics{} // create jwt with claims and set it in the context jwt := jwt.NewWithClaims(jwt.SigningMethodRS256, jwt.MapClaims{ "username": owner, }) ctx := auth.SetTokenInContext(context.TODO(), jwt) params := observatorium.MetricsReqParams{} params.ResultType = observatorium.RangeQuery params.FillDefaults() kafkaId, err := observatoriumService.GetMetricsByKafkaId(ctx, kafkaMetrics, id, params) if err != nil { glog.Error("An error occurred while attempting to get metrics data ", err.Error()) return } metricsList := public.MetricsRangeQueryList{ Kind: "MetricsRangeQueryList", Id: kafkaId, } metrics, err := presenters.PresentMetricsByRangeQuery(kafkaMetrics) if err != nil { glog.Error("An error occurred while attempting to present metrics data ", err.Error()) return } metricsList.Items = metrics output, marshalErr := json.MarshalIndent(metricsList, "", " ") if marshalErr != nil { glog.Fatalf("Failed to format metrics list: %s", err.Error()) } glog.V(10).Infof("%s %s", kafkaId, output) }
utr001/dhis2-android-capture-app
app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/DataSetTableRepositoryImpl.java
<reponame>utr001/dhis2-android-capture-app<gh_stars>0 package org.dhis2.usescases.datasets.dataSetTable; import com.squareup.sqlbrite2.BriteDatabase; import org.dhis2.utils.DateUtils; import org.hisp.dhis.android.core.category.CategoryOptionComboModel; import org.hisp.dhis.android.core.dataelement.DataElementModel; import org.hisp.dhis.android.core.dataset.DataSetModel; import org.hisp.dhis.android.core.datavalue.DataValueModel; import org.hisp.dhis.android.core.period.PeriodModel; import org.hisp.dhis.android.core.period.PeriodType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import io.reactivex.BackpressureStrategy; import io.reactivex.Flowable; import io.reactivex.Observable; public class DataSetTableRepositoryImpl implements DataSetTableRepository { private final String DATA_ELEMENTS = "SELECT " + "DataElement.*," + "DataSetSection.sectionName," + "DataSetSection.sectionOrder " + "FROM DataElement " + "LEFT JOIN (" + " SELECT " + " Section.sortOrder AS sectionOrder," + " Section.displayName AS sectionName," + " Section.uid AS sectionId," + " SectionDataElementLink.dataElement AS sectionDataElement " + " FROM Section " + " JOIN SectionDataElementLink ON SectionDataElementLink.section = Section.uid " + ") AS DataSetSection ON DataSetSection.sectionDataElement = DataElement.uid " + "JOIN DataSetDataElementLink ON DataSetDataElementLink.dataElement = DataElement.uid " + "WHERE DataSetDataElementLink.dataSet = ? " + "ORDER BY DataSetSection.sectionOrder"; private final String PERIOD_CODE = "SELECT Period.* FROM Period WHERE Period.periodType = ? AND Period.startDate = ? LIMIT 1"; private final String DATA_VALUES = "SELECT * FROM DataValue " + "WHERE DataValue.organisationUnit = ? " + "AND DataValue.categoryOptionCombo = ? " + "AND DataValue.period = ?"; private final String DATA_SET = "SELECT DataSet.* FROM DataSet WHERE DataSet.uid = ?"; private final BriteDatabase briteDatabase; private final String dataSetUid; public DataSetTableRepositoryImpl(BriteDatabase briteDatabase, String dataSetUid) { this.briteDatabase = briteDatabase; this.dataSetUid = dataSetUid; } @Override public Flowable<DataSetModel> getDataSet() { return briteDatabase.createQuery(DataSetModel.TABLE, DATA_SET, dataSetUid) .mapToOne(cursor -> DataSetModel.builder() .uid(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.UID))) .code(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.CODE))) .name(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.NAME))) .displayName(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.DISPLAY_NAME))) .created(DateUtils.databaseDateFormat().parse(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.CREATED)))) .lastUpdated(DateUtils.databaseDateFormat().parse(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.LAST_UPDATED)))) .shortName(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.SHORT_NAME))) .displayShortName(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.DISPLAY_SHORT_NAME))) .description(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.DESCRIPTION))) .displayDescription(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.DISPLAY_DESCRIPTION))) .periodType(PeriodType.valueOf(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.PERIOD_TYPE)))) .categoryCombo(cursor.getString(cursor.getColumnIndex(DataSetModel.Columns.CATEGORY_COMBO))) .mobile(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.MOBILE)) == 1) .version(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.VERSION))) .expiryDays(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.EXPIRY_DAYS))) .timelyDays(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.TIMELY_DAYS))) .notifyCompletingUser(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.NOTIFY_COMPLETING_USER)) == 1) .openFuturePeriods(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.OPEN_FUTURE_PERIODS))) .fieldCombinationRequired(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.FIELD_COMBINATION_REQUIRED)) == 1) .validCompleteOnly(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.VALID_COMPLETE_ONLY)) == 1) .noValueRequiresComment(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.NO_VALUE_REQUIRES_COMMENT)) == 1) .skipOffline(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.SKIP_OFFLINE)) == 1) .dataElementDecoration(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.DATA_ELEMENT_DECORATION)) == 1) .renderAsTabs(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.RENDER_AS_TABS)) == 1) .renderHorizontally(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.RENDER_HORIZONTALLY)) == 1) .accessDataWrite(cursor.getInt(cursor.getColumnIndex(DataSetModel.Columns.ACCESS_DATA_WRITE)) == 1) .build()).toFlowable(BackpressureStrategy.LATEST); } @Override public Flowable<Map<String, List<DataElementModel>>> getDataElements() { Map<String, List<DataElementModel>> map = new HashMap<>(); return briteDatabase.createQuery(DataElementModel.TABLE, DATA_ELEMENTS, dataSetUid) .mapToList(cursor -> { DataElementModel dataElementModel = DataElementModel.create(cursor); String section = cursor.getString(cursor.getColumnIndex("sectionName")); if (section == null) section = "NO_SECTION"; if (map.get(section) == null) { map.put(section, new ArrayList<>()); } map.get(section).add(dataElementModel); return dataElementModel; }) .flatMap(dataElementModels -> Observable.just(map)).toFlowable(BackpressureStrategy.LATEST); } @Override public Flowable<Map<String, List<CategoryOptionComboModel>>> getCatOptions() { String query = "SELECT CategoryOptionCombo.* FROM CategoryOptionCombo " + "JOIN DataElement ON DataElement.categoryCombo = CategoryOptionCombo.categoryCombo " + "JOIN DataSetDataElementLink ON DataSetDataElementLink.dataElement = DataElement.uid " + "WHERE DataSetDataElementLink.dataSet = ? " + "GROUP BY CategoryOptionCombo.uid"; Map<String, List<CategoryOptionComboModel>> map = new HashMap<>(); return briteDatabase.createQuery(CategoryOptionComboModel.TABLE, query, dataSetUid) .mapToList(cursor -> { CategoryOptionComboModel catOptionCombo = CategoryOptionComboModel.create(cursor); if (map.get(catOptionCombo.categoryCombo()) == null) { map.put(catOptionCombo.categoryCombo(), new ArrayList<>()); } map.get(catOptionCombo.categoryCombo()).add(catOptionCombo); return catOptionCombo; }).flatMap(categoryOptionComboModels -> Observable.just(map)).toFlowable(BackpressureStrategy.LATEST); } @Override public Flowable<List<DataValueModel>> getDataValues(String orgUnitUid, String periodType, String initPeriodType, String catOptionComb) { return briteDatabase.createQuery(PeriodModel.TABLE, PERIOD_CODE, periodType, initPeriodType) .mapToOne(PeriodModel::create) .flatMap(periodModel -> briteDatabase.createQuery(DataValueModel.TABLE, DATA_VALUES, periodModel.periodId()) .mapToList(cursor -> { return DataValueModel.builder() .build(); })).toFlowable(BackpressureStrategy.LATEST); } }
lingranzhishen/passport
src/main/java/com/luglobal/contest/gson/PaginationGson.java
package com.luglobal.contest.gson; import java.util.List; /** * Created by lizehua035 on 2018/6/15. */ public class PaginationGson<T> { private long totalCount; private long totalPage; private long currentPage; private long pageSize=200; private long nextPage; private List<T> data; public PaginationGson(long totalCount,long currentPage){ this.totalCount=totalCount; if(totalCount>0) { this.totalPage = totalCount / pageSize + 1; if(totalCount%pageSize==0){ this.totalPage--; } } this.currentPage=currentPage; } public PaginationGson(long totalCount,long currentPage,long pageSize){ this.pageSize=pageSize>0?pageSize:20; this.totalCount=totalCount; if(totalCount>0) { this.totalPage = totalCount / pageSize + 1; if(totalCount%pageSize==0){ this.totalPage--; } } this.currentPage=currentPage; } public long getTotalCount() { return totalCount; } public void setTotalCount(long totalCount) { this.totalCount = totalCount; } public long getTotalPage() { return totalPage; } public void setTotalPage(long totalPage) { this.totalPage = totalPage; } public long getCurrentPage() { return currentPage; } public void setCurrentPage(long currentPage) { this.currentPage = currentPage; } public long getNextPage() { return nextPage; } public void setNextPage(long nextPage) { this.nextPage = nextPage; } public List<T> getData() { return data; } public void setData(List<T> data) { this.data = data; } public long getOffset(){ return (currentPage-1)*pageSize; } public long getLimit(){ return (currentPage)*pageSize+1; } }
joansmith3/cloudify
security/src/main/java/org/cloudifysource/security/BooleanDelegatingFilterProxy.java
<filename>security/src/main/java/org/cloudifysource/security/BooleanDelegatingFilterProxy.java<gh_stars>100-1000 /******************************************************************************* * Copyright (c) 2012 GigaSpaces Technologies Ltd. All rights reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ package org.cloudifysource.security; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.springframework.web.filter.DelegatingFilterProxy; /** * A filter delegating requests when the Spring security profile is "secure". * @author noak * @since 2.3.0 * */ public class BooleanDelegatingFilterProxy extends DelegatingFilterProxy { @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain) throws ServletException, IOException { final String springSecurityProfile = System.getenv(SecurityConstants.SPRING_ACTIVE_PROFILE_ENV_VAR); if (SecurityConstants.SPRING_PROFILE_SECURE.contains(springSecurityProfile)) { // Call the delegate super.doFilter(request, response, filterChain); } else { // Ignore the DelegatingProxyFilter delegate filterChain.doFilter(request, response); } } }
scm-manager/scm-issuetracker-plugin
src/main/java/sonia/scm/issuetracker/internal/ChangesetMapper.java
<reponame>scm-manager/scm-issuetracker-plugin /* * MIT License * * Copyright (c) 2020-present Cloudogu GmbH and Contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package sonia.scm.issuetracker.internal; import com.google.common.base.Strings; import sonia.scm.config.ScmConfiguration; import sonia.scm.issuetracker.api.Content; import sonia.scm.issuetracker.api.IssueReferencingObject; import sonia.scm.repository.Changeset; import sonia.scm.repository.Repository; import sonia.scm.util.HttpUtil; import javax.inject.Inject; import java.time.Instant; import java.util.Collections; import java.util.List; public class ChangesetMapper { static final String TYPE = "changeset"; private final ScmConfiguration configuration; @Inject public ChangesetMapper(ScmConfiguration configuration) { this.configuration = configuration; } public IssueReferencingObject ref(Repository repository, Changeset changeset) { return new IssueReferencingObject( repository, TYPE, changeset.getId(), changeset.getAuthor(), Instant.ofEpochMilli(changeset.getDate()), content(changeset), link(repository, changeset), true, changeset ); } @SuppressWarnings("java:S1192") // constant does not mean the same private String link(Repository repository, Changeset changeset) { return HttpUtil.concatenate( configuration.getBaseUrl(), "repo", repository.getNamespace(), repository.getName(), "code", "changeset", changeset.getId() ); } private List<Content> content(Changeset changeset) { if (Strings.isNullOrEmpty(changeset.getDescription())) { return Collections.emptyList(); } return Collections.singletonList( new Content("description", changeset.getDescription()) ); } }
gdbots/pbj-js
tests/utils/isValidEmail.test.js
import test from 'tape'; import isValidEmail from '../../src/utils/isValidEmail.js'; test('isValidEmail tests', (assert) => { const valid = [ '<EMAIL>', '<EMAIL>', '<EMAIL>', '<EMAIL>', '"email"@<EMAIL>', 'email@[172.16.17.3223]', 'user@[2001:DB8::1]', '<EMAIL>', '_______<EMAIL>', '<EMAIL>', ]; valid.forEach(email => assert.equal(isValidEmail(email), true, `email [${email}] should be valid.`)); const invalid = [ null, ' ', '\t', '#@%^%#$@#$@#.com', 'foo@bar', 'fo@o@bar', ' <EMAIL>', '@domain.com', '<NAME> <<EMAIL>>', '<EMAIL>', 'email@172.16.31.10', '<EMAIL>', 'email@[123.123.123.300]', 'email@[172.16.31.10', 'user@[192:168:1:1]', 'user@[2001:DB8:1]', 'email@domain..com', 'foo.bar.baz', ]; invalid.forEach(email => assert.equal(isValidEmail(email), false, `email [${email}] should NOT be valid.`)); assert.end(); });
LIBTechSolutions/orange-fleet
src/reducers/dataElements.js
'use strict' import { INSERT_DATA_ELEMENT, UPDATE_DATA_ELEMENT, DELETE_DATA_ELEMENT } from '../constants/ActionTypes' const initialState = [] export default function dataElements (state = initialState, action) { switch (action.type) { case INSERT_DATA_ELEMENT: return [ action.item, ...state ] case UPDATE_DATA_ELEMENT: return state.map(item => item._id === action.item.id ? action.item : item ) case DELETE_DATA_ELEMENT: return state.filter(item => item.code !== action.code) default: return state } }
crockmitnic/question-paper-generator
flaskapp/blueprints/questions/forms.py
from flask_wtf import FlaskForm from wtforms import BooleanField from wtforms import IntegerField from wtforms import SelectField from wtforms import StringField from wtforms import SubmitField from wtforms import TextAreaField from wtforms.validators import DataRequired from wtforms.validators import Length from wtforms.validators import NumberRange from flaskapp.utils import CognitiveEnum from flaskapp.utils import DifficultyEnum class QuestionForm(FlaskForm): question = TextAreaField("Question", validators=[DataRequired(), Length(min=2)]) mark = IntegerField( "Mark", validators=[ DataRequired(), NumberRange(1, 101, "Not in a valid mark range") ], ) difficulty = SelectField( "Difficulty Level", choices=[(member, member) for member in DifficultyEnum.__members__], ) cognitive_level = SelectField( "Cognitive Level", choices=[(member, member) for member in CognitiveEnum.__members__], ) imp = BooleanField("Mark As IMP") submit = SubmitField("submit") class MCQQuestionForm(QuestionForm): option1 = StringField("Option1", validators=[DataRequired()]) option2 = StringField("Option2", validators=[DataRequired()]) option3 = StringField("Option3", validators=[DataRequired()]) option4 = StringField("Option4", validators=[DataRequired()])
felichio/functionjs
test/chain.test.js
<filename>test/chain.test.js let r = require("../dist/radiance"); const result = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]; test("function: chain -> r.chain(r.range(1, 5))(x => r.range(1, 4)) === [1, 2, 3, 1, 2, 3, 1]", () => { return expect(r.chain(r.range(1, 5))(x => r.range(1, 4))).toEqual(result); }); test("function: chain -> r.chain([], x => [x]) === []", () => { return expect(r.chain([], x => [x])).toEqual([]); });
Jeanmilost/Visual-Mercutio
Visual Mercutio/zSplash/PSS_SplashController.h
/**************************************************************************** * ==> PSS_SplashController ------------------------------------------------* **************************************************************************** * Description : Splash screen controller, allows to run a splash screen * * inside a thread, and to show and hide it * * Developer : Processsoft * ****************************************************************************/ #ifndef PSS_SplashControllerH #define PSS_SplashControllerH #if _MSC_VER > 1000 #pragma once #endif // change the definition of AFX_EXT... to make it import #undef AFX_EXT_CLASS #undef AFX_EXT_API #undef AFX_EXT_DATA #define AFX_EXT_CLASS AFX_CLASS_IMPORT #define AFX_EXT_API AFX_API_IMPORT #define AFX_EXT_DATA AFX_DATA_IMPORT // processsoft #include "PSS_SplashWndThread.h" #ifdef _ZSPLASHEXPORT // put the values back to make AFX_EXT_CLASS export again #undef AFX_EXT_CLASS #undef AFX_EXT_API #undef AFX_EXT_DATA #define AFX_EXT_CLASS AFX_CLASS_EXPORT #define AFX_EXT_API AFX_API_EXPORT #define AFX_EXT_DATA AFX_DATA_EXPORT #endif /** * Splash screen controller *@author <NAME>, <NAME> */ class AFX_EXT_CLASS PSS_SplashController { public: PSS_SplashController(); virtual ~PSS_SplashController(); /** * Shows the splash screen *@param pFileName - splash screen image file name *@param maxTime - maximum time the splash screen can be shown in seconds *@param includeProgress - if true, progress bar will be shown *@param pParent - parent window owning the splash screen, can be NULL *@return true on success, otherwise false */ virtual bool Show(LPCTSTR pFileName, std::size_t maxTime = 20, bool includeProgress = true, CWnd* pParent = NULL); /** * Shows the splash screen *@param resID - splash screen image resource identifier to show *@param maxTime - maximum time the splash screen can be shown in seconds *@param includeProgress - if true, progress bar will be shown *@param pParent - parent window owning the splash screen, can be NULL *@return true on success, otherwise false */ virtual bool Show(UINT resID, std::size_t MaxTime = 20, bool IncludeProgress = true, CWnd* pParent = NULL); /** * Hides the splash screen *@return true on success, otherwise false */ virtual bool Hide(); /** * Sets progress position *@param value - progress value */ virtual void SetProgress(std::size_t value); /** * Sets text *@param value - text to show */ virtual void SetText(const CString& value); /** * Sets text *@param resID - text resource identifier to show */ virtual void SetText(UINT resID); /** * Assigns parent window *@param pParent - parent window owning the splash screen */ virtual void SetParent(CWnd* pParent); private: PSS_SplashWndThread* m_pThread; }; #endif
JaccoVeldscholten/e-inkOctoDisplay
lib/GxEPD/src/imglib/gridicons_reader_follow.h
<reponame>JaccoVeldscholten/e-inkOctoDisplay<filename>lib/GxEPD/src/imglib/gridicons_reader_follow.h<gh_stars>100-1000 #if defined(ESP8266) || defined(ESP32) #include <pgmspace.h> #else #include <avr/pgmspace.h> #endif // 24 x 24 gridicons_reader_follow const unsigned char gridicons_reader_follow[] PROGMEM = { /* 0X01,0X01,0XB4,0X00,0X40,0X00, */ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x03, 0xF0, 0x00, 0x03, 0xF3, 0xFF, 0xF3, 0xF3, 0xFF, 0xF3, 0xF0, 0x00, 0x03, 0xF0, 0x00, 0x03, 0xF0, 0x07, 0xF3, 0xF0, 0x00, 0x03, 0xF0, 0x07, 0xF3, 0xFF, 0x00, 0x03, 0xFF, 0x00, 0xF3, 0xF3, 0x00, 0x03, 0xF3, 0xE0, 0x03, 0xF3, 0xE0, 0x03, 0x80, 0x60, 0x03, 0x80, 0x60, 0x07, 0xF3, 0xFF, 0xFF, 0xF3, 0xFF, 0xFF, 0xF3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
sissxx/JavaScript
8. Associative Arrays/lab/storage.js
<reponame>sissxx/JavaScript<filename>8. Associative Arrays/lab/storage.js function storage(input) { let storageMap = new Map(); for (let string of input) { let tokens = string.split(' '); let product = tokens[0]; let quantity = Number(tokens[1]); if (!storageMap.has(product)) { storageMap.set(product, quantity); } else { let currentQuantity = storageMap.get(product); let newQuantity = currentQuantity += quantity; storageMap.set(product, newQuantity); } } for (let [key, value] of storageMap) { console.log(`${key} -> ${value}`); } } storage(['tomatoes 10', 'coffee 5', 'olives 100', 'coffee 40' ])
Marcos-Correia/incubator-samoa
samoa-api/src/main/java/org/apache/samoa/streams/fs/HDFSFileStreamSource.java
<reponame>Marcos-Correia/incubator-samoa<filename>samoa-api/src/main/java/org/apache/samoa/streams/fs/HDFSFileStreamSource.java /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.samoa.streams.fs; import java.io.IOException; import java.io.InputStream; import java.nio.file.FileSystems; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IOUtils; /** * Source for FileStream for HDFS files * * @author Casey */ public class HDFSFileStreamSource implements FileStreamSource { /** * */ private static final long serialVersionUID = -3887354805787167400L; private transient InputStream fileStream; private transient Configuration config; private List<String> filePaths; private int currentIndex; public HDFSFileStreamSource() { this.currentIndex = -1; } public void init(String path, String ext) { this.init(this.getDefaultConfig(), path, ext); } public void init(Configuration config, String path, String ext) { this.config = config; config.set("fs.hdfs.impl", org.apache.hadoop.hdfs.DistributedFileSystem.class.getName()); config.set("fs.file.impl", org.apache.hadoop.fs.LocalFileSystem.class.getName()); this.filePaths = new ArrayList<>(); Path hdfsPath = new Path(path); FileSystem fs; try { fs = FileSystem.get(config); FileStatus fileStat = fs.getFileStatus(hdfsPath); if (fileStat.isDirectory()) { Path filterPath = hdfsPath; if (ext != null) { filterPath = new Path(path, "*." + ext); } else { filterPath = new Path(path, "*"); } FileStatus[] filesInDir = fs.globStatus(filterPath); for (FileStatus aFilesInDir : filesInDir) { if (aFilesInDir.isFile()) { filePaths.add(aFilesInDir.getPath().toString()); } } } else { this.filePaths.add(path); } } catch (IOException ioe) { throw new RuntimeException("Failed getting list of files at:" + path, ioe); } this.currentIndex = -1; } private Configuration getDefaultConfig() { String hadoopHome = System.getenv("HADOOP_HOME"); Configuration conf = new Configuration(); if (hadoopHome != null) { java.nio.file.Path coreSitePath = FileSystems.getDefault().getPath(hadoopHome, "etc/hadoop/core-site.xml"); java.nio.file.Path hdfsSitePath = FileSystems.getDefault().getPath(hadoopHome, "etc/hadoop/hdfs-site.xml"); conf.addResource(new Path(coreSitePath.toAbsolutePath().toString())); conf.addResource(new Path(hdfsSitePath.toAbsolutePath().toString())); } return conf; } public void reset() throws IOException { this.currentIndex = -1; this.closeFileStream(); } private void closeFileStream() { IOUtils.closeStream(fileStream); } public InputStream getNextInputStream() { this.closeFileStream(); if (this.currentIndex >= (this.filePaths.size() - 1)) return null; this.currentIndex++; String filePath = this.filePaths.get(currentIndex); Path hdfsPath = new Path(filePath); FileSystem fs; try { fs = FileSystem.get(config); fileStream = fs.open(hdfsPath); } catch (IOException ioe) { this.closeFileStream(); throw new RuntimeException("Failed opening file:" + filePath, ioe); } return fileStream; } public InputStream getCurrentInputStream() { return fileStream; } protected int getFilePathListSize() { if (filePaths != null) return filePaths.size(); return 0; } protected String getFilePathAt(int index) { if (filePaths != null && filePaths.size() > index) return filePaths.get(index); return null; } }
mzhg/PostProcessingWork
testframewok/src/main/java/jet/opengl/demos/nvidia/waves/crest/collision/SampleHeightHelper.java
<gh_stars>10-100 package jet.opengl.demos.nvidia.waves.crest.collision; import org.lwjgl.util.vector.ReadableVector3f; import org.lwjgl.util.vector.Vector3f; import jet.opengl.demos.nvidia.waves.crest.OceanRenderer; import jet.opengl.demos.nvidia.waves.crest.SamplingData; import jet.opengl.postprocessing.util.Numeric; import jet.opengl.postprocessing.util.Rectf; /** * Helper to obtain the ocean surface height at a single location. This is not particularly efficient to sample a single height, * but is a fairly common case. */ public class SampleHeightHelper { SamplingData _samplingData = new SamplingData(); Vector3f[] _queryPos = new Vector3f[1]; Vector3f[] _queryResult = new Vector3f[1]; Vector3f[] _queryResultNormal = new Vector3f[1]; Vector3f[] _queryResultVel = new Vector3f[1]; boolean _valid = false; public SampleHeightHelper(){ _queryPos[0] = new Vector3f(); _queryResult[0] = new Vector3f(); _queryResultNormal[0] = new Vector3f(); _queryResultVel[0] = new Vector3f(); } /// <summary> /// Call this to prime the sampling /// </summary> /// <param name="i_queryPos">World space position to sample</param> /// <param name="i_minLength">The smallest length scale you are interested in. If you are sampling data for boat physics, /// pass in the boats width. Larger objects will ignore small wavelengths.</param> /// <returns></returns> public boolean Init(ReadableVector3f i_queryPos, float i_minLength) { _queryPos[0].set(i_queryPos); Rectf rect = new Rectf(i_queryPos.getX(), i_queryPos.getZ(), 0f, 0f); return _valid = OceanRenderer.Instance.CollisionProvider().GetSamplingData(rect, i_minLength, _samplingData); } /// <summary> /// Call this to do the query. Can be called only once after Init(). /// </summary> public long Sample(/*ref float o_height*/) { if (!_valid) { return 0; } int status = OceanRenderer.Instance.CollisionProvider().Query(hashCode(), _samplingData, _queryPos, _queryResult, null, null); OceanRenderer.Instance.CollisionProvider().ReturnSamplingData(_samplingData); if (!OceanRenderer.Instance.CollisionProvider().RetrieveSucceeded(status)) { _valid = false; return 0; } float o_height = _queryResult[0].y + OceanRenderer.Instance.SeaLevel(); return Numeric.encode(1, Float.floatToIntBits(o_height)); } public long Sample(/*ref float o_height,*/ Vector3f o_normal) { if (!_valid) { return 0; } int status = OceanRenderer.Instance.CollisionProvider().Query(hashCode(), _samplingData, _queryPos, _queryResult, _queryResultNormal, null); OceanRenderer.Instance.CollisionProvider().ReturnSamplingData(_samplingData); if (!OceanRenderer.Instance.CollisionProvider().RetrieveSucceeded(status)) { _valid = false; return 0; } float o_height = _queryResult[0].y + OceanRenderer.Instance.SeaLevel(); o_normal.set(_queryResultNormal[0]); // return true; return Numeric.encode(1, Float.floatToIntBits(o_height)); } public long Sample(/*ref float o_height, ref*/ Vector3f o_normal, Vector3f o_surfaceVel) { if (!_valid) { return 0; } int status = OceanRenderer.Instance.CollisionProvider().Query(hashCode(), _samplingData, _queryPos, _queryResult, _queryResultNormal, _queryResultVel); OceanRenderer.Instance.CollisionProvider().ReturnSamplingData(_samplingData); if (!OceanRenderer.Instance.CollisionProvider().RetrieveSucceeded(status)) { return 0; } float o_height = _queryResult[0].y + OceanRenderer.Instance.SeaLevel(); o_normal.set(_queryResultNormal[0]); o_surfaceVel.set(_queryResultVel[0]); return Numeric.encode(1, Float.floatToIntBits(o_height)); } public boolean Sample(Vector3f o_displacementToPoint, Vector3f o_normal, Vector3f o_surfaceVel) { if (!_valid) { return false; } int status = OceanRenderer.Instance.CollisionProvider().Query(hashCode(), _samplingData, _queryPos, _queryResult, _queryResultNormal, _queryResultVel); OceanRenderer.Instance.CollisionProvider().ReturnSamplingData(_samplingData); if (!OceanRenderer.Instance.CollisionProvider().RetrieveSucceeded(status)) { return false; } o_displacementToPoint.set(_queryResult[0]); o_normal.set(_queryResultNormal[0]); o_surfaceVel.set(_queryResultVel[0]); return true; } }
Project2CITM/Proyecto2
Source/ParticleAttackRevenant.h
<filename>Source/ParticleAttackRevenant.h #ifndef __PARTICLE_ATTACK_REVENANT_H__ #define __PARTICLE_ATTACK_REVENANT_H__ #include "Particle.h" #include "ModuleRender.h" class ParticleAttackRevenant : public Particle { public: ParticleAttackRevenant(iPoint position,int rot = 0, float life = 0, float delay = 0, bool hasPurifiedSword = false, SDL_RendererFlip flip = SDL_FLIP_NONE, iPoint velocity = { 0,0 }, std::string name = "Particle"); ~ParticleAttackRevenant(); }; #endif // !__PARTICLE_ATTACK_REVENANT_H__
htlcnn/ironpython-stubs
release/stubs.min/Autodesk/Revit/DB/__init___parts/PropertySetElement.py
class PropertySetElement(Element,IDisposable): """ An element that groups together a set of related parameters. """ @staticmethod def Create(document,*__args): """ Create(document: Document,structuralAsset: StructuralAsset) -> PropertySetElement Creates a new PropertySetElement to contain the given asset. document: The document in which to create the PropertySetElement. structuralAsset: The structural asset containing the values that will be present in the PropertySetElement. Returns: The new PropertySetElement. Create(document: Document,thermalAsset: ThermalAsset) -> PropertySetElement Creates a new PropertySetElement to contain the given asset. document: The document in which to create the PropertySetElement. thermalAsset: The thermal asset containing the values that will be present in the PropertySetElement. Returns: The new PropertySetElement. """ pass def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def Duplicate(self,document,name): """ Duplicate(self: PropertySetElement,document: Document,name: str) -> PropertySetElement Creates a duplicate of this PropertySetElement. document: The document in which to create the PropertySetElement. name: The name to use for the new PropertySetElement. Returns: The new PropertySetElement. """ pass def getBoundingBox(self,*args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def GetStructuralAsset(self): """ GetStructuralAsset(self: PropertySetElement) -> StructuralAsset Gets a copy of the StructuralAsset. """ pass def GetThermalAsset(self): """ GetThermalAsset(self: PropertySetElement) -> ThermalAsset Gets a copy of the ThermalAsset. """ pass def ReleaseUnmanagedResources(self,*args): """ ReleaseUnmanagedResources(self: Element,disposing: bool) """ pass def setElementType(self,*args): """ setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """ pass def SetStructuralAsset(self,structuralAsset): """ SetStructuralAsset(self: PropertySetElement,structuralAsset: StructuralAsset) Sets a copy of the given StucturalAsset to be used in the PropertySetElement. """ pass def SetThermalAsset(self,thermalAsset): """ SetThermalAsset(self: PropertySetElement,thermalAsset: ThermalAsset) Sets a copy of the given ThermalAsset to be used in the PropertySetElement. """ pass def __enter__(self,*args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self,*args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass
WenRou-Pan/pin
server/src/main/java/com/pinche/domain/request/PublishOrderRequest.java
package com.pinche.domain.request; import com.pinche.domain.address.GeoAddress; import com.pinche.domain.order.TimeDTO; import javax.validation.constraints.NotNull; /** * @author Parmaze * @date 2021/12/16 */ public class PublishOrderRequest extends BaseRequest { /** * 起点 */ @NotNull(message = "起点不能空") private GeoAddress startAddress; /** * 终点 */ @NotNull(message = "终点不能空") private GeoAddress endAddress; @NotNull(message = "时间不能空") private TimeDTO timeDTO; /** * 队伍人数 */ @NotNull(message = "目标人数") private Integer targetNum; public GeoAddress getStartAddress() { return startAddress; } public void setStartAddress(GeoAddress startAddress) { this.startAddress = startAddress; } public GeoAddress getEndAddress() { return endAddress; } public void setEndAddress(GeoAddress endAddress) { this.endAddress = endAddress; } public Integer getTargetNum() { return targetNum; } public void setTargetNum(Integer targetNum) { this.targetNum = targetNum; } public TimeDTO getTimeDTO() { return timeDTO; } public void setTimeDTO(TimeDTO timeDTO) { this.timeDTO = timeDTO; } }
addstone/unrealengine3
Development/External/wxWindows_2.4.0/include/wx/univ/theme.h
<filename>Development/External/wxWindows_2.4.0/include/wx/univ/theme.h /////////////////////////////////////////////////////////////////////////////// // Name: wx/univ/theme.h // Purpose: wxTheme class manages all configurable aspects of the // application including the look (wxRenderer), feel // (wxInputHandler) and the colours (wxColourScheme) // Author: <NAME> // Modified by: // Created: 06.08.00 // RCS-ID: $Id: theme.h,v 1.9 2002/03/24 00:22:51 VS Exp $ // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_UNIV_THEME_H_ #define _WX_UNIV_THEME_H_ #ifdef __GNUG__ #pragma interface "theme.h" #endif // ---------------------------------------------------------------------------- // wxTheme // ---------------------------------------------------------------------------- class WXDLLEXPORT wxRenderer; class WXDLLEXPORT wxColourScheme; class WXDLLEXPORT wxInputHandler; class WXDLLEXPORT wxArtProvider; struct WXDLLEXPORT wxThemeInfo; class WXDLLEXPORT wxTheme { public: // static methods // -------------- // create the default theme static bool CreateDefault(); // create the theme by name (will return NULL if not found) static wxTheme *Create(const wxString& name); // change the current scheme static wxTheme *Set(wxTheme *theme); // get the current theme (never NULL) static wxTheme *Get() { return ms_theme; } // the theme methods // ----------------- // get the renderer implementing all the control-drawing operations in // this theme virtual wxRenderer *GetRenderer() = 0; // get the art provider to be used together with this theme virtual wxArtProvider *GetArtProvider() = 0; // get the input handler of the given type virtual wxInputHandler *GetInputHandler(const wxString& handlerType) = 0; // get the colour scheme for the control with this name virtual wxColourScheme *GetColourScheme() = 0; // implementation only from now on // ------------------------------- virtual ~wxTheme(); private: // the list of descriptions of all known themes static wxThemeInfo *ms_allThemes; // the current theme static wxTheme *ms_theme; friend struct WXDLLEXPORT wxThemeInfo; }; // ---------------------------------------------------------------------------- // dynamic theme creation helpers // ---------------------------------------------------------------------------- struct WXDLLEXPORT wxThemeInfo { typedef wxTheme *(*Constructor)(); // theme name and (user readable) description wxString name, desc; // the function to create a theme object Constructor ctor; // next node in the linked list or NULL wxThemeInfo *next; // constructor for the struct itself wxThemeInfo(Constructor ctor, const wxChar *name, const wxChar *desc); }; // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- // to use a standard theme insert this macro into one of the application files: // without it, an over optimizing linker may discard the object module // containing the theme implementation entirely #define WX_USE_THEME(themename) \ WXDLLEXPORT_DATA(extern bool) wxThemeUse##themename; \ static struct wxThemeUserFor##themename \ { \ wxThemeUserFor##themename() { wxThemeUse##themename = TRUE; } \ } wxThemeDoUse##themename // to declare a new theme, this macro must be used in the class declaration #define WX_DECLARE_THEME(themename) \ private: \ static wxThemeInfo ms_info##themename; \ public: \ const wxThemeInfo *GetThemeInfo() const \ { return &ms_info##themename; } // and this one must be inserted in the source file #define WX_IMPLEMENT_THEME(classname, themename, themedesc) \ WXDLLEXPORT_DATA(bool) wxThemeUse##themename = TRUE; \ wxTheme *wxCtorFor##themename() { return new classname; } \ wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \ wxT( #themename ), themedesc) #endif // _WX_UNIV_THEME_H_
mexicowilly/Yella
agent/plugin/file/state_db_pool.h
#ifndef YELLA_STATE_DB_POOL_H__ #define YELLA_STATE_DB_POOL_H__ #include "plugin/file/state_db.h" typedef struct state_db_pool state_db_pool; YELLA_PRIV_EXPORT state_db_pool* create_state_db_pool(void); YELLA_PRIV_EXPORT void destroy_state_db_pool(state_db_pool* pool); YELLA_PRIV_EXPORT state_db* get_state_db_from_pool(state_db_pool* pool, const UChar* const config_name); YELLA_PRIV_EXPORT void remove_state_db_from_pool(state_db_pool* pool, const UChar* const config_name); YELLA_PRIV_EXPORT size_t state_db_pool_size(const state_db_pool* const pool); #endif