2005-11-12 19:12:13 +00:00
|
|
|
/*
|
|
|
|
*
|
2006-09-15 14:55:39 +00:00
|
|
|
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
|
2005-11-12 19:12:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-09-13 07:26:48 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2005-11-12 19:12:13 +00:00
|
|
|
#include "libiso9660.h"
|
2008-04-20 16:29:49 +00:00
|
|
|
#include "iso9660.h"
|
2005-11-12 19:12:13 +00:00
|
|
|
|
2008-04-20 16:29:49 +00:00
|
|
|
struct iso_directory_record *iso9660_readdir(stream_DIR *_dir)
|
2005-11-12 19:12:13 +00:00
|
|
|
{
|
2008-04-20 16:29:49 +00:00
|
|
|
iso9660_DIR *dir = (iso9660_DIR*)_dir;
|
2005-11-12 19:12:13 +00:00
|
|
|
struct iso_directory_record *idr;
|
|
|
|
|
|
|
|
if (dir->index > 2048 - offsetof(struct iso_directory_record, name[0]))
|
|
|
|
{
|
|
|
|
if (dir->len <= 0)
|
|
|
|
return NULL;
|
2005-11-21 22:07:17 +00:00
|
|
|
dir->volume->device->read_sector(dir->volume->device->data, dir->extent, dir->buffer, sizeof (dir->buffer));
|
2005-11-12 19:12:13 +00:00
|
|
|
dir->len -= sizeof (dir->buffer);
|
|
|
|
dir->extent++;
|
|
|
|
dir->index = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
idr = (struct iso_directory_record *) &dir->buffer[dir->index];
|
|
|
|
if (idr->length[0] == 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
dir->index += dir->buffer[dir->index];
|
|
|
|
|
|
|
|
return idr;
|
|
|
|
}
|