NTFS: Codestyle cleanup

This commit is contained in:
Gerasim Troeglazov
2014-02-01 10:36:34 +00:00
parent 9bd08d10ab
commit 6882e5ef83
2 changed files with 16 additions and 18 deletions
@@ -62,7 +62,7 @@ _ntfs_dirent_filler(void *_dirent, const ntfschar *name,
memcpy(new_entry->ent->d_name,filename, len + 1);
new_entry->ent->d_reclen = sizeof(struct dirent) + len;
if(cookie->cache_root == NULL || cookie->entry == NULL) {
if (cookie->cache_root == NULL || cookie->entry == NULL) {
cookie->cache_root = new_entry;
cookie->entry = cookie->cache_root;
cookie->entry->next = NULL;
@@ -94,8 +94,7 @@ fs_free_dircookie(fs_volume *_vol, fs_vnode *vnode, void *_cookie)
cache_entry *entry = cookie->cache_root;
while (entry != NULL) {
cache_entry *next = entry->next;
if (entry->ent != NULL)
free(entry->ent);
free(entry->ent);
free(entry);
entry = next;
}
@@ -189,23 +188,23 @@ fs_readdir(fs_volume *_vol, fs_vnode *_node, void *_cookie, struct dirent *buf,
goto exit;
}
if(cookie->cache_root == NULL) {
if (cookie->cache_root == NULL) {
cookie->entry = NULL;
result = ntfs_readdir(ni, &cookie->pos, cookie,
(ntfs_filldir_t)_ntfs_dirent_filler);
cookie->entry = cookie->cache_root;
if(result) {
if (result) {
result = ENOENT;
goto exit;
}
}
if(cookie->entry == NULL) {
if (cookie->entry == NULL) {
result = ENOENT;
goto exit;
}
if(cookie->entry->ent == NULL) {
if (cookie->entry->ent == NULL) {
result = ENOENT;
goto exit;
}
@@ -254,8 +253,7 @@ fs_rewinddir(fs_volume *_vol, fs_vnode *_node, void *_cookie)
cache_entry *entry = cookie->cache_root;
while (entry != NULL) {
cache_entry *next = entry->next;
if (entry->ent != NULL)
free(entry->ent);
free(entry->ent);
free(entry);
entry = next;
}
@@ -46,9 +46,9 @@ static uint8 ntfs_count_bits(unsigned char byte, unsigned char shift)
int i;
unsigned char counter = 0;
if(shift < 8) {
for(i=0; i<shift; i++) {
if(!(byte & 0x80))
if (shift < 8) {
for (i=0; i<shift; i++) {
if (!(byte & 0x80))
counter++;
byte = byte << 1;
}
@@ -81,21 +81,21 @@ int ntfs_calc_free_space(nspace *_ns)
return -1;
buf = (unsigned char*)ntfs_malloc(vol->cluster_size);
if(!buf)
if (buf == NULL)
goto exit;
while( pos < data->data_size) {
if( pos % vol->cluster_size == 0) {
while (pos < data->data_size) {
if (pos % vol->cluster_size == 0) {
readed = ntfs_attr_pread(vol->lcnbmp_na, pos,
min(data->data_size - pos, vol->cluster_size), buf);
if(readed < B_NO_ERROR)
if (readed < B_NO_ERROR)
goto error;
if(readed != min(data->data_size - pos, vol->cluster_size))
if (readed != min(data->data_size - pos, vol->cluster_size))
goto error;
}
free_clusters += ntfs_count_bits( buf[pos%vol->cluster_size],
min( (vol->nr_clusters) - (pos * 8), 8));
min((vol->nr_clusters) - (pos * 8), 8));
pos++;
}
error: