示例#1
0
static off_t file_stdio_fsize(ALLEGRO_FILE *f)
{
   int64_t old_pos;
   int64_t new_pos;

   old_pos = file_stdio_ftell(f);
   if (old_pos == -1)
      goto Error;

   if (!file_stdio_fseek(f, 0, ALLEGRO_SEEK_END))
      goto Error;

   new_pos = file_stdio_ftell(f);
   if (new_pos == -1)
      goto Error;

   if (!file_stdio_fseek(f, old_pos, ALLEGRO_SEEK_SET))
      goto Error;

   return new_pos;

Error:

   al_set_errno(errno);
   return -1;
}
示例#2
0
static off_t file_stdio_fsize(ALLEGRO_FILE *f)
{
   int64_t old_pos;
   int64_t new_pos;

   old_pos = file_stdio_ftell(f);
   if (old_pos == -1)
      return -1;

   if (!file_stdio_fseek(f, 0, ALLEGRO_SEEK_END))
      return -1;

   new_pos = file_stdio_ftell(f);
   if (new_pos == -1)
      return -1;

   if (!file_stdio_fseek(f, old_pos, ALLEGRO_SEEK_SET))
      return -1;

   return new_pos;
}