本文整理汇总了C++中dec函数的典型用法代码示例。如果您正苦于以下问题:C++ dec函数的具体用法?C++ dec怎么用?C++ dec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dec
bool MMSMessage::decode(QIODevice *dev)
{
bool ok = true;
QWspPduDecoder dec(dev);
// MMS headers not encoded using code page, but we can still use the
// mechanism.
MMSHeaderCodec *mmsCodec = new MMSHeaderCodec;
dec.setHeaderCodec(mmsCodec);
while (!dev->atEnd()) {
quint8 octet = dec.peekOctet();
if (octet >= 32) {
QWspField field = dec.decodeField();
fields.append(field);
} else {
if (type() == MSendReq || type() == MRetrieveConf) {
const QWspField *f = field("Content-Type");
if (f && (f->value.indexOf("application/vnd.wap.multipart.related") == 0
|| f->value.indexOf("application/vnd.wap.multipart.mixed") == 0)) {
dec.setHeaderCodec(0);
multiPartData = dec.decodeMultipart();
continue;
}
}
// ### handle other types
qWarning("Don't understand format: %d", octet);
ok = false;
break;
}
}
if (dec.status() != QWspPduDecoder::OK && dec.status() != QWspPduDecoder::Unhandled)
ok = false;
delete mmsCodec;
return ok;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:38,代码来源:mmsmessage.cpp
示例2: run_one_test
Test::Result run_one_test(const std::string& algo, const VarMap& vars) override
{
const std::vector<uint8_t> key = get_req_bin(vars, "Key");
const std::vector<uint8_t> nonce = get_opt_bin(vars, "Nonce");
const std::vector<uint8_t> input = get_req_bin(vars, "In");
const std::vector<uint8_t> expected = get_req_bin(vars, "Out");
Test::Result result(algo);
std::unique_ptr<Botan::Cipher_Mode> enc(Botan::get_cipher_mode(algo, Botan::ENCRYPTION));
std::unique_ptr<Botan::Cipher_Mode> dec(Botan::get_cipher_mode(algo, Botan::DECRYPTION));
if(!enc || !dec)
{
result.note_missing(algo);
return result;
}
result.test_eq("mode not authenticated", enc->authenticated(), false);
enc->set_key(key);
enc->start(nonce);
Botan::secure_vector<uint8_t> buf(input.begin(), input.end());
// TODO: should first update if possible
enc->finish(buf);
result.test_eq("encrypt", buf, expected);
buf.assign(expected.begin(), expected.end());
dec->set_key(key);
dec->start(nonce);
dec->finish(buf);
result.test_eq("decrypt", buf, input);
return result;
}
开发者ID:ChrisBFX,项目名称:botan,代码行数:38,代码来源:test_modes.cpp
示例3: main
int main(int argc, char ** argv)
{
// Initialize the global VCluster
openfpm_init(&argc,&argv);
// Vcluster
Vcluster & vcl = create_vcluster();
//! [Create CartDecomposition vtk gen]
CartDecomposition<2,float> dec(vcl);
// Physical domain
Box<2,float> box({0.0,0.0},{1.0,1.0});
// division on each direction
size_t div[2] = {20,20};
// Define ghost
Ghost<2,float> g(0.01);
// boundary conditions
size_t bc[2] = {PERIODIC,PERIODIC};
// Decompose and write the decomposed graph
dec.setParameters(div,box,bc,g);
dec.decompose();
// create a ghost border
dec.calculateGhostBoxes();
// Write the decomposition
dec.write("CartDecomposition/out_");
//! [Create CartDecomposition]
// deinitialize the library
openfpm_finalize();
}
开发者ID:incardon,项目名称:openfpm_pdata,代码行数:38,代码来源:CartDecomposition_gen_vtk.cpp
示例4: ut_class_test
void ut_class_test(void)
{
al::AudioIO io(64, 44100, 0, 0, 2, 2, al::AudioIO::DUMMY); // Dummy Audio Backend
al::Decorrelation dec(32, 1, 1, false);
dec.configure(io, 1000);
assert(dec.getCurrentSeed() == 1000);
assert(dec.getSize() == 32);
float *ir = dec.getIR(0);
double expected[] = {0.65027274, -0.16738815, 0.1617437 , 0.18901241, 0.01768662,
-0.0802799 , -0.12612745, 0.09564361, 0.00803435, 0.07643685,
-0.030273 , 0.26991193, -0.03412993, -0.05709789, 0.05474607,
-0.12850219, 0.03040506, -0.05887395, 0.05779415, 0.12589107,
0.0778308 , -0.19303948, 0.16970104, -0.34332016, -0.14030879,
0.02862106, 0.18978155, 0.02629568, -0.09265464, -0.04808504,
0.00549774, 0.26477413};
for (int i = 0; i < 32; i++) {
// std::cout << ir[i] << "..." << expected[i];
assert(fabs(ir[i] - expected[i]) < 0.000001);
}
std::cout << std::endl;
al::Decorrelation dec2(1024, 1, 32, false);
dec2.configure(io, 1001);
assert(dec2.getCurrentSeed() == 1001);
assert(dec2.getSize() == 1024);
al::Decorrelation dec3(10, 1, 8, false);
dec3.configure(io, 1001);
assert(dec3.getCurrentSeed() == 1001);
assert(dec3.getSize() == 0); // Size of 10 is too small
al::Decorrelation dec4(32, 1, 0);
dec4.configure(io, 1001);
assert(dec4.getSize() == 0); // Num Outs is 0
}
开发者ID:AlloSphere-Research-Group,项目名称:AlloSystem,代码行数:37,代码来源:decorrelationTests.cpp
示例5: image_data
template <typename PointInT, typename PointOutT> void
pcl::AgastKeypoint2D<PointInT, PointOutT>::detectKeypoints (PointCloudOut &output)
{
// image size
const size_t width = input_->width;
const size_t height = input_->height;
// destination for intensity data; will be forwarded to AGAST
std::vector<unsigned char> image_data (width*height);
for (size_t row_index = 0; row_index < height; ++row_index)
for (size_t col_index = 0; col_index < width; ++col_index)
image_data[row_index*width + col_index] = static_cast<unsigned char> (intensity_ ((*input_) (col_index, row_index)));
if (!detector_)
detector_.reset (new pcl::keypoints::agast::AgastDetector7_12s (width, height, threshold_, bmax_));
detector_->setMaxKeypoints (nr_max_keypoints_);
if (apply_non_max_suppression_)
{
pcl::PointCloud<pcl::PointUV> tmp_cloud;
detector_->detectKeypoints (image_data, tmp_cloud);
pcl::keypoints::internal::AgastApplyNonMaxSuppresion<PointOutT> anms (
image_data, tmp_cloud, detector_, output);
}
else
{
pcl::keypoints::internal::AgastDetector<PointOutT> dec (
image_data, detector_, output);
}
// we do not change the denseness
output.is_dense = true;
}
开发者ID:khooweiqian,项目名称:kfls2,代码行数:36,代码来源:agast_2d.hpp
示例6: inp
Poco::Path CExtract::to(Poco::Path & downloadedPackage, Poco::Path extractPath)
{
//verification of the extension
std::string extension = downloadedPackage.getExtension();
if ((!boost::iends_with(extension, "zip")) && (!boost::iends_with(extension, "tar.gz")))
throw exception::CNotSupported("Invalid extension package : " + downloadedPackage.toString() + ". Only zip or tar.gz supported. " + extension);
Poco::FileStream inp(downloadedPackage.toString(), std::ios::binary);
// decompress to current working dir
Poco::Zip::Decompress dec(inp, extractPath);
// if an error happens invoke the ZipTest::onDecompressError method
m_unzipError = false;
dec.EError += Poco::Delegate<CExtract, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &CExtract::onDecompressError);
dec.decompressAllFiles();
dec.EError -= Poco::Delegate<CExtract, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &CExtract::onDecompressError);
inp.close();
if (m_unzipError)
{
throw shared::exception::CExtract("Fail to uncompress package : " + m_unzipErrorMessage);
}
return extractPath;
}
开发者ID:Yadoms,项目名称:yadoms,代码行数:24,代码来源:Extract.cpp
示例7: main
int main (){
BYTE plainText[MAX_BLK_CNT*(BLOCK_SIZE/8)];
BYTE *tmp;
BYTE *ret_tmp;
int i = 0;
printf("*********************************************************************\n");
printf("*********************************************************************\n");
srand((unsigned) time(NULL));
key_and_cipher_init(&ki,&ci);
printf("byteCnt: %d\n",byteCnt);
printf("-----------------------------------------------------------------------------\n");
for (i=0;i<25;i++)
plainText[i]=(BYTE)((rand()%94)+32);
tmp=enc(plainText,25);
ret_tmp=dec(tmp,25);
free(tmp);
free(ret_tmp);
/*printf("\n\n");printf("-----------------------------------------------------------------------------\n");
int new_byteCnt=28;
for (i=0;i<new_byteCnt;i++)
plainText[i]=(BYTE)('a');
tmp=enc(plainText,new_byteCnt);
ret_tmp=dec(tmp);
free(tmp);
free(ret_tmp);
*/
return 1;
}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:36,代码来源:thig_ims_enc.c
示例8: seq
void DL_PrivateKey_EC<EC>::BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, unsigned int size)
{
BERSequenceDecoder seq(bt);
word32 version;
BERDecodeUnsigned<word32>(seq, version, INTEGER, 1, 1); // check version
BERGeneralDecoder dec(seq, OCTET_STRING);
if (!dec.IsDefiniteLength())
BERDecodeError();
Integer x;
x.Decode(dec, dec.RemainingLength());
dec.MessageEnd();
if (!parametersPresent && seq.PeekByte() != (CONTEXT_SPECIFIC | CONSTRUCTED | 0))
BERDecodeError();
if (!seq.EndReached() && seq.PeekByte() == (CONTEXT_SPECIFIC | CONSTRUCTED | 0))
{
BERGeneralDecoder parameters(seq, CONTEXT_SPECIFIC | CONSTRUCTED | 0);
AccessGroupParameters().BERDecode(parameters);
parameters.MessageEnd();
}
if (!seq.EndReached())
{
// skip over the public element
SecByteBlock subjectPublicKey;
unsigned int unusedBits;
BERGeneralDecoder publicKey(seq, CONTEXT_SPECIFIC | CONSTRUCTED | 1);
BERDecodeBitString(publicKey, subjectPublicKey, unusedBits);
publicKey.MessageEnd();
Element Q;
if (!(unusedBits == 0 && GetGroupParameters().GetCurve().DecodePoint(Q, subjectPublicKey, subjectPublicKey.size())))
BERDecodeError();
}
seq.MessageEnd();
SetPrivateExponent(x);
}
开发者ID:randombit,项目名称:hacrypto,代码行数:36,代码来源:eccrypto.cpp
示例9: dok
static int dok(int f,lua_State*L)
{
int c, n = lua_gettop(L);
/* k [int] "kcode" [x [y [z]]] */
if (n>0 && lua_type(L, 1) == LUA_TNUMBER) {
c = (int)lua_tonumber(L,1);
--n;
} else {
c = last_connection;
}
/* k "kcode" [x [y [z]]] */
if(!n) {luaL_argcheck(L, 0, 1, "expected 1 argument"); R -1;}
K x=0,y=0,z=0;
if(n>1) { enc(&x,L);lua_pop(L,1);--n; }
if(n>1) { y=x;enc(&x,L);lua_pop(L,1);--n; }
if(n>1) { z=y;y=x;enc(&x,L);lua_pop(L,1);--n; }
if(n>1) { luaL_argcheck(L,0,lua_gettop(L), "too many arguments (nyi?)"); r0(x);r0(y);r0(z); R -1; }
const char *code = lua_tostring(L,-1);
K r=k(c*f,code,x,y,z,(K)0);
if(f==-1){/*async*/ lua_pushnil(L); R 1; }
dec(L,r);r0(r); R 1;
}
开发者ID:geocar,项目名称:qlua,代码行数:24,代码来源:k.c
示例10: setLastError
bool CryptoDoc::encrypt()
{
if( isNull() )
{
setLastError( tr("Container is not open") );
return false;
}
if( isEncrypted() )
return true;
if( d->enc->nEncryptedKeys < 1 )
{
setLastError( tr("No keys specified") );
return false;
}
CryptoDocThread dec( true, d );
dec.waitForFinished();
if( dec.err != ERR_OK )
setLastError( dec.lastError.isEmpty() ? tr("Failed to encrypt data") : dec.lastError, dec.err );
else if( !dec.lastError.isEmpty() )
setLastError( dec.lastError );
d->documents->revert();
return isEncrypted();
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:24,代码来源:CryptoDoc.cpp
示例11: evalTo
template<typename Dest> void evalTo(Dest& dst) const
{
dec()._solve(rhs(),dst);
}
开发者ID:aeslaughter,项目名称:libmesh,代码行数:4,代码来源:matrixfree_cg.cpp
示例12: krb5int_aes_decrypt_iov
static krb5_error_code
krb5int_aes_decrypt_iov(const krb5_keyblock *key,
const krb5_data *ivec,
krb5_crypto_iov *data,
size_t num_data)
{
aes_ctx ctx;
char tmp[BLOCK_SIZE], tmp2[BLOCK_SIZE], tmp3[BLOCK_SIZE];
int nblocks = 0, blockno, i;
size_t input_length;
struct iov_block_state input_pos, output_pos;
CHECK_SIZES;
if (aes_dec_key(key->contents, key->length, &ctx) != aes_good)
abort();
if (ivec != NULL)
memcpy(tmp, ivec->data, BLOCK_SIZE);
else
memset(tmp, 0, BLOCK_SIZE);
for (i = 0, input_length = 0; i < num_data; i++) {
krb5_crypto_iov *iov = &data[i];
if (ENCRYPT_IOV(iov))
input_length += iov->data.length;
}
IOV_BLOCK_STATE_INIT(&input_pos);
IOV_BLOCK_STATE_INIT(&output_pos);
nblocks = (input_length + BLOCK_SIZE - 1) / BLOCK_SIZE;
if (nblocks == 1) {
krb5int_c_iov_get_block((unsigned char *)tmp, BLOCK_SIZE,
data, num_data, &input_pos);
dec(tmp2, tmp, &ctx);
krb5int_c_iov_put_block(data, num_data, (unsigned char *)tmp2,
BLOCK_SIZE, &output_pos);
} else if (nblocks > 1) {
char blockN2[BLOCK_SIZE]; /* second last */
char blockN1[BLOCK_SIZE]; /* last block */
for (blockno = 0; blockno < nblocks - 2; blockno++) {
char blockN[BLOCK_SIZE];
krb5int_c_iov_get_block((unsigned char *)blockN, BLOCK_SIZE, data, num_data, &input_pos);
dec(tmp2, blockN, &ctx);
xorblock(tmp2, tmp);
krb5int_c_iov_put_block(data, num_data, (unsigned char *)tmp2, BLOCK_SIZE, &output_pos);
memcpy(tmp, blockN, BLOCK_SIZE);
}
/* Do last two blocks, the second of which (next-to-last block
of plaintext) may be incomplete. */
/* First, get the last two encrypted blocks */
memset(blockN1, 0, sizeof(blockN1)); /* pad last block with zeros */
krb5int_c_iov_get_block((unsigned char *)blockN2, BLOCK_SIZE, data, num_data, &input_pos);
krb5int_c_iov_get_block((unsigned char *)blockN1, BLOCK_SIZE, data, num_data, &input_pos);
/* Decrypt second last block */
dec(tmp2, blockN2, &ctx);
/* Set tmp2 to last (possibly partial) plaintext block, and
save it. */
xorblock(tmp2, blockN1);
memcpy(blockN2, tmp2, BLOCK_SIZE);
/* Maybe keep the trailing part, and copy in the last
ciphertext block. */
input_length %= BLOCK_SIZE;
memcpy(tmp2, blockN1, input_length ? input_length : BLOCK_SIZE);
dec(tmp3, tmp2, &ctx);
xorblock(tmp3, tmp);
/* Copy out ivec first before we clobber blockN1 with plaintext */
if (ivec != NULL)
memcpy(ivec->data, blockN1, BLOCK_SIZE);
memcpy(blockN1, tmp3, BLOCK_SIZE);
/* Put the last two blocks back into the iovec */
krb5int_c_iov_put_block(data, num_data, (unsigned char *)blockN1, BLOCK_SIZE, &output_pos);
krb5int_c_iov_put_block(data, num_data, (unsigned char *)blockN2, BLOCK_SIZE, &output_pos);
}
return 0;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:86,代码来源:aes.c
示例13: ra
std::string RaDec::toString() const {
return ra().hms() + " " + dec().dms();
}
开发者ID:felipebetancur,项目名称:AstroPhotography-2,代码行数:3,代码来源:Coordinates.cpp
示例14: bamclipreinsert
int bamclipreinsert(::libmaus2::util::ArgInfo const & arginfo)
{
if ( isatty(STDIN_FILENO) )
{
::libmaus2::exception::LibMausException se;
se.getStream() << "Refusing to read binary data from terminal, please redirect standard input to pipe or file." << std::endl;
se.finish();
throw se;
}
if ( isatty(STDOUT_FILENO) )
{
::libmaus2::exception::LibMausException se;
se.getStream() << "Refusing write binary data to terminal, please redirect standard output to pipe or file." << std::endl;
se.finish();
throw se;
}
int const level = libmaus2::bambam::BamBlockWriterBaseFactory::checkCompressionLevel(arginfo.getValue<int>("level",getDefaultLevel()));
int const verbose = arginfo.getValue<int>("verbose",getDefaultVerbose());
::libmaus2::bambam::BamDecoder dec(std::cin,false);
::libmaus2::bambam::BamHeader const & header = dec.getHeader();
std::string const headertext(header.text);
// add PG line to header
std::string const upheadtext = ::libmaus2::bambam::ProgramHeaderLineSet::addProgramLine(
headertext,
"bamclipreinsert", // ID
"bamclipreinsert", // PN
arginfo.commandline, // CL
::libmaus2::bambam::ProgramHeaderLineSet(headertext).getLastIdInChain(), // PP
std::string(PACKAGE_VERSION) // VN
);
// construct new header
libmaus2::bambam::BamHeader const uphead(upheadtext);
/*
* start index/md5 callbacks
*/
std::string const tmpfilenamebase = arginfo.getValue<std::string>("tmpfile",arginfo.getDefaultTmpFileName());
std::string const tmpfileindex = tmpfilenamebase + "_index";
::libmaus2::util::TempFileRemovalContainer::addTempFile(tmpfileindex);
std::string md5filename;
std::string indexfilename;
std::vector< ::libmaus2::lz::BgzfDeflateOutputCallback * > cbs;
::libmaus2::lz::BgzfDeflateOutputCallbackMD5::unique_ptr_type Pmd5cb;
if ( arginfo.getValue<unsigned int>("md5",getDefaultMD5()) )
{
if ( arginfo.hasArg("md5filename") && arginfo.getUnparsedValue("md5filename","") != "" )
md5filename = arginfo.getUnparsedValue("md5filename","");
else
std::cerr << "[V] no filename for md5 given, not creating hash" << std::endl;
if ( md5filename.size() )
{
::libmaus2::lz::BgzfDeflateOutputCallbackMD5::unique_ptr_type Tmd5cb(new ::libmaus2::lz::BgzfDeflateOutputCallbackMD5);
Pmd5cb = UNIQUE_PTR_MOVE(Tmd5cb);
cbs.push_back(Pmd5cb.get());
}
}
libmaus2::bambam::BgzfDeflateOutputCallbackBamIndex::unique_ptr_type Pindex;
if ( arginfo.getValue<unsigned int>("index",getDefaultIndex()) )
{
if ( arginfo.hasArg("indexfilename") && arginfo.getUnparsedValue("indexfilename","") != "" )
indexfilename = arginfo.getUnparsedValue("indexfilename","");
else
std::cerr << "[V] no filename for index given, not creating index" << std::endl;
if ( indexfilename.size() )
{
libmaus2::bambam::BgzfDeflateOutputCallbackBamIndex::unique_ptr_type Tindex(new libmaus2::bambam::BgzfDeflateOutputCallbackBamIndex(tmpfileindex));
Pindex = UNIQUE_PTR_MOVE(Tindex);
cbs.push_back(Pindex.get());
}
}
std::vector< ::libmaus2::lz::BgzfDeflateOutputCallback * > * Pcbs = 0;
if ( cbs.size() )
Pcbs = &cbs;
/*
* end md5/index callbacks
*/
::libmaus2::bambam::BamWriter::unique_ptr_type writer(new ::libmaus2::bambam::BamWriter(std::cout,uphead,level,Pcbs));
libmaus2::bambam::BamAuxFilterVector bafv;
// bafv.set('z','z');
// std::vector<uint8_t> R(8);
// std::string const zz("zz");
libmaus2::bambam::BamAlignment & algn = dec.getAlignment();
uint64_t c = 0;
libmaus2::autoarray::AutoArray < std::pair<uint8_t,uint8_t> > auxtags;
libmaus2::autoarray::AutoArray<libmaus2::bambam::cigar_operation> cigop;
std::stack < libmaus2::bambam::cigar_operation > hardstack;
libmaus2::bambam::BamAlignment::D_array_type Tcigar;
//.........这里部分代码省略.........
开发者ID:amcpherson,项目名称:biobambam2,代码行数:101,代码来源:bamclipreinsert.cpp
示例15: dec
//! Performs an atomic decrement by 'val', returning the new value
T operator-=(const T val) { return dec(val); }
开发者ID:DreamStudio2015,项目名称:SFrame,代码行数:2,代码来源:atomic.hpp
示例16: lmp_json_callback_board_sdmux
//.........这里部分代码省略.........
}
if (!strcmp(ctx->buf, "disconnect")) {
muxmode = masked;
break;
}
if (!strcmp(ctx->buf, "uSDA")) {
muxmode = masked + mul;
break;
}
if (!strcmp(ctx->buf, "uSDB")) {
muxmode = masked + (2 * mul);
break;
}
/* illegal option */
return -1;
}
break;
}
break;
case LEJPCB_COMPLETE:
if (update & UPDATE_RLY) {
if (muxmode % 3) {
if (dut_power_polarity)
lava_lmp_actuate_relay(RL1_CLR);
else
lava_lmp_actuate_relay(RL1_SET);
} else {
if (dut_power_polarity)
lava_lmp_actuate_relay(RL1_SET);
else
lava_lmp_actuate_relay(RL1_CLR);
}
}
if (!(update & UPDATE_MUX))
break;
if ((old_muxmode / 3) != (muxmode / 3)) {
/* changed host, so remove power from Host SD Reader */
LPC_GPIO->CLR[0] = 1 << 17;
}
if ((old_muxmode % 3) != (muxmode % 3)) {
/* any change in DUT card --> disconnect CD / power */
if (dut_power_polarity)
lava_lmp_actuate_relay(RL1_SET);
else
lava_lmp_actuate_relay(RL1_CLR);
}
/* actually change the power and mux arrangements */
lava_lmp_bus_write(0, busa_modes[muxmode]);
/* if host has a new card now, power the reader... */
if ((old_muxmode / 3) != (muxmode / 3) && (muxmode / 3)) {
/* wait for DUT leakage to card in reader to fade */
lmp_delay(3000000);
/* ...allow power to Host SD Reader */
LPC_GPIO->SET[0] = 1 << 17;
}
/* if DUT has a card now... */
if ((muxmode % 3) && (old_muxmode % 3) != (muxmode % 3)) {
/* wait for disconnect to go through */
lmp_delay(1000000);
/* DUT has a card, connect CD / power */
if (dut_power_polarity)
lava_lmp_actuate_relay(RL1_CLR);
else
lava_lmp_actuate_relay(RL1_SET);
}
/* fallthru */
case REASON_SEND_REPORT:
lmp_issue_report_header("DUT.pwr\",\"val\":\"");
lava_lmp_write_voltage();
usb_queue_string("\",\"unit\":\"mV\"},{\"name\":\"modes\",\"modes\":[{\"name\":\"host\",\"mode\":\"");
usb_queue_string(sides[muxmode / 3]);
usb_queue_string("\"},{\"name\":\"dut\",\"mode\":\"");
usb_queue_string(sides[muxmode % 3]);
usb_queue_string("\"},{\"name\":\"dut-power\",\"mode\":\"");
if (dut_power_polarity)
usb_queue_string("short-for-off");
else
usb_queue_string("short-for-on");
usb_queue_string("\"}]},{\"name\":\"DUT.muxmode\",\"val\":\"");
dec(muxmode,str);
usb_queue_string(str);
usb_queue_string("\"}]}\x04");
break;
default:
break;
}
return 0;
}
开发者ID:EmbeddedAndroid,项目名称:lava-lmp-firmware,代码行数:101,代码来源:lava-lmp-sdmux.c
示例17: edit
void
edit()
{
extern bool_t need_redraw;
int c;
register char *p, *q;
Prenum = 0;
/* position the display and the cursor at the top of the file. */
*Topchar = *Filemem;
*Curschar = *Filemem;
Cursrow = Curscol = 0;
do_mlines(); /* check for mode lines before starting */
updatescreen();
for ( ;; ) {
/* Figure out where the cursor is based on Curschar. */
cursupdate();
if (need_redraw && !anyinput()) {
updatescreen();
need_redraw = FALSE;
}
if (!anyinput())
windgoto(Cursrow,Curscol);
c = vgetc();
if (State == NORMAL) {
/* We're in the normal (non-insert) mode. */
/* Pick up any leading digits and compute 'Prenum' */
if ( (Prenum>0 && isdigit(c)) || (isdigit(c) && c!='0') ){
Prenum = Prenum*10 + (c-'0');
continue;
}
/* execute the command */
normal(c);
Prenum = 0;
} else {
/*
* Insert or Replace mode.
*/
switch (c) {
case ESC: /* an escape ends input mode */
/*
* If we just did an auto-indent, truncate the
* line, and put the cursor back.
*/
if (did_ai) {
Curschar->linep->s[0] = NUL;
Curschar->index = 0;
did_ai = FALSE;
}
set_want_col = TRUE;
/* Don't end up on a '\n' if you can help it. */
if (gchar(Curschar) == NUL && Curschar->index != 0)
dec(Curschar);
/*
* The cursor should end up on the last inserted
* character. This is an attempt to match the real
* 'vi', but it may not be quite right yet.
*/
if (Curschar->index != 0 && !endofline(Curschar))
dec(Curschar);
State = NORMAL;
msg("");
/* construct the Redo buffer */
p=Redobuff;
q=Insbuff;
while ( q < Insptr )
*p++ = *q++;
*p++ = ESC;
*p = NUL;
updatescreen();
break;
case CTRL('D'):
/*
* Control-D is treated as a backspace in insert
* mode to make auto-indent easier. This isn't
* completely compatible with vi, but it's a lot
* easier than doing it exactly right, and the
* difference isn't very noticeable.
//.........这里部分代码省略.........
开发者ID:OS2World,项目名称:APP-EDITOR-STEVIE,代码行数:101,代码来源:edit.c
示例18: throw
bitcount_t & operator -=(const bitfield_t &other) throw() { return dec(other); }
开发者ID:jeromeetienne,项目名称:neoip,代码行数:1,代码来源:neoip_bitcount.hpp
示例19: dec_cr
void dec_cr() { dec(); cr(); }
开发者ID:GudzonskiyYastreb,项目名称:openjdk-fontfix,代码行数:1,代码来源:ostream.hpp
示例20: main
int
main(int argc, char *argv[])
{
json_auto_t *jwke = json_pack("{s:s}", "alg", "ECDH-ES+A128KW");
json_auto_t *jwkr = json_pack("{s:s}", "alg", "RSA1_5");
json_auto_t *jwko = json_pack("{s:s}", "alg", "A128KW");
json_auto_t *set0 = json_pack("{s:[O,O]}", "keys", jwke, jwko);
json_auto_t *set1 = json_pack("{s:[O,O]}", "keys", jwkr, jwko);
json_auto_t *set2 = json_pack("{s:[O,O]}", "keys", jwke, jwkr);
json_auto_t *jwe = NULL;
assert(jose_jwk_gen(NULL, jwke));
assert(jose_jwk_gen(NULL, jwkr));
assert(jose_jwk_gen(NULL, jwko));
json_decref(jwe);
assert((jwe = json_object()));
assert(jose_jwe_enc(NULL, jwe, NULL, jwke, "foo", 4));
assert(dec(jwe, jwke));
assert(!dec(jwe, jwkr));
assert(!dec(jwe, jwko));
assert(dec(jwe, set0));
assert(!dec(jwe, set1));
assert(dec(jwe, set2));
json_decref(jwe);
assert((jwe = json_object()));
assert(jose_jwe_enc(NULL, jwe, NULL, jwkr, "foo", 4));
assert(!dec(jwe, jwke));
assert(dec(jwe, jwkr));
assert(!dec(jwe, jwko));
assert(!dec(jwe, set0));
assert(dec(jwe, set1));
assert(dec(jwe, set2));
json_decref(jwe);
assert((jwe = json_object()));
assert(jose_jwe_enc(NULL, jwe, NULL, jwko, "foo", 4));
assert(!dec(jwe, jwke));
assert(!dec(jwe, jwkr));
assert(dec(jwe, jwko));
assert(dec(jwe, set0));
assert(dec(jwe, set1));
assert(!dec(jwe, set2));
json_decref(jwe);
assert((jwe = json_object()));
assert(jose_jwe_enc(NULL, jwe, NULL, set0, "foo", 4));
assert(dec(jwe, jwke));
assert(!dec(jwe, jwkr));
assert(dec(jwe, jwko));
assert(dec(jwe, set0));
assert(dec(jwe, set1));
assert(dec(jwe, set2));
return EXIT_SUCCESS;
}
开发者ID:latchset,项目名称:jose,代码行数:57,代码来源:api_jwe.c
注:本文中的dec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论