From e3844b5f827556d66cf15d0f3a27094df53d0860 Mon Sep 17 00:00:00 2001
From: Brian Carrier <carrier@sleuthkit.org>
Date: Tue, 24 Sep 2013 21:04:45 -0400
Subject: [PATCH] Fixed formatting

---
 tsk/fs/fls_lib.c | 31 +++++++++++----------
 tsk/fs/fs_file.c | 72 ++++++++++++++++++++++++++----------------------
 tsk/fs/fs_name.c | 37 ++++++++++++-------------
 3 files changed, 73 insertions(+), 67 deletions(-)

diff --git a/tsk/fs/fls_lib.c b/tsk/fs/fls_lib.c
index 751eef5b8..5cfde431c 100644
--- a/tsk/fs/fls_lib.c
+++ b/tsk/fs/fls_lib.c
@@ -50,7 +50,7 @@ static void
 printit(TSK_FS_FILE * fs_file, const char *a_path,
     const TSK_FS_ATTR * fs_attr, const FLS_DATA * fls_data)
 {
-	TSK_FS_HASH_RESULTS hash_results;
+    TSK_FS_HASH_RESULTS hash_results;
     unsigned int i;
 
     if ((!(fls_data->flags & TSK_FS_FLS_FULL)) && (a_path)) {
@@ -67,18 +67,19 @@ printit(TSK_FS_FILE * fs_file, const char *a_path,
     }
 
 
-	if (fls_data->flags & TSK_FS_FLS_MAC) {
-		if (fls_data->flags & TSK_FS_FLS_HASH) {
-			tsk_fs_file_hash_calc(fs_file, &hash_results, TSK_BASE_HASH_MD5);
-			tsk_fs_name_print_mac_md5(stdout, fs_file, a_path,
-				fs_attr, fls_data->macpre, fls_data->sec_skew,
-				hash_results.md5_digest);
-		}
-		else {
-			tsk_fs_name_print_mac(stdout, fs_file, a_path,
-				fs_attr, fls_data->macpre, fls_data->sec_skew);
-		}
-	}
+    if (fls_data->flags & TSK_FS_FLS_MAC) {
+        if (fls_data->flags & TSK_FS_FLS_HASH) {
+            tsk_fs_file_hash_calc(fs_file, &hash_results,
+                TSK_BASE_HASH_MD5);
+            tsk_fs_name_print_mac_md5(stdout, fs_file, a_path, fs_attr,
+                fls_data->macpre, fls_data->sec_skew,
+                hash_results.md5_digest);
+        }
+        else {
+            tsk_fs_name_print_mac(stdout, fs_file, a_path,
+                fs_attr, fls_data->macpre, fls_data->sec_skew);
+        }
+    }
     else if (fls_data->flags & TSK_FS_FLS_LONG) {
         tsk_fs_name_print_long(stdout, fs_file, a_path, fs_file->fs_info,
             fs_attr, TSK_FS_FLS_FULL & fls_data->flags ? 1 : 0,
@@ -159,8 +160,8 @@ print_dent_act(TSK_FS_FILE * fs_file, const char *a_path, void *ptr)
                 /* Print the FILE_NAME times if this is the same attribute
                  * that we collected the times from. */
                 else if ((fs_attr->type == TSK_FS_ATTR_TYPE_NTFS_FNAME) &&
-                        (fs_attr->id == fs_file->meta->time2.ntfs.fn_id) &&
-                        (fls_data->flags & TSK_FS_FLS_MAC)) {
+                    (fs_attr->id == fs_file->meta->time2.ntfs.fn_id) &&
+                    (fls_data->flags & TSK_FS_FLS_MAC)) {
                     /* If it is . or .. only print it if the flags say so,
                      * we continue with other streams though in case the 
                      * directory has a data stream 
diff --git a/tsk/fs/fs_file.c b/tsk/fs/fs_file.c
index 5b01f03a4..9ac967ae6 100644
--- a/tsk/fs/fs_file.c
+++ b/tsk/fs/fs_file.c
@@ -185,7 +185,7 @@ tsk_fs_file_open(TSK_FS_INFO * a_fs,
     if (fs_file) {
         // Add the name to the structure
         fs_file->name = fs_name;
-        
+
         // path2inum did not put this in there...
         fs_name->meta_seq = fs_file->meta->seq;
     }
@@ -572,9 +572,9 @@ tsk_fs_file_get_owner_sid(TSK_FS_FILE * a_fs_file, char **sid_str)
  * Internal struct used for hash calculations
  */
 typedef struct {
-	TSK_BASE_HASH_ENUM flags;
-	TSK_MD5_CTX md5_context;
-	TSK_SHA_CTX sha1_context;
+    TSK_BASE_HASH_ENUM flags;
+    TSK_MD5_CTX md5_context;
+    TSK_SHA_CTX sha1_context;
 } TSK_FS_HASH_DATA;
 
 /**
@@ -585,17 +585,19 @@ tsk_fs_file_hash_calc_callback(TSK_FS_FILE * file, TSK_OFF_T offset,
     TSK_DADDR_T addr, char *buf, size_t size,
     TSK_FS_BLOCK_FLAG_ENUM a_flags, void *ptr)
 {
-    TSK_FS_HASH_DATA * hash_data = (TSK_FS_HASH_DATA *) ptr;
+    TSK_FS_HASH_DATA *hash_data = (TSK_FS_HASH_DATA *) ptr;
     if (hash_data == NULL)
         return TSK_WALK_CONT;
 
-	if(hash_data->flags & TSK_BASE_HASH_MD5){
-		TSK_MD5_Update(&(hash_data->md5_context), (unsigned char *) buf, (unsigned int) size);
-	}
+    if (hash_data->flags & TSK_BASE_HASH_MD5) {
+        TSK_MD5_Update(&(hash_data->md5_context), (unsigned char *) buf,
+            (unsigned int) size);
+    }
 
-	if(hash_data->flags & TSK_BASE_HASH_SHA1){
-		TSK_SHA_Update(&(hash_data->sha1_context), (unsigned char *) buf, (unsigned int) size);
-	}
+    if (hash_data->flags & TSK_BASE_HASH_SHA1) {
+        TSK_SHA_Update(&(hash_data->sha1_context), (unsigned char *) buf,
+            (unsigned int) size);
+    }
 
 
     return TSK_WALK_CONT;
@@ -609,10 +611,11 @@ tsk_fs_file_hash_calc_callback(TSK_FS_FILE * file, TSK_OFF_T offset,
  * @param a_flags Indicates which hash algorithm(s) to use
  * @returns 0 on success or 1 on error
  */
-extern uint8_t 
-    tsk_fs_file_hash_calc(TSK_FS_FILE * a_fs_file, TSK_FS_HASH_RESULTS * a_hash_results, TSK_BASE_HASH_ENUM a_flags)
+extern uint8_t
+tsk_fs_file_hash_calc(TSK_FS_FILE * a_fs_file,
+    TSK_FS_HASH_RESULTS * a_hash_results, TSK_BASE_HASH_ENUM a_flags)
 {
-	TSK_FS_HASH_DATA hash_data;
+    TSK_FS_HASH_DATA hash_data;
 
     if ((a_fs_file == NULL) || (a_fs_file->fs_info == NULL)
         || (a_fs_file->meta == NULL)) {
@@ -621,34 +624,37 @@ extern uint8_t
         return 1;
     }
 
-	if(a_hash_results == NULL){
+    if (a_hash_results == NULL) {
         tsk_error_set_errno(TSK_ERR_FS_ARG);
-        tsk_error_set_errstr("tsk_fs_file_hash_calc: hash_results is NULL");
+        tsk_error_set_errstr
+            ("tsk_fs_file_hash_calc: hash_results is NULL");
         return 1;
     }
 
-	if(a_flags & TSK_BASE_HASH_MD5){
-		TSK_MD5_Init(&(hash_data.md5_context));
-	}
-	if(a_flags & TSK_BASE_HASH_SHA1){
-		TSK_SHA_Init(&(hash_data.sha1_context));
-	}
+    if (a_flags & TSK_BASE_HASH_MD5) {
+        TSK_MD5_Init(&(hash_data.md5_context));
+    }
+    if (a_flags & TSK_BASE_HASH_SHA1) {
+        TSK_SHA_Init(&(hash_data.sha1_context));
+    }
 
-	hash_data.flags = a_flags;
-	if(tsk_fs_file_walk(a_fs_file, TSK_FS_FILE_WALK_FLAG_NONE,
+    hash_data.flags = a_flags;
+    if (tsk_fs_file_walk(a_fs_file, TSK_FS_FILE_WALK_FLAG_NONE,
             tsk_fs_file_hash_calc_callback, (void *) &hash_data)) {
         tsk_error_set_errno(TSK_ERR_FS_ARG);
-        tsk_error_set_errstr("tsk_fs_file_hash_calc: error in file walk");     
+        tsk_error_set_errstr("tsk_fs_file_hash_calc: error in file walk");
         return 1;
     }
 
-	a_hash_results->flags = a_flags;
-	if(a_flags & TSK_BASE_HASH_MD5){
-		TSK_MD5_Final(a_hash_results->md5_digest, &(hash_data.md5_context));
-	}
-	if(a_flags & TSK_BASE_HASH_MD5){
-		TSK_SHA_Final(a_hash_results->sha1_digest, &(hash_data.sha1_context));
-	}
+    a_hash_results->flags = a_flags;
+    if (a_flags & TSK_BASE_HASH_MD5) {
+        TSK_MD5_Final(a_hash_results->md5_digest,
+            &(hash_data.md5_context));
+    }
+    if (a_flags & TSK_BASE_HASH_MD5) {
+        TSK_SHA_Final(a_hash_results->sha1_digest,
+            &(hash_data.sha1_context));
+    }
 
-	return 0;
+    return 0;
 }
diff --git a/tsk/fs/fs_name.c b/tsk/fs/fs_name.c
index 9a0340715..f1e4988d9 100644
--- a/tsk/fs/fs_name.c
+++ b/tsk/fs/fs_name.c
@@ -447,9 +447,8 @@ tsk_fs_name_print(FILE * hFile, const TSK_FS_FILE * fs_file,
 
     tsk_fprintf(hFile, "%s:\t",
         ((fs_file->meta) && (fs_file->meta->flags & TSK_FS_META_FLAG_ALLOC)
-            && (fs_file->
-                name->flags & TSK_FS_NAME_FLAG_UNALLOC)) ? "(realloc)" :
-        "");
+            && (fs_file->name->
+                flags & TSK_FS_NAME_FLAG_UNALLOC)) ? "(realloc)" : "");
 
     if ((print_path) && (a_path != NULL)) {
         for (i = 0; i < strlen(a_path); i++) {
@@ -585,7 +584,8 @@ tsk_fs_name_print_mac(FILE * hFile, const TSK_FS_FILE * fs_file,
     const char *a_path, const TSK_FS_ATTR * fs_attr,
     const char *prefix, int32_t time_skew)
 {
-	tsk_fs_name_print_mac_md5(hFile, fs_file, a_path, fs_attr, prefix, time_skew, NULL);
+    tsk_fs_name_print_mac_md5(hFile, fs_file, a_path, fs_attr, prefix,
+        time_skew, NULL);
 }
 
 /**
@@ -610,7 +610,7 @@ void
 tsk_fs_name_print_mac_md5(FILE * hFile, const TSK_FS_FILE * fs_file,
     const char *a_path, const TSK_FS_ATTR * fs_attr,
     const char *prefix, int32_t time_skew,
-	const unsigned char * hash_results)
+    const unsigned char *hash_results)
 {
     char ls[12];
     size_t i;
@@ -630,17 +630,17 @@ tsk_fs_name_print_mac_md5(FILE * hFile, const TSK_FS_FILE * fs_file,
     }
 
     /* hash
-	 * Print out the hash buffer (if not null)
-	 */
-	if(hash_results == NULL){
-		tsk_fprintf(hFile, "0|");
-	}
-	else{
-		for(i = 0;i < 16;i++){
-			tsk_fprintf(hFile, "%02x", hash_results[i]);
-		}
-		tsk_fprintf(hFile, "|");
-	}
+     * Print out the hash buffer (if not null)
+     */
+    if (hash_results == NULL) {
+        tsk_fprintf(hFile, "0|");
+    }
+    else {
+        for (i = 0; i < 16; i++) {
+            tsk_fprintf(hFile, "%02x", hash_results[i]);
+        }
+        tsk_fprintf(hFile, "|");
+    }
 
     /* file name */
     tsk_fprintf(hFile, "%s", prefix);
@@ -688,9 +688,8 @@ tsk_fs_name_print_mac_md5(FILE * hFile, const TSK_FS_FILE * fs_file,
      * allocated, then add realloc comment */
     if (fs_file->name->flags & TSK_FS_NAME_FLAG_UNALLOC)
         tsk_fprintf(hFile, " (deleted%s)", ((fs_file->meta)
-                && (fs_file->
-                    meta->flags & TSK_FS_META_FLAG_ALLOC)) ? "-realloc" :
-            "");
+                && (fs_file->meta->
+                    flags & TSK_FS_META_FLAG_ALLOC)) ? "-realloc" : "");
 
     /* inode */
     tsk_fprintf(hFile, "|%" PRIuINUM, fs_file->name->meta_addr);
-- 
GitLab