[haiku-commits] Re: haiku: hrev44713 - src/add-ons/kernel/file_systems/ntfs

  • From: Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 22 Oct 2012 15:44:11 +0200

Am 22.10.2012 12:14, schrieb Gerasim Troeglazov:
c0c445f: NTFS:Critical fixes for renaming and creating nodes.
> The adaptation of some functions to the new version of the libntfs3g.

Great to see you working on NTFS again!

+static int
+ntfs_remove(fs_volume *_vol, ino_t parent, const char *name)
+{
+       nspace *ns = (nspace*)_vol->private_volume;
+       
+       ntfschar *uname = NULL;
+       ntfs_inode *dir_ni = NULL, *ni = NULL;
+       int res = B_OK, uname_len;
+       u64 iref;
+
+       /* Open parent directory. */
+       dir_ni = ntfs_inode_open(ns->ntvol, parent);
+       if (!dir_ni) {
+               res = EINVAL;

A number of coding style violations:
- dir_ni is neither complying nor a good name. 'dirInode' would be better, or, given the context, just 'dir'. - Same for uname_len (or uname for that matter). Suggestions would be unicodeName and unicodeNameLength. - Instead of (!pointer) or (pointer) please use (pointer == NULL) or (pointer != NULL) respectively. - And finally, prefer Haiku specific error codes over POSIX ones (ie. B_BAD_VALUE instead of EINVAL).
- Variable declarations should be only one per line (and type).
- In general C++ code is preferred.

+       if (ntfs_delete(ns->ntvol, (char*)NULL, ni, dir_ni, uname, uname_len))

The cast violates your own asterisk style.

Bye,
   Axel.


Other related posts: