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


C++ rarch_assert函数代码示例

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


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


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