当前位置: 首页>>代码示例>>C++>>正文


C++ retro_assert函数代码示例

本文整理汇总了C++中retro_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ retro_assert函数的具体用法?C++ retro_assert怎么用?C++ retro_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了retro_assert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dat_converter_get_match

static const char* dat_converter_get_match(
      dat_converter_list_t* list,
      dat_converter_match_key_t* match_key)
{
   int i;

   retro_assert(match_key);

   if (list->type != DAT_CONVERTER_MAP_LIST)
      return NULL;

   for (i = 0; i < list->count; i++)
   {
      if (list->values[i].map.hash == match_key->hash)
      {
         retro_assert(string_is_equal(list->values[i].map.key, match_key->value));

         if (match_key->next)
            return dat_converter_get_match(
                  list->values[i].map.value.list, match_key->next);

         if ((list->values[i].map.type == DAT_CONVERTER_STRING_MAP))
            return list->values[i].map.value.string;

         return NULL;

      }
   }
   return NULL;
}
开发者ID:Monroe88,项目名称:RetroArch,代码行数:30,代码来源:c_converter.c

示例2: fill_pathname_dir

/**
 * fill_pathname_dir:
 * @in_dir             : input directory path
 * @in_basename        : input basename to be appended to @in_dir
 * @replace            : replacement to be appended to @in_basename
 * @size               : size of buffer
 *
 * Appends basename of 'in_basename', to 'in_dir', along with 'replace'.
 * Basename of in_basename is the string after the last '/' or '\\',
 * i.e the filename without directories.
 *
 * If in_basename has no '/' or '\\', the whole 'in_basename' will be used.
 * 'size' is buffer size of 'in_dir'.
 *
 * E.g..: in_dir = "/tmp/some_dir", in_basename = "/some_content/foo.c",
 * replace = ".asm" => in_dir = "/tmp/some_dir/foo.c.asm"
 **/
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);
    retro_assert(strlcat(in_dir, base, size) < size);
    retro_assert(strlcat(in_dir, replace, size) < size);
}
开发者ID:heuripedes,项目名称:RetroArch,代码行数:27,代码来源:file_path.c

示例3: 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)
      retro_assert(nbio->msg_queue       = msg_queue_new(8));
   if (!nbio->image.msg_queue)
      retro_assert(nbio->image.msg_queue = msg_queue_new(8));
}
开发者ID:mak77,项目名称:RetroArch,代码行数:11,代码来源:task_file_transfer.c

示例4: fill_pathname_join

/**
 * fill_pathname_join:
 * @out_path           : output path
 * @dir                : directory
 * @path               : path
 * @size               : size of output path
 *
 * Joins a directory (@dir) and path (@path) together.
 * Makes sure not to get  two consecutive slashes
 * between directory and path.
 **/
void fill_pathname_join(char *out_path,
                        const char *dir, const char *path, size_t size)
{
    if (out_path != dir)
        retro_assert(strlcpy(out_path, dir, size) < size);

    if (*out_path)
        fill_pathname_slash(out_path, size);

    retro_assert(strlcat(out_path, path, size) < size);
}
开发者ID:heuripedes,项目名称:RetroArch,代码行数:22,代码来源:file_path.c

示例5: fill_pathname_join_delim

/**
 * fill_pathname_join_delim:
 * @out_path           : output path
 * @dir                : directory
 * @path               : path
 * @delim              : delimiter
 * @size               : size of output path
 *
 * Joins a directory (@dir) and path (@path) together
 * using the given delimiter (@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);
    retro_assert(copied < size+1);

    out_path[copied]   = delim;
    out_path[copied+1] = '\0';

    retro_assert(strlcat(out_path, path, size) < size);
}
开发者ID:heuripedes,项目名称:RetroArch,代码行数:22,代码来源:file_path.c

示例6: fill_pathname_resolve_relative

/**
 * fill_pathname_resolve_relative:
 * @out_path           : output path
 * @in_refpath         : input reference path
 * @in_path            : input path
 * @size               : size of @out_path
 *
 * Joins basedir of @in_refpath together with @in_path.
 * If @in_path is an absolute path, out_path = in_path.
 * E.g.: in_refpath = "/foo/bar/baz.a", in_path = "foobar.cg",
 * out_path = "/foo/bar/foobar.cg".
 **/
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))
    {
        retro_assert(strlcpy(out_path, in_path, size) < size);
        return;
    }

    fill_pathname_basedir(out_path, in_refpath, size);
    retro_assert(strlcat(out_path, in_path, size) < size);
}
开发者ID:heuripedes,项目名称:RetroArch,代码行数:24,代码来源:file_path.c

示例7: rarch_main_msg_queue_init

void rarch_main_msg_queue_init(void)
{
   if (g_msg_queue)
      return;

   g_msg_queue = msg_queue_new(8);
   retro_assert(g_msg_queue);

#ifdef HAVE_THREADS
   mq_lock = slock_new();
   retro_assert(mq_lock);
#endif
}
开发者ID:ioev,项目名称:RetroArch,代码行数:13,代码来源:runloop_msg.c

示例8: dat_converter_bt_node_insert

static dat_converter_bt_node_t* dat_converter_bt_node_insert(
      dat_converter_list_t* list,
      dat_converter_bt_node_t** node,
      dat_converter_map_t* map)
{
   retro_assert(map->key);
   retro_assert(list->type == DAT_CONVERTER_MAP_LIST);

   if (!*node)
   {
      *node = calloc(1, sizeof(dat_converter_bt_node_t));
      return *node;
   }

   int diff = (*node)->hash - map->hash;

   if (!diff)
      diff = strcmp(list->values[(*node)->index].map.key, map->key);

   if (diff < 0)
      return dat_converter_bt_node_insert(list, &(*node)->left, map);
   else if (diff > 0)
      return dat_converter_bt_node_insert(list, &(*node)->right, map);

   /* found match */

   if (list->values[(*node)->index].map.type == DAT_CONVERTER_LIST_MAP)
   {
      if (map->type == DAT_CONVERTER_LIST_MAP)
      {
         int i;

         retro_assert(list->values[(*node)->index].map.value.list->type
               == map->value.list->type);

         for (i = 0; i < map->value.list->count; i++)
            dat_converter_list_append(
                  list->values[(*node)->index].map.value.list,
                  &map->value.list->values[i]);

         /* set count to 0 to prevent freeing the child nodes */
         map->value.list->count = 0;
         dat_converter_list_free(map->value.list);
      }
   }
   else
      list->values[(*node)->index].map = *map;

   return NULL;
}
开发者ID:Monroe88,项目名称:RetroArch,代码行数:50,代码来源:c_converter.c

示例9: fill_pathname_slash

/**
 * fill_pathname_slash:
 * @path               : path
 * @size               : size of path
 *
 * 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];
        strlcpy(join_str, last_slash, sizeof(join_str));
        retro_assert(strlcat(path, join_str, size) < size);
    }
    else if (!last_slash)
        retro_assert(strlcat(path, path_default_slash(), size) < size);
}
开发者ID:heuripedes,项目名称:RetroArch,代码行数:23,代码来源:file_path.c

示例10: fill_pathname_expand_special

void fill_pathname_expand_special(char *out_path,
      const char *in_path, size_t size)
{
#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)
   if (*in_path == '~')
   {
      const char *home = getenv("HOME");
      if (home)
      {
         size_t src_size = strlcpy(out_path, home, size);
         retro_assert(src_size < size);

         out_path  += src_size;
         size      -= src_size;
         in_path++;
      }
   }
   else if ((in_path[0] == ':') &&
         (
         (in_path[1] == '/')
#ifdef _WIN32
         || (in_path[1] == '\\')
#endif
         )
            )
   {
      size_t src_size;
      char *application_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

      application_dir[0]    = '\0';

      fill_pathname_application_path(application_dir,
            PATH_MAX_LENGTH * sizeof(char));
      path_basedir_wrapper(application_dir);

      src_size   = strlcpy(out_path, application_dir, size);
      retro_assert(src_size < size);

      free(application_dir);

      out_path  += src_size;
      size      -= src_size;
      in_path   += 2;
   }
#endif

   retro_assert(strlcpy(out_path, in_path, size) < size);
}
开发者ID:gouchi,项目名称:RetroArch,代码行数:48,代码来源:file_path.c

示例11: 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 = gfx_ctx_image_buffer_write(vg,
            frame, width, height, pitch, (vg->mTexType == VG_sXRGB_8888), 0, &img);

      retro_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:mak77,项目名称:RetroArch,代码行数:28,代码来源:vg.c

示例12: fill_pathname_parent_dir

/**
 * fill_pathname_parent_dir:
 * @out_dir            : output directory
 * @in_dir             : input directory
 * @size               : size of output directory
 *
 * Copies parent directory of @in_dir into @out_dir.
 * Assumes @in_dir is a directory. Keeps trailing '/'.
 **/
void fill_pathname_parent_dir(char *out_dir,
                              const char *in_dir, size_t size)
{
    if (out_dir != in_dir)
        retro_assert(strlcpy(out_dir, in_dir, size) < size);
    path_parent_dir(out_dir);
}
开发者ID:heuripedes,项目名称:RetroArch,代码行数:16,代码来源:file_path.c

示例13: menu_content_find_first_core

/**
 * menu_content_find_first_core:
 * @core_info            : Core info list handle.
 * @dir                  : Directory. Gets joined with @path.
 * @path                 : Path. Gets joined with @dir.
 * @menu_label           : Label identifier of menu setting.
 * @s                    : Deferred core path. Will be filled in
 *                         by function.
 * @len                  : Size of @s.
 *
 * Gets deferred core.
 *
 * Returns: false if there are multiple deferred cores and a
 * selection needs to be made from a list, otherwise
 * returns true and fills in @s with path to core.
 **/
static bool menu_content_find_first_core(void *data)
{
   char new_core_path[PATH_MAX_LENGTH];
   const core_info_t *info                 = NULL;
   size_t supported                        = 0;
   menu_content_ctx_defer_info_t *def_info = 
      (menu_content_ctx_defer_info_t *)data;
   core_info_list_t *core_info             = 
      (core_info_list_t*)def_info->data;
   uint32_t menu_label_hash                = 
      menu_hash_calculate(def_info->menu_label);

   if (     !string_is_empty(def_info->dir) 
         && !string_is_empty(def_info->path))
      fill_pathname_join(def_info->s, 
            def_info->dir, def_info->path, def_info->len);

#ifdef HAVE_COMPRESSION
   if (path_is_compressed_file(def_info->dir))
   {
      /* In case of a compressed archive, we have to join with a hash */
      /* We are going to write at the position of dir: */
      retro_assert(strlen(def_info->dir) < strlen(def_info->s));
      def_info->s[strlen(def_info->dir)] = '#';
   }
#endif

   if (core_info)
      core_info_list_get_supported_cores(core_info,
            def_info->s, &info,
            &supported);

   /* We started the menu with 'Load Content', we are 
    * going to use the current core to load this. */
   if (menu_label_hash == MENU_LABEL_LOAD_CONTENT)
   {
      core_info_ctl(CORE_INFO_CTL_CURRENT_CORE_GET, (void*)&info);
      if (info)
      {
         RARCH_LOG("Use the current core (%s) to load this content...\n",
               info->path);
         supported = 1;
      }
   }

   /* There are multiple deferred cores and a
    * selection needs to be made from a list, return 0. */
   if (supported != 1)
      return false;

    if (info)
      strlcpy(new_core_path, info->path, sizeof(new_core_path));

   runloop_ctl(RUNLOOP_CTL_SET_CONTENT_PATH, def_info->s);

   if (path_file_exists(new_core_path))
      runloop_ctl(RUNLOOP_CTL_SET_LIBRETRO_PATH, new_core_path);

   return true;
}
开发者ID:spielvan,项目名称:RetroArch,代码行数:76,代码来源:menu_content.c

示例14: netplay_pre_frame

/**
 * netplay_pre_frame:   
 * @netplay              : pointer to netplay object
 *
 * Pre-frame for Netplay.
 * Call this before running retro_run().
 *
 * Returns: true (1) if the frontend is cleared to emulate the frame, false (0)
 * if we're stalled or paused
 **/
bool netplay_pre_frame(netplay_t *netplay)
{
   retro_assert(netplay && netplay->net_cbs->pre_frame);

   /* FIXME: This is an ugly way to learn we're not paused anymore */
   if (netplay->local_paused)
      netplay_frontend_paused(netplay, false);

   if (netplay->quirks & NETPLAY_QUIRK_INITIALIZATION)
   {
      /* Are we ready now? */
      netplay_try_init_serialization(netplay);
   }

   /* Advertise our server if applicable */
   if (netplay->is_server)
   {
      if (netplay_ad_fd >= 0 || init_ad_socket(netplay, RARCH_DEFAULT_PORT))
         netplay_ad_server(netplay, netplay_ad_fd);
   }

   if (!netplay->net_cbs->pre_frame(netplay))
      return false;

   return (!netplay->has_connection || (!netplay->stall && !netplay->remote_paused));
}
开发者ID:KitoHo,项目名称:RetroArch,代码行数:36,代码来源:netplay.c

示例15: 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];
#ifdef HAVE_COMPRESSION
    char *last_slash                  = NULL;
#endif

    path_short[0] = '\0';

    fill_pathname(path_short, path_basename(in_path), "",
                  sizeof(path_short));

#ifdef HAVE_COMPRESSION
    last_slash  = find_last_slash(path_short);
    if (last_slash != NULL)
    {
        /* We handle paths like:
         * /path/to/file.7z#mygame.img
         * short_name: mygame.img:
         *
         * We check whether something is actually
         * after the hash to avoid going over the buffer.
         */
        retro_assert(strlen(last_slash) > 1);
        strlcpy(out_rep, last_slash + 1, size);
    }
    else
#endif
        strlcpy(out_rep, path_short, size);
}
开发者ID:heuripedes,项目名称:RetroArch,代码行数:46,代码来源:file_path.c


注:本文中的retro_assert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。