示例#1
0
int ing_sendplan(void* qctx)
{
try {
	if (!qctx) return -1;
	IngQCtx* ingQctx = reinterpret_cast<IngQCtx*>(qctx);
	cpsm_conhdl_t* cal_conn_hndl = reinterpret_cast<cpsm_conhdl_t*>(ingQctx->dhcs_ses_ctx);

	ByteStream bs;
	bs.load(te2, te2len);
	ByteStream tbs(bs);
	ingQctx->csep.unserialize(tbs);

	cal_conn_hndl->connect();
	cal_conn_hndl->exeMgr->write(bs);

	return 0;
} catch (...) {
}
	return -1;
}
示例#2
0
int main(int argc, char* argv[])
{
	int c;

	opterr = 0;

	while ((c = getopt(argc, argv, "h")) != EOF)
		switch (c)
		{
		case 'h':
			usage();
			return 0;
			break;
		default:
			usage();
			return 1;
			break;
		}

	if ((argc - optind) < 1)
	{
		usage();
		return 1;
	}

	ByteStream bs;

	ifstream ifs(argv[optind + 0]);
	ByteStream::byte inbuf[blkSz];
	streampos fLen;
	u_int64_t blkNo = 0;

	ifs.seekg(0, ios_base::end);
	fLen = ifs.tellg();
	ifs.seekg(0, ios_base::beg);

	idbassert((fLen % blkSz) == 0);
	u_int64_t numBlks = fLen / blkSz;
	cout << numBlks << " blocks to fix..." << endl;

	ofstream ofs("fixdate.cdf");

	cout << "pct done:    " << setw(3);

	for(;;)
	{

		ifs.read(reinterpret_cast<char*>(inbuf), blkSz);
		if (ifs.eof()) break;
		bs.load(inbuf, blkSz);

		fixDate(bs, ofs);
		cout << "\b\b\b" << setw(3) << (u_int64_t)(blkNo * 100 / numBlks);
		//cout << setw(3) << (u_int64_t)(blkNo * 100 / numBlks) << endl;

		blkNo++;
	}

	cout << "\b\b\b" << setw(3) << 100 << endl;
	//cout << setw(3) << 100 << endl;

	return 0;
}