OSDN Git Service

Android: support building exfat-utils.
[android-x86/external-exfat.git] / mkfs / main.c
index 8473a73..473b476 100644 (file)
@@ -3,7 +3,7 @@
        Creates exFAT file system.
 
        Free exFAT implementation.
-       Copyright (C) 2011-2013  Andrew Nayenko
+       Copyright (C) 2011-2018  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
        51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#include "mkexfat.h"
+#include "vbr.h"
+#include "fat.h"
+#include "cbm.h"
+#include "uct.h"
+#include "rootdir.h"
+#include <exfat.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <limits.h>
-#include <exfat.h>
-#include "mkexfat.h"
-#include "vbr.h"
-#include "fat.h"
-#include "cbm.h"
-#include "uct.h"
-#include "rootdir.h"
 
 const struct fs_object* objects[] =
 {
@@ -136,7 +136,7 @@ static int setup_volume_label(le16_t label[EXFAT_ENAME_MAX + 1], const char* s)
        memset(label, 0, (EXFAT_ENAME_MAX + 1) * sizeof(le16_t));
        if (s == NULL)
                return 0;
-       return utf8_to_utf16(label, s, EXFAT_ENAME_MAX, strlen(s));
+       return utf8_to_utf16(label, s, EXFAT_ENAME_MAX + 1, strlen(s));
 }
 
 static uint32_t setup_volume_serial(uint32_t user_defined)
@@ -204,8 +204,7 @@ int main(int argc, char* argv[])
        uint64_t first_sector = 0;
        struct exfat_dev* dev;
 
-       printf("mkexfatfs %u.%u.%u\n",
-                       EXFAT_VERSION_MAJOR, EXFAT_VERSION_MINOR, EXFAT_VERSION_PATCH);
+       printf("mkexfatfs %s\n", VERSION);
 
        while ((opt = getopt(argc, argv, "i:n:p:s:V")) != -1)
        {
@@ -224,12 +223,12 @@ int main(int argc, char* argv[])
                        spc_bits = logarithm2(atoi(optarg));
                        if (spc_bits < 0)
                        {
-                               exfat_error("invalid option value: `%s'", optarg);
+                               exfat_error("invalid option value: '%s'", optarg);
                                return 1;
                        }
                        break;
                case 'V':
-                       puts("Copyright (C) 2011-2013  Andrew Nayenko");
+                       puts("Copyright (C) 2011-2018  Andrew Nayenko");
                        return 0;
                default:
                        usage(argv[0]);