OSDN Git Service

boot_control_copy: switching to C++
authorBowgo Tsai <bowgotsai@google.com>
Thu, 28 Sep 2017 07:18:37 +0000 (15:18 +0800)
committerBowgo Tsai <bowgotsai@google.com>
Thu, 28 Sep 2017 07:31:07 +0000 (15:31 +0800)
fs_mgr_get_entry_for_mount_point() is switching to a C++ only API (using
std::string). Do a minimum conversion here to adopt that change.

Bug: 67024518
Test: make and boot sailfish
Change-Id: I191fd0043815d75a799eb4001437abb107af6e79

boot_control_copy/Android.mk
boot_control_copy/boot_control_copy.cpp [moved from boot_control_copy/boot_control_copy.c with 100% similarity]
boot_control_copy/bootinfo.cpp [moved from boot_control_copy/bootinfo.c with 98% similarity]

index 3a5f8a0..fecd314 100644 (file)
@@ -3,7 +3,7 @@
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := boot_control_copy.c bootinfo.c
+LOCAL_SRC_FILES := boot_control_copy.cpp bootinfo.cpp
 LOCAL_CFLAGS := -Wall -Wno-missing-field-initializers -Wno-unused-parameter
 LOCAL_C_INCLUDES := system/core/mkbootimg bootable/recovery
 LOCAL_SHARED_LIBRARIES := libbase libcutils
similarity index 98%
rename from boot_control_copy/bootinfo.c
rename to boot_control_copy/bootinfo.cpp
index dbc0757..f21fe84 100644 (file)
@@ -90,7 +90,7 @@ int boot_info_open_partition(const char *name, uint64_t *out_size, int flags)
     }
     trimmed_len = end_slash - record->blk_device + 1;
     name_len = strlen(name);
-    path = calloc(trimmed_len + name_len + 1, 1);
+    path = static_cast<char *>(calloc(trimmed_len + name_len + 1, 1));
     strncpy(path, record->blk_device, trimmed_len);
     strncpy(path + trimmed_len, name, name_len);
   }