Start implementation of IsoFilesystem for reading ISO images.

This commit is contained in:
Vreixo Formoso
2007-12-30 21:39:17 +01:00
parent 135ac835eb
commit d8cb56ecf3
6 changed files with 461 additions and 0 deletions

View File

@ -483,6 +483,18 @@ uint32_t iso_read_msb(const uint8_t *buf, int bytes)
return ret;
}
uint32_t iso_read_bb(const uint8_t *buf, int bytes, int *error)
{
uint32_t v1 = iso_read_lsb(buf, bytes);
if (error) {
uint32_t v2 = iso_read_msb(buf + bytes, bytes);
if (v1 != v2)
*error = 1;
}
return v1;
}
void iso_datetime_7(unsigned char *buf, time_t t)
{
static int tzsetup = 0;
@ -616,3 +628,21 @@ int iso_eaccess(const char *path)
}
return ISO_SUCCESS;
}
char *strcopy(const char *buf, size_t len)
{
char *str;
str = malloc((len + 1) * sizeof(char));
if (str == NULL) {
return NULL;
}
strncpy(str, buf, len);
str[len] = '\0';
/* remove trailing spaces */
for (len = len-1; str[len] == ' ' && len > 0; --len)
str[len] = '\0';
return str;
}