本文整理汇总了C++中rarch_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ rarch_assert函数的具体用法?C++ rarch_assert怎么用?C++ rarch_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rarch_assert函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fill_pathname_dir
void fill_pathname_dir(char *in_dir, const char *in_basename,
const char *replace, size_t size)
{
const char *base = NULL;
fill_pathname_slash(in_dir, size);
base = path_basename(in_basename);
rarch_assert(strlcat(in_dir, base, size) < size);
rarch_assert(strlcat(in_dir, replace, size) < size);
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:9,代码来源:file_path.c
示例2: fill_pathname_join
void fill_pathname_join(char *out_path,
const char *dir, const char *path, size_t size)
{
rarch_assert(strlcpy(out_path, dir, size) < size);
if (*out_path)
fill_pathname_slash(out_path, size);
rarch_assert(strlcat(out_path, path, size) < size);
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:10,代码来源:file_path.c
示例3: fill_pathname_join_delim
void fill_pathname_join_delim(char *out_path, const char *dir,
const char *path, const char delim, size_t size)
{
size_t copied = strlcpy(out_path, dir, size);
rarch_assert(copied < size+1);
out_path[copied]=delim;
out_path[copied+1] = '\0';
rarch_assert(strlcat(out_path, path, size) < size);
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:11,代码来源:file_path.c
示例4: rarch_main_data_nbio_init_msg_queue
void rarch_main_data_nbio_init_msg_queue(void)
{
nbio_handle_t *nbio = (nbio_handle_t*)nbio_ptr;
if (!nbio)
return;
if (!nbio->msg_queue)
rarch_assert(nbio->msg_queue = msg_queue_new(8));
if (!nbio->image.msg_queue)
rarch_assert(nbio->image.msg_queue = msg_queue_new(8));
}
开发者ID:chungy,项目名称:RetroArch,代码行数:11,代码来源:task_file_transfer.c
示例5: rarch_main_data_init_queues
void rarch_main_data_init_queues(void)
{
#ifdef HAVE_NETWORKING
if (!g_data_runloop.http.msg_queue)
rarch_assert(g_data_runloop.http.msg_queue = msg_queue_new(8));
#endif
if (!g_data_runloop.nbio.msg_queue)
rarch_assert(g_data_runloop.nbio.msg_queue = msg_queue_new(8));
if (!g_data_runloop.nbio.image.msg_queue)
rarch_assert(g_data_runloop.nbio.image.msg_queue = msg_queue_new(8));
}
开发者ID:CautiousAlbino,项目名称:RetroArch,代码行数:11,代码来源:runloop_data.c
示例6: fill_pathname_resolve_relative
void fill_pathname_resolve_relative(char *out_path,
const char *in_refpath, const char *in_path, size_t size)
{
if (path_is_absolute(in_path))
rarch_assert(strlcpy(out_path, in_path, size) < size);
else
{
rarch_assert(strlcpy(out_path, in_refpath, size) < size);
path_basedir(out_path);
rarch_assert(strlcat(out_path, in_path, size) < size);
}
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:12,代码来源:file_path.c
示例7: fill_pathname_abbreviate_special
void fill_pathname_abbreviate_special(char *out_path,
const char *in_path, size_t size)
{
#if !defined(RARCH_CONSOLE)
unsigned i;
const char *candidates[3];
const char *notations[3];
char application_dir[PATH_MAX_LENGTH] = {0};
const char *home = getenv("HOME");
/* application_dir could be zero-string. Safeguard against this.
*
* Keep application dir in front of home, moving app dir to a
* new location inside home would break otherwise. */
/* ugly hack - use application_dir pointer before filling it in. C89 reasons */
candidates[0] = application_dir;
candidates[1] = home;
candidates[2] = NULL;
notations [0] = ":";
notations [1] = "~";
notations [2] = NULL;
fill_pathname_application_path(application_dir, sizeof(application_dir));
path_basedir(application_dir);
for (i = 0; candidates[i]; i++)
{
if (*candidates[i] && strstr(in_path, candidates[i]) == in_path)
{
size_t src_size = strlcpy(out_path, notations[i], size);
rarch_assert(src_size < size);
out_path += src_size;
size -= src_size;
in_path += strlen(candidates[i]);
if (!path_char_is_slash(*in_path))
{
rarch_assert(strlcpy(out_path, path_default_slash(), size) < size);
out_path++;
size--;
}
break; /* Don't allow more abbrevs to take place. */
}
}
#endif
rarch_assert(strlcpy(out_path, in_path, size) < size);
}
开发者ID:netux79,项目名称:RAvideoFixes,代码行数:52,代码来源:file_path_special.c
示例8: fill_pathname
void fill_pathname(char *out_path, const char *in_path,
const char *replace, size_t size)
{
char tmp_path[PATH_MAX];
char *tok;
rarch_assert(strlcpy(tmp_path, in_path,
sizeof(tmp_path)) < sizeof(tmp_path));
if ((tok = (char*)strrchr(path_basename(tmp_path), '.')))
*tok = '\0';
rarch_assert(strlcpy(out_path, tmp_path, size) < size);
rarch_assert(strlcat(out_path, replace, size) < size);
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:14,代码来源:file_path.c
示例9: fill_pathname_slash
/* Assumes path is a directory. Appends a slash
* if not already there. */
void fill_pathname_slash(char *path, size_t size)
{
size_t path_len = strlen(path);
const char *last_slash = find_last_slash(path);
// Try to preserve slash type.
if (last_slash && (last_slash != (path + path_len - 1)))
{
char join_str[2] = {*last_slash};
rarch_assert(strlcat(path, join_str, size) < size);
}
else if (!last_slash)
rarch_assert(strlcat(path, path_default_slash(), size) < size);
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:16,代码来源:file_path.c
示例10: path_resolve_realpath
void path_resolve_realpath(char *buf, size_t size)
{
#ifndef RARCH_CONSOLE
char tmp[PATH_MAX];
strlcpy(tmp, buf, sizeof(tmp));
#ifdef _WIN32
if (!_fullpath(buf, tmp, size))
strlcpy(buf, tmp, size);
#else
rarch_assert(size >= PATH_MAX);
/* NOTE: realpath() expects at least PATH_MAX bytes in buf.
* Technically, PATH_MAX needn't be defined, but we rely on it anyways.
* POSIX 2008 can automatically allocate for you,
* but don't rely on that. */
if (!realpath(tmp, buf))
strlcpy(buf, tmp, size);
#endif
#else
(void)buf;
(void)size;
#endif
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:25,代码来源:file_path.c
示例11: rarch_main_data_init_queues
void rarch_main_data_init_queues(void)
{
data_runloop_t *runloop = rarch_main_data_get_ptr();
#ifdef HAVE_NETWORKING
if (!runloop->http.msg_queue)
rarch_assert(runloop->http.msg_queue = msg_queue_new(8));
#endif
if (!runloop->nbio.msg_queue)
rarch_assert(runloop->nbio.msg_queue = msg_queue_new(8));
if (!runloop->nbio.image.msg_queue)
rarch_assert(runloop->nbio.image.msg_queue = msg_queue_new(8));
#ifdef HAVE_LIBRETRODB
if (!runloop->db.msg_queue)
rarch_assert(runloop->db.msg_queue = msg_queue_new(8));
#endif
}
开发者ID:PCGeekBrain,项目名称:RetroArch,代码行数:16,代码来源:runloop_data.c
示例12: init_libretro_sym
void init_libretro_sym(bool dummy)
{
// Guarantee that we can do "dirty" casting.
// Every OS that this program supports should pass this ...
rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
if (!dummy)
{
#ifdef HAVE_DYNAMIC
// Try to verify that -lretro was not linked in from other modules
// since loading it dynamically and with -l will fail hard.
function_t sym = dylib_proc(NULL, "retro_init");
if (sym)
{
RARCH_ERR("Serious problem. RetroArch wants to load libretro dyamically, but it is already linked.\n");
RARCH_ERR("This could happen if other modules RetroArch depends on link against libretro directly.\n");
RARCH_ERR("Proceeding could cause a crash. Aborting ...\n");
rarch_fail(1, "init_libretro_sym()");
}
if (!*g_settings.libretro)
{
RARCH_ERR("RetroArch is built for dynamic libretro, but libretro_path is not set. Cannot continue.\n");
rarch_fail(1, "init_libretro_sym()");
}
#endif
}
load_symbols(dummy);
pretro_set_environment(environment_cb);
}
开发者ID:CatalystG,项目名称:RetroArch,代码行数:32,代码来源:dynamic.c
示例13: fill_short_pathname_representation
/**
* fill_short_pathname_representation:
* @out_rep : output representation
* @in_path : input path
* @size : size of output representation
*
* Generates a short representation of path. It should only
* be used for displaying the result; the output representation is not
* binding in any meaningful way (for a normal path, this is the same as basename)
* In case of more complex URLs, this should cut everything except for
* the main image file.
*
* E.g.: "/path/to/game.img" -> game.img
* "/path/to/myarchive.7z#folder/to/game.img" -> game.img
*/
void fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size)
{
char path_short[PATH_MAX_LENGTH] = {0};
char *last_hash = NULL;
fill_pathname(path_short, path_basename(in_path), "",
sizeof(path_short));
last_hash = (char*)strchr(path_short,'#');
/* We handle paths like:
* /path/to/file.7z#mygame.img
* short_name: mygame.img:
*/
if(last_hash != NULL)
{
/* We check whether something is actually
* after the hash to avoid going over the buffer.
*/
rarch_assert(strlen(last_hash) > 1);
strlcpy(out_rep,last_hash + 1, size);
}
else
strlcpy(out_rep,path_short, size);
}
开发者ID:jimmy906,项目名称:RetroArch,代码行数:40,代码来源:file_path.c
示例14: rarch_main_data_db_init_msg_queue
void rarch_main_data_db_init_msg_queue(void)
{
db_handle_t *db = (db_handle_t*)rarch_main_data_db_get_ptr();
if (!db->msg_queue)
rarch_assert(db->msg_queue = msg_queue_new(8));
}
开发者ID:rglass01,项目名称:RetroArch,代码行数:7,代码来源:task_database.c
示例15: vg_copy_frame
static void vg_copy_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch)
{
vg_t *vg = (vg_t*)data;
if (vg->mEglImageBuf)
{
EGLImageKHR img = 0;
bool new_egl = vg->driver->write_egl_image(frame, width, height, pitch, (vg->mTexType == VG_sXRGB_8888), 0, &img);
rarch_assert(img != EGL_NO_IMAGE_KHR);
if (new_egl)
{
vgDestroyImage(vg->mImage);
vg->mImage = pvgCreateEGLImageTargetKHR((VGeglImageKHR) img);
if (!vg->mImage)
{
RARCH_ERR("[VG:EGLImage] Error creating image: %08x\n", vgGetError());
exit(2);
}
vg->last_egl_image = img;
}
}
else
{
vgImageSubData(vg->mImage, frame, pitch, vg->mTexType, 0, 0, width, height);
}
}
开发者ID:AbelFlos,项目名称:RetroArch,代码行数:27,代码来源:vg.c
示例16: fill_pathname_base
void fill_pathname_base(char *out, const char *in_path, size_t size)
{
const char *ptr = find_last_slash(in_path);
if (ptr)
ptr++;
else
ptr = in_path;
/* In case of compression, we also have to consider paths like
* /path/to/archive.7z#mygame.img
* and
* /path/to/archive.7z#folder/mygame.img
* basename would be mygame.img in both cases
*/
#ifdef HAVE_COMPRESSION
const char *ptr_bak = ptr;
ptr = strchr(ptr_bak,'#');
if (ptr)
ptr++;
else
ptr = ptr_bak;
#endif
rarch_assert(strlcpy(out, ptr, size) < size);
}
开发者ID:SuperrSonic,项目名称:RA-SS,代码行数:27,代码来源:file_path.c
示例17: preprocess_image
static bool preprocess_image(void *data)
{
video4linux_t *v4l = (video4linux_t*)data;
struct v4l2_buffer buf;
memset(&buf, 0, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
if (xioctl(v4l->fd, VIDIOC_DQBUF, &buf) == -1)
{
switch (errno)
{
case EAGAIN:
return false;
default:
RARCH_ERR("VIDIOC_DQBUF.\n");
return false;
}
}
rarch_assert(buf.index < v4l->n_buffers);
process_image(v4l, (const uint8_t*)v4l->buffers[buf.index].start);
if (xioctl(v4l->fd, VIDIOC_QBUF, &buf) == -1)
RARCH_ERR("VIDIOC_QBUF\n");
return true;
}
开发者ID:AirBrowse,项目名称:RetroArch,代码行数:31,代码来源:video4linux2.c
示例18: global_get_ptr
/**
* menu_init:
* @data : Menu context handle.
*
* Create and initialize menu handle.
*
* Returns: menu handle on success, otherwise NULL.
**/
void *menu_init(const void *data)
{
menu_handle_t *menu = NULL;
menu_display_t *disp = NULL;
menu_ctx_driver_t *menu_ctx = (menu_ctx_driver_t*)data;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
if (!menu_ctx)
return NULL;
if (!(menu = (menu_handle_t*)menu_ctx->init()))
return NULL;
strlcpy(settings->menu.driver, menu_ctx->ident,
sizeof(settings->menu.driver));
if (menu_init_entries(&menu->entries) != 0)
goto error;
global->core_info_current = (core_info_t*)calloc(1, sizeof(core_info_t));
if (!global->core_info_current)
goto error;
#ifdef HAVE_SHADER_MANAGER
menu->shader = (struct video_shader*)calloc(1, sizeof(struct video_shader));
if (!menu->shader)
goto error;
#endif
menu->push_start_screen = settings->menu_show_start_screen;
settings->menu_show_start_screen = false;
menu_shader_manager_init(menu);
if (!menu_display_init(menu))
goto error;
disp = &menu->display;
rarch_assert(disp->msg_queue = msg_queue_new(8));
menu_display_fb_set_dirty();
menu_driver_set_alive();
return menu;
error:
if (menu->entries.menu_list)
menu_list_free(menu->entries.menu_list);
menu->entries.menu_list = NULL;
if (global->core_info_current)
free(global->core_info_current);
global->core_info_current = NULL;
if (menu->shader)
free(menu->shader);
menu->shader = NULL;
if (menu)
free(menu);
return NULL;
}
开发者ID:luiseduardohdbackup,项目名称:RetroArch,代码行数:68,代码来源:menu.c
示例19: init_libretro_sym
/**
* init_libretro_sym:
* @type : Type of core to be loaded.
* If CORE_TYPE_DUMMY, will
* load dummy symbols.
*
* Initializes libretro symbols and
* setups environment callback functions.
**/
void init_libretro_sym(enum rarch_core_type type)
{
/* Guarantee that we can do "dirty" casting.
* Every OS that this program supports should pass this. */
rarch_assert(sizeof(void*) == sizeof(void (*)(void)));
load_symbols(type);
}
开发者ID:HahPagan,项目名称:RetroArch,代码行数:17,代码来源:dynamic.c
示例20: main_load_content
/**
* main_load_content:
* @argc : Argument count.
* @argv : Argument variable list.
* @args : Arguments passed from callee.
* @environ_get : Function passed for environment_get function.
* @process_args : Function passed for process_args function.
*
* Loads content file and starts up RetroArch.
* If no content file can be loaded, will start up RetroArch
* as-is.
*
* Returns: false (0) if rarch_main_init failed, otherwise true (1).
**/
bool main_load_content(int argc, char **argv, void *args,
environment_get_t environ_get,
process_args_t process_args)
{
unsigned i;
bool retval = true;
int ret = 0, rarch_argc = 0;
char *rarch_argv[MAX_ARGS] = {NULL};
char *argv_copy [MAX_ARGS] = {NULL};
char **rarch_argv_ptr = (char**)argv;
int *rarch_argc_ptr = (int*)&argc;
global_t *global = global_get_ptr();
struct rarch_main_wrap *wrap_args = (struct rarch_main_wrap*)
calloc(1, sizeof(*wrap_args));
if (!wrap_args)
return false;
(void)rarch_argc_ptr;
(void)rarch_argv_ptr;
(void)ret;
rarch_assert(wrap_args);
if (environ_get)
environ_get(rarch_argc_ptr, rarch_argv_ptr, args, wrap_args);
check_defaults_dirs();
if (wrap_args->touched)
{
rarch_main_init_wrap(wrap_args, &rarch_argc, rarch_argv);
memcpy(argv_copy, rarch_argv, sizeof(rarch_argv));
rarch_argv_ptr = (char**)rarch_argv;
rarch_argc_ptr = (int*)&rarch_argc;
}
if (global->main_is_init)
rarch_main_deinit();
if ((ret = rarch_main_init(*rarch_argc_ptr, rarch_argv_ptr)))
{
retval = false;
goto error;
}
event_command(EVENT_CMD_RESUME);
if (process_args)
process_args(rarch_argc_ptr, rarch_argv_ptr);
error:
for (i = 0; i < ARRAY_SIZE(argv_copy); i++)
free(argv_copy[i]);
free(wrap_args);
return retval;
}
开发者ID:TheDuckMan64,项目名称:RetroArch,代码行数:71,代码来源:frontend.c
注:本文中的rarch_assert函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论