+2012-05-06 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/fs/sfs.c (grub_fshelp_node): Fix types.
+ (grub_sfs_read_extent): Likewise.
+ (grub_sfs_read_block): Likewise.
+ (grub_sfs_mount): Likewise.
+ (grub_sfs_iterate_dir): Likewise.
+ (grub_sfs_read_symlink): Use strncpy instead of strcpy.
+ (grub_sfs_read): Remove unnecessarry and wrong temporary variable.
+
2012-05-04 Vladimir Serbinenko <phcoder@gmail.com>
Fix errors on compressed NTFS with 512B clusters.
struct grub_fshelp_node
{
struct grub_sfs_data *data;
- int block;
- int size;
+ grub_uint32_t block;
+ grub_uint32_t size;
grub_uint32_t mtime;
};
in NEXTEXT. */
static grub_err_t
grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
- int *size, int *nextext)
+ grub_uint32_t *size, grub_uint32_t *nextext)
{
char *treeblock;
struct grub_sfs_btree *tree;
int i;
- int next;
+ grub_uint32_t next;
treeblock = grub_malloc (data->blocksize);
if (!block)
static grub_disk_addr_t
grub_sfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
{
- int blk = node->block;
- int size = 0;
- int next = 0;
+ grub_uint32_t blk = node->block;
+ grub_uint32_t size = 0;
+ grub_uint32_t next = 0;
while (blk)
{
if (err)
return 0;
- if (fileblock < (unsigned int) size)
+ if (fileblock < size)
return fileblock + blk;
fileblock -= size;
struct grub_sfs_data *data;
struct grub_sfs_objc *rootobjc;
char *rootobjc_data = 0;
- unsigned int blk;
+ grub_uint32_t blk;
data = grub_malloc (sizeof (*data));
if (!data)
/* This is just a wild guess, but it always worked for me. How the
SLNK block looks like is not documented in the SFS docs. */
- symlink = grub_strdup (&block[24]);
+ symlink = grub_strndup (&block[24], data->blocksize - 24);
grub_free (block);
if (!symlink)
return 0;
char *objc_data;
struct grub_sfs_objc *objc;
unsigned int next = dir->block;
- int pos;
+ grub_uint32_t pos;
auto int NESTED_FUNC_ATTR grub_sfs_create_node (const char *name,
int block,
struct grub_sfs_obj *obj;
obj = (struct grub_sfs_obj *) ((char *) objc + pos);
const char *filename = (const char *) obj->filename;
- int len;
+ grub_size_t len;
enum grub_fshelp_filetype type;
- unsigned int block;
+ grub_uint32_t block;
/* The filename and comment dynamically increase the size of
the object. */
{
struct grub_sfs_data *data = (struct grub_sfs_data *) file->data;
- int size = grub_sfs_read_file (&data->diropen, file->read_hook,
- file->offset, len, buf);
-
- return size;
+ return grub_sfs_read_file (&data->diropen, file->read_hook,
+ file->offset, len, buf);
}