diff options
-rw-r--r-- | cgpt/cgpt_add.c | 2 | ||||
-rw-r--r-- | cgpt/cgpt_find.c | 8 | ||||
-rw-r--r-- | host/include/cgpt_params.h | 29 |
3 files changed, 20 insertions, 19 deletions
diff --git a/cgpt/cgpt_add.c b/cgpt/cgpt_add.c index c0e93f3d..786f2bc5 100644 --- a/cgpt/cgpt_add.c +++ b/cgpt/cgpt_add.c @@ -92,7 +92,7 @@ static int GptSetEntryAttributes(struct drive *drive, if (params->set_type) memcpy(&entry->type, ¶ms->type_guid, sizeof(Guid)); if (params->label) { - if (CGPT_OK != UTF8ToUTF16((uint8_t *)params->label, entry->name, + if (CGPT_OK != UTF8ToUTF16((const uint8_t *)params->label, entry->name, sizeof(entry->name) / sizeof(entry->name[0]))) { Error("The label cannot be converted to UTF16.\n"); return -1; diff --git a/cgpt/cgpt_find.c b/cgpt/cgpt_find.c index e207fb3a..bf94b589 100644 --- a/cgpt/cgpt_find.c +++ b/cgpt/cgpt_find.c @@ -69,7 +69,7 @@ static int match_content(CgptFindParams *params, struct drive *drive, } // This needs to handle /dev/mmcblk0 -> /dev/mmcblk0p3, /dev/sda -> /dev/sda3 -static void showmatch(CgptFindParams *params, char *filename, +static void showmatch(CgptFindParams *params, const char *filename, int partnum, GptEntry *entry) { char * format = "%s%d\n"; @@ -97,7 +97,7 @@ static void showmatch(CgptFindParams *params, char *filename, // This handles the MTD devices. ChromeOS uses /dev/mtdX for kernel partitions, // /dev/ubiblockX_0 for root partitions, and /dev/ubiX for stateful partition. -static void chromeos_mtd_show(CgptFindParams *params, char *filename, +static void chromeos_mtd_show(CgptFindParams *params, const char *filename, int partnum, GptEntry *entry) { if (GuidEqual(&guid_chromeos_kernel, &entry->type)) { printf("/dev/mtd%d\n", partnum); @@ -113,7 +113,7 @@ static void chromeos_mtd_show(CgptFindParams *params, char *filename, // filename and partition number that matched is left in a global, since we // could have multiple hits. static int gpt_search(CgptFindParams *params, struct drive *drive, - char *filename) { + const char *filename) { int i; GptEntry *entry; int retval = 0; @@ -155,7 +155,7 @@ static int gpt_search(CgptFindParams *params, struct drive *drive, return retval; } -static int do_search(CgptFindParams *params, char *fileName) { +static int do_search(CgptFindParams *params, const char *fileName) { int retval; struct drive drive; diff --git a/host/include/cgpt_params.h b/host/include/cgpt_params.h index 8e8bfa6c..955524d9 100644 --- a/host/include/cgpt_params.h +++ b/host/include/cgpt_params.h @@ -20,21 +20,21 @@ enum { }; typedef struct CgptCreateParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; int zap; uint64_t padding; } CgptCreateParams; typedef struct CgptAddParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; uint32_t partition; uint64_t begin; uint64_t size; Guid type_guid; Guid unique_guid; - char *label; + const char *label; int successful; int tries; int priority; @@ -54,14 +54,14 @@ typedef struct CgptAddParams { } CgptAddParams; typedef struct CgptEditParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; Guid unique_guid; int set_unique; } CgptEditParams; typedef struct CgptShowParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; int numeric; int verbose; @@ -73,21 +73,21 @@ typedef struct CgptShowParams { } CgptShowParams; typedef struct CgptRepairParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; int verbose; } CgptRepairParams; typedef struct CgptBootParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; uint32_t partition; - char *bootfile; + const char *bootfile; int create_pmbr; } CgptBootParams; typedef struct CgptPrioritizeParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; uint32_t set_partition; int set_friends; @@ -96,10 +96,11 @@ typedef struct CgptPrioritizeParams { } CgptPrioritizeParams; struct CgptFindParams; -typedef void (*CgptFindShowFn)(struct CgptFindParams *params, char *filename, - int partnum, GptEntry *entry); +typedef void (*CgptFindShowFn)(struct CgptFindParams *params, + const char *filename, int partnum, + GptEntry *entry); typedef struct CgptFindParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; int verbose; int set_unique; @@ -113,7 +114,7 @@ typedef struct CgptFindParams { uint8_t *comparebuf; Guid unique_guid; Guid type_guid; - char *label; + const char *label; int hits; int match_partnum; /* 1-based; 0 means no match */ /* when working with MTD, we actually work on a temp file, but we still @@ -129,7 +130,7 @@ enum { }; typedef struct CgptLegacyParams { - char *drive_name; + const char *drive_name; uint64_t drive_size; int mode; } CgptLegacyParams; |