X-Git-Url: https://git.sven.stormbind.net/?p=sven%2Fexfat-utils.git;a=blobdiff_plain;f=fsck%2Fmain.c;h=b413c58bfe4f0074917afbeb214df9a656e7cf3e;hp=cda1965225c259abe482e35a321551b19a82786d;hb=2fa6c5654e0a345af10df5227b77d9f468759f20;hpb=0e295d91bb7f18afee1a0b0d587e5a0cf58bf2fb diff --git a/fsck/main.c b/fsck/main.c index cda1965..b413c58 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -3,7 +3,7 @@ exFAT file system checker. Free exFAT implementation. - Copyright (C) 2011-2016 Andrew Nayenko + Copyright (C) 2011-2017 Andrew Nayenko This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,18 +41,18 @@ static int nodeck(struct exfat* ef, struct exfat_node* node) { if (CLUSTER_INVALID(c)) { - char name[UTF8_BYTES(EXFAT_NAME_MAX) + 1]; + char name[EXFAT_UTF8_NAME_BUFFER_MAX]; - exfat_get_name(node, name, sizeof(name) - 1); + exfat_get_name(node, name); exfat_error("file '%s' has invalid cluster 0x%x", name, c); rc = 1; break; } if (BMAP_GET(ef->cmap.chunk, c - EXFAT_FIRST_DATA_CLUSTER) == 0) { - char name[UTF8_BYTES(EXFAT_NAME_MAX) + 1]; + char name[EXFAT_UTF8_NAME_BUFFER_MAX]; - exfat_get_name(node, name, sizeof(name) - 1); + exfat_get_name(node, name); exfat_error("cluster 0x%x of file '%s' is not allocated", c, name); rc = 1; } @@ -72,8 +72,8 @@ static void dirck(struct exfat* ef, const char* path) if (exfat_lookup(ef, &parent, path) != 0) exfat_bug("directory '%s' is not found", path); - if (!(parent->flags & EXFAT_ATTRIB_DIR)) - exfat_bug("'%s' is not a directory (0x%x)", path, parent->flags); + if (!(parent->attrib & EXFAT_ATTRIB_DIR)) + exfat_bug("'%s' is not a directory (%#hx)", path, parent->attrib); if (nodeck(ef, parent) != 0) { exfat_put_node(ef, parent); @@ -81,7 +81,7 @@ static void dirck(struct exfat* ef, const char* path) } path_length = strlen(path); - entry_path = malloc(path_length + 1 + UTF8_BYTES(EXFAT_NAME_MAX) + 1); + entry_path = malloc(path_length + 1 + EXFAT_UTF8_NAME_BUFFER_MAX); if (entry_path == NULL) { exfat_put_node(ef, parent); @@ -100,12 +100,11 @@ static void dirck(struct exfat* ef, const char* path) } while ((node = exfat_readdir(ef, &it))) { - exfat_get_name(node, entry_path + path_length + 1, - UTF8_BYTES(EXFAT_NAME_MAX)); + exfat_get_name(node, entry_path + path_length + 1); exfat_debug("%s: %s, %"PRIu64" bytes, cluster %u", entry_path, - IS_CONTIGUOUS(*node) ? "contiguous" : "fragmented", + node->is_contiguous ? "contiguous" : "fragmented", node->size, node->start_cluster); - if (node->flags & EXFAT_ATTRIB_DIR) + if (node->attrib & EXFAT_ATTRIB_DIR) { directories_count++; dirck(ef, entry_path); @@ -147,7 +146,7 @@ int main(int argc, char* argv[]) switch (opt) { case 'V': - puts("Copyright (C) 2011-2016 Andrew Nayenko"); + puts("Copyright (C) 2011-2017 Andrew Nayenko"); return 0; default: usage(argv[0]);