X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=fsck%2Fmain.c;h=615aa9ef7e511d7ebf4f97c1f2e906abf01b1d7c;hb=ceedfebcac9ecec2187836eb70a0c7413265dfee;hp=421bd1ddf5f8d4f907e731cb9b9affc31cb3b1a8;hpb=c71ff9d053a3033ec7a2dd77554f51c5cdfc4810;p=android-x86%2Fexternal-exfat.git diff --git a/fsck/main.c b/fsck/main.c index 421bd1d..615aa9e 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -2,11 +2,12 @@ main.c (02.09.09) exFAT file system checker. + Free exFAT implementation. Copyright (C) 2011-2013 Andrew Nayenko - This program is free software: you can redistribute it and/or modify + 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 - the Free Software Foundation, either version 3 of the License, or + the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +15,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include @@ -40,18 +42,18 @@ static int nodeck(struct exfat* ef, struct exfat_node* node) { if (CLUSTER_INVALID(c)) { - char name[EXFAT_NAME_MAX + 1]; + char name[UTF8_BYTES(EXFAT_NAME_MAX) + 1]; - exfat_get_name(node, name, EXFAT_NAME_MAX); + exfat_get_name(node, name, sizeof(name) - 1); 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[EXFAT_NAME_MAX + 1]; + char name[UTF8_BYTES(EXFAT_NAME_MAX) + 1]; - exfat_get_name(node, name, EXFAT_NAME_MAX); + exfat_get_name(node, name, sizeof(name) - 1); exfat_error("cluster 0x%x of file `%s' is not allocated", c, name); rc = 1; } @@ -77,7 +79,7 @@ static void dirck(struct exfat* ef, const char* path) return; path_length = strlen(path); - entry_path = malloc(path_length + 1 + EXFAT_NAME_MAX); + entry_path = malloc(path_length + 1 + UTF8_BYTES(EXFAT_NAME_MAX) + 1); if (entry_path == NULL) { exfat_error("out of memory"); @@ -91,12 +93,12 @@ static void dirck(struct exfat* ef, const char* path) { free(entry_path); exfat_put_node(ef, parent); - exfat_error("failed to open directory `%s'", path); return; } while ((node = exfat_readdir(ef, &it))) { - exfat_get_name(node, entry_path + path_length + 1, EXFAT_NAME_MAX); + exfat_get_name(node, entry_path + path_length + 1, + UTF8_BYTES(EXFAT_NAME_MAX)); exfat_debug("%s: %s, %"PRIu64" bytes, cluster %u", entry_path, IS_CONTIGUOUS(*node) ? "contiguous" : "fragmented", node->size, node->start_cluster);