本文整理汇总了C++中CHECK_EXCEPTION函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_EXCEPTION函数的具体用法?C++ CHECK_EXCEPTION怎么用?C++ CHECK_EXCEPTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHECK_EXCEPTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JNI_OnLoad
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
LOGV(TAG, "Loading library");
jvm = vm;
JNIEnv *env;
if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_6)) {
return JNI_ERR; /* JNI version not supported */
}
jFXActivityClass = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "javafxports/android/FXActivity"));
CHECK_EXCEPTION(env);
jFXActivity_notifyGlassStartup = (*env)->GetStaticMethodID(env, jFXActivityClass, "notify_glassHasStarted", "()V");
CHECK_EXCEPTION(env);
jFXActivity_notifyGlassShutdown = (*env)->GetStaticMethodID(env, jFXActivityClass, "notify_glassShutdown", "()V");
CHECK_EXCEPTION(env);
jFXActivity_notifyShowIME = (*env)->GetStaticMethodID(env, jFXActivityClass, "notify_showIME", "()V");
CHECK_EXCEPTION(env);
jFXActivity_notifyHideIME = (*env)->GetStaticMethodID(env, jFXActivityClass, "notify_hideIME", "()V");
CHECK_EXCEPTION(env);
return JNI_VERSION_1_6;
}
示例2: init_ids
void init_ids(JNIEnv *env) {
jNativeWebViewClass = (*env)->NewGlobalRef(env,
(*env)->FindClass(env, "com/sun/webkit/NativeWebView"));
CHECK_EXCEPTION(env);
jNativeWebView_fire_load_event = (*env)->GetStaticMethodID(env, jNativeWebViewClass,
"fire_load_event", "(IIILjava/lang/String;Ljava/lang/String;II)V");
CHECK_EXCEPTION(env);
}
示例3: read_physical_drive_sector_to_file
static void read_physical_drive_sector_to_file(uint8_t drive_number, uint64_t sector_number, _In_z_ const wchar_t* output_file_name)
{
std::vector<uint8_t> sector = read_physical_drive_sector(drive_number, sector_number);
std::ofstream output_file(output_file_name, std::ios::binary | std::ios::trunc);
CHECK_EXCEPTION(output_file.good(), u8"Error opening: " + PortableRuntime::utf8_from_utf16(output_file_name));
output_file.write(reinterpret_cast<const char*>(sector.data()), sector.size());
CHECK_EXCEPTION(!output_file.fail(), u8"Error writing output file.");
}
示例4: parse_arguments_and_execute
static int parse_arguments_and_execute()
{
enum
{
Argument_logical_sector = 0,
Argument_file_name,
Argument_help,
};
const std::vector<Parsing::Argument_descriptor> argument_map =
{
{ Argument_logical_sector, u8"logical-sector", u8's', true, u8"The logical block address (LBA) of the sector to read." },
{ Argument_file_name, u8"file-name", u8'f', true, u8"The name of the file to hold the output. This file will be overwritten." },
{ Argument_help, u8"help", u8'?', false, nullptr },
};
#ifndef NDEBUG
Parsing::validate_argument_map(argument_map);
#endif
const auto arguments = WindowsCommon::args_from_command_line();
const auto options = Parsing::options_from_allowed_args(arguments, argument_map);
int error_level = 0;
if(options.count(Argument_help) == 0)
{
CHECK_EXCEPTION(options.count(Argument_logical_sector) > 0, u8"Missing a required argument: --" + std::string(argument_map[Argument_logical_sector].long_name));
CHECK_EXCEPTION(options.count(Argument_file_name) > 0, u8"Missing a required argument: --" + std::string(argument_map[Argument_file_name].long_name));
// There is no _atoui64 function (and perhaps a private implementation is a good idea), but
// reading an int64_t into a uint64_t will have no negative (ha!) consequences, as any sector
// number is considered a valid sector to read.
const uint64_t sector_number = _atoi64(options.at(Argument_logical_sector).c_str());
GetSector::read_physical_drive_sector_to_file(0, sector_number, PortableRuntime::utf16_from_utf8(options.at(Argument_file_name)).c_str());
}
else
{
constexpr auto arg_program_name = 0;
// Hold a reference to program_name_long for the duration of the output functions.
const auto program_name_long = PortableRuntime::utf16_from_utf8(arguments[arg_program_name]);
const auto program_name = PathFindFileNameW(program_name_long.c_str());
std::fwprintf(stderr, L"Usage: %s [options]\nOptions:\n", program_name);
std::fwprintf(stderr, PortableRuntime::utf16_from_utf8(Parsing::Options_help_text(argument_map)).c_str());
std::fwprintf(stderr,
L"\nTo read the Master Boot Record:\n %s -%c 1 -%c mbr.bin\n",
program_name,
argument_map[Argument_logical_sector].short_name,
argument_map[Argument_file_name].short_name);
error_level = 1;
}
return error_level;
}
示例5: fire_load_event
void fire_load_event(int id, int frameID, int state, char *url, char *content_type,
int progress, int error_code) {
JNIEnv *env;
(*jvm)->AttachCurrentThread(jvm, &env, 0);
jstring jurl = (*env)->NewStringUTF(env, url);
jstring jcontentType = (*env)->NewStringUTF(env, content_type);
CHECK_EXCEPTION(env);
(*env)->CallStaticVoidMethod(env, jNativeWebViewClass,
jNativeWebView_fire_load_event,
id, frameID, state, jurl, jcontentType, progress, error_code);
CHECK_EXCEPTION(env);
}
示例6: AndroidDecrypt
static size_t
AndroidDecrypt(vlc_keystore *p_keystore, void *p_ctx, const uint8_t *p_src,
size_t i_src_len, uint8_t **pp_dst)
{
(void) p_ctx;
JNIEnv *p_env = GET_ENV();
if (p_env == NULL)
return 0;
jobject jivArray = NULL, jiv = NULL, jcipher = NULL;
jcipher = CALL_STATICOBJ(Cipher, Cipher.getInstance, fields.VLC_CIPHER);
if (CHECK_EXCEPTION())
return 0;
/* Get the IV located at the beginning of the secret */
size_t i_dst_len = 0;
uint32_t i_iv_len;
if (i_src_len < sizeof(uint32_t))
goto end;
memcpy(&i_iv_len, p_src, sizeof(uint32_t));
if (i_iv_len == 0 || i_src_len < (sizeof(uint32_t) + i_iv_len))
goto end;
jivArray = (*p_env)->NewByteArray(p_env, i_iv_len);
if (CHECK_EXCEPTION())
goto end;
(*p_env)->SetByteArrayRegion(p_env, jivArray, 0, i_iv_len,
(jbyte *)(p_src + sizeof(uint32_t)) );
jiv = NEW_OBJECT(IvParameterSpec, jivArray);
if (CHECK_EXCEPTION())
goto end;
/* Use the IV to initialize the decrypt Cipher */
CALL_VOID(jcipher, Cipher.init, fields.Cipher.DECRYPT_MODE, s_jkey, jiv);
if (CHECK_EXCEPTION())
goto end;
i_dst_len = Process(p_keystore, p_env, jcipher,
p_src + sizeof(uint32_t) + i_iv_len,
i_src_len - sizeof(uint32_t) - i_iv_len,
NULL, 0, pp_dst);
end:
DEL_LREF(jcipher);
if (jivArray != NULL)
DEL_LREF(jivArray);
if (jiv != NULL)
DEL_LREF(jiv);
return i_dst_len;
}
示例7: array2_test
static int array2_test(IC_Env *env)
{
long dl[2][3] = {{11, 2, 7}, {22, 8 ,13}};
m_dd dlo;
m_dd_slice* dlr;
fprintf(stdout, "\n======== m_i_array2 test ======\n\n");
dlr = m_i_array2_test(NULL, dl, dlo, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_dd(dl,dlo) && cmp_dd(dl,dlr));
if (!cmp_dd(dl,dlo)) {
fprintf(stdout, " out parameter error, sent:\n");
print_dd(dl);
fprintf(stdout, " got:\n");
print_dd(dlo);
fprintf(stdout, "\n");
}
if (!cmp_dd(dl,dlr)) {
fprintf(stdout, " result error, sent:\n");
print_dd(dl);
fprintf(stdout, " got:\n");
print_dd(dlr);
fprintf(stdout, "\n");
}
free(*dlr);
return -1;
}
示例8: string2_test
static int string2_test(IC_Env *env)
{
char* sa[3] = {"hello", "foo", "bar"};
m_sseq ssi = {3, 3, sa};
m_sseq *sso, *ssr;
fprintf(stdout, "\n======== m_i_string2 test ======\n\n");
ssr = m_i_string2_test(NULL, &ssi, &sso, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_sseq(&ssi, sso) && cmp_sseq(&ssi, sso));
if (!cmp_sseq(&ssi, sso)) {
fprintf(stdout, " out parameter error, sent:\n");
print_sseq(&ssi);
fprintf(stdout, "got:\n");
print_sseq(sso);
}
if (!cmp_sseq(&ssi, ssr)) {
fprintf(stdout, " result error, sent:\n");
print_sseq(&ssi);
fprintf(stdout, "got:\n");
print_sseq(ssr);
}
CORBA_free(sso);
CORBA_free(ssr);
return -1;
}
示例9: void_test
static int void_test(IC_Env *env)
{
fprintf(stdout, "\n======== m_i_void test ======\n\n");
m_i_void_test(NULL,env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(1);
}
示例10: term_struct_test
static int term_struct_test(IC_Env *env)
{
m_et eti = { erl_format("[{hej, 1, 23}, \"string\", {1.23, 45}]"),
121212 };
m_et eto, etr;
fprintf(stdout, "\n======== m_i_term_struct test ======\n\n");
etr = m_i_term_struct_test(NULL, &eti, &eto, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_et(&eti, &eto) && cmp_et(&eti, &etr));
if (!cmp_et(&eti, &eto)) {
fprintf(stdout, " out parameter error, sent:\n");
print_et(&eti);
fprintf(stdout, "got:\n");
print_et(&eto);
}
if (!cmp_et(&eti, &etr)) {
fprintf(stdout, " result error, sent:\n");
print_et(&eti);
fprintf(stdout, "got:\n");
print_et(&etr);
}
free_et(&eti);
free_et(&eto);
free_et(&etr);
return -1;
}
示例11: term_sequence_test
static int term_sequence_test(IC_Env *env)
{
ETERM* et_array[4] = {
erl_format("[{apa, 1, 23}, \"string\", {1.23, 45}]"),
erl_format("[{banan, 1, 23}, \"string\", {1.23, 45}]"),
erl_format("[{apelsin, 1, 23}, \"string\", {1.23, 45}]"),
erl_format("[{mango, 1, 23}, \"string\", {1.23, 45}]")};
m_etseq etsi = {4, 4, et_array}, *etso, *etsr;
fprintf(stdout, "\n======== m_i_term_sequence test ======\n\n");
etsr = m_i_term_sequence_test(NULL, &etsi, &etso, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_etseq(&etsi, etso) && cmp_etseq(&etsi, etsr));
if (!cmp_etseq(&etsi, etso)) {
fprintf(stdout, " out parameter error, sent:\n");
print_etseq(&etsi);
fprintf(stdout, "got:\n");
print_etseq(etso);
}
if (!cmp_etseq(&etsi, etsr)) {
fprintf(stdout, " result error, sent:\n");
print_etseq(&etsi);
fprintf(stdout, "got:\n");
print_etseq(etsr);
}
free_etseq_buf(&etsi);
free_etseq_buf(etso);
free_etseq_buf(etsr);
CORBA_free(etso);
CORBA_free(etsr);
return -1;
}
示例12: inline_sequence_test
static int inline_sequence_test(IC_Env *env)
{
int i;
long al[500];
m_s isi = {4711, {500, 10, al}},
*iso, *isr;
for (i = 0; i < 500; i++)
al[i]=i;
fprintf(stdout, "\n======== m_i_inline_sequence test ======\n\n");
isr = m_i_inline_sequence_test(NULL, &isi, &iso, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_s(&isi, iso) && cmp_s(&isi, isr));
if (!cmp_s(&isi, iso)) {
fprintf(stdout, " out parameter error, sent:\n");
print_s(&isi);
fprintf(stdout, "got:\n");
print_s(iso);
}
if (!cmp_s(&isi, isr)) {
fprintf(stdout, " result error, sent:\n");
print_s(&isi);
fprintf(stdout, "got:\n");
print_s(isr);
}
CORBA_free(iso);
CORBA_free(isr);
return -1;
}
示例13: seq5_test
static int seq5_test(IC_Env *env)
{
m_arr3 arr3a[3] = {
{4711, 18931947, 3},
{4711, 18931947, 3},
{4711, 18931947, 3}};
m_sarr3 arr3sa[3] = {{3, 3, arr3a}, {3, 3, arr3a}, {3, 3, arr3a}};
m_ssarr3 arr3ssi = {3, 3, arr3sa};
m_ssarr3 *arr3sso;
m_ssarr3 *arr3ssr;
fprintf(stdout, "\n======== m_i_seq5 test ======\n\n");
arr3ssr = m_i_seq5_test(NULL, &arr3ssi, &arr3sso, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_ssarr3(&arr3ssi, arr3sso) &&
cmp_ssarr3(&arr3ssi, arr3ssr));
if (!cmp_ssarr3(&arr3ssi, arr3sso)) {
fprintf(stdout, " out parameter error, sent:\n");
print_ssarr3(&arr3ssi);
fprintf(stdout, " got:\n");
print_ssarr3(arr3sso);
fprintf(stdout, "\n");
}
if (!cmp_ssarr3(&arr3ssi, arr3ssr)) {
fprintf(stdout, " result error, sent:\n");
print_ssarr3(&arr3ssi);
fprintf(stdout, " got:\n");
print_ssarr3(arr3ssr);
fprintf(stdout, "\n");
}
CORBA_free(arr3sso);
CORBA_free(arr3ssr);
return -1;
}
示例14: seq3_test
static int seq3_test(IC_Env *env)
{
m_lseq lsi, *lso, *lsr;
long al[500];
int i=0;
for (i = 0; i < 500; i++)
al[i]=i;
lsi._length = 500;
lsi._buffer = al;
fprintf(stdout, "\n======== m_i_seq3 test ======\n\n");
lsr = m_i_seq3_test(NULL, &lsi, &lso, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_lseq(&lsi, lso) && cmp_lseq(&lsi, lsr));
if (!cmp_lseq(&lsi, lso)) {
fprintf(stdout, " out parameter error, sent:\n");
print_lseq(&lsi);
fprintf(stdout, " got:\n");
print_lseq(lso);
fprintf(stdout, "\n");
}
if (!cmp_lseq(&lsi, lsr)) {
fprintf(stdout, " result error, sent:\n");
print_lseq(&lsi);
fprintf(stdout, " got:\n");
print_lseq(lsr);
fprintf(stdout, "\n");
}
CORBA_free(lso);
CORBA_free(lsr);
return -1;
}
示例15: array1_test
static int array1_test(IC_Env *env)
{
int i;
long al[500];
m_arr1 alo;
m_arr1_slice* alr;
for (i = 0; i < 500; i++)
al[i]=i;
fprintf(stdout, "\n======== m_i_array1 test ======\n\n");
alr = m_i_array1_test(NULL, al, alo, env);
CHECK_EXCEPTION(env);
RETURN_IF_OK(cmp_arr1(al, alo) && cmp_arr1(al, alr));
if (!cmp_arr1(al, alo)) {
fprintf(stdout, " out parameter error, sent:\n");
print_arr1(al);
fprintf(stdout, " got:\n");
print_arr1(alo);
fprintf(stdout, "\n");
}
if (!cmp_arr1(al,alr)) {
fprintf(stdout, " result error, sent:\n");
print_arr1(al);
fprintf(stdout, " got:\n");
print_arr1(alr);
fprintf(stdout, "\n");
}
free(alo);
free(alr);
return -1;
}