Loading libcutils/Android.bp +24 −24 Original line number Diff line number Diff line Loading @@ -19,14 +19,14 @@ // which are also hard or even impossible to port to native Win32 libcutils_nonwindows_sources = [ "android_get_control_file.cpp", "fs.c", "fs.cpp", "multiuser.c", "socket_inaddr_any_server_unix.c", "socket_local_client_unix.c", "socket_local_server_unix.c", "socket_network_client_unix.c", "socket_inaddr_any_server_unix.cpp", "socket_local_client_unix.cpp", "socket_local_server_unix.cpp", "socket_network_client_unix.cpp", "sockets_unix.cpp", "str_parms.c", "str_parms.cpp", ] cc_library_headers { Loading Loading @@ -56,21 +56,21 @@ cc_library { }, host_supported: true, srcs: [ "config_utils.c", "config_utils.cpp", "fs_config.cpp", "canned_fs_config.c", "hashmap.c", "iosched_policy.c", "load_file.c", "native_handle.c", "canned_fs_config.cpp", "hashmap.cpp", "iosched_policy.cpp", "load_file.cpp", "native_handle.cpp", "open_memstream.c", "record_stream.c", "record_stream.cpp", "sched_policy.cpp", "sockets.cpp", "strdup16to8.c", "strdup8to16.c", "strdup16to8.cpp", "strdup8to16.cpp", "strlcpy.c", "threads.c", "threads.cpp", ], target: { Loading @@ -83,14 +83,14 @@ cc_library { }, not_windows: { srcs: libcutils_nonwindows_sources + [ "ashmem-host.c", "trace-host.c", "ashmem-host.cpp", "trace-host.cpp", ], }, windows: { srcs: [ "socket_inaddr_any_server_windows.c", "socket_network_client_windows.c", "socket_inaddr_any_server_windows.cpp", "socket_network_client_windows.cpp", "sockets_windows.cpp", ], Loading @@ -105,13 +105,13 @@ cc_library { android: { srcs: libcutils_nonwindows_sources + [ "android_reboot.c", "ashmem-dev.c", "android_reboot.cpp", "ashmem-dev.cpp", "klog.cpp", "partition_utils.c", "partition_utils.cpp", "properties.cpp", "qtaguid.cpp", "trace-dev.c", "trace-dev.cpp", "uevent.cpp", ], }, Loading libcutils/android_get_control_file.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <cutils/android_get_control_file.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> Loading @@ -36,8 +39,6 @@ #include <sys/types.h> #include <unistd.h> #include <cutils/android_get_control_file.h> #include "android_get_control_env.h" #ifndef TEMP_FAILURE_RETRY Loading libcutils/android_reboot.c→libcutils/android_reboot.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #include <cutils/android_reboot.h> #include <stdio.h> #include <stdlib.h> #include <cutils/android_reboot.h> #include <cutils/properties.h> #define TAG "android_reboot" Loading @@ -26,7 +28,7 @@ int android_reboot(int cmd, int flags __unused, const char* arg) { const char* restart_cmd = NULL; char* prop_value; switch (cmd) { switch (static_cast<unsigned>(cmd)) { case ANDROID_RB_RESTART: // deprecated case ANDROID_RB_RESTART2: restart_cmd = "reboot"; Loading libcutils/ashmem-dev.c→libcutils/ashmem-dev.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #include <cutils/ashmem.h> /* * Implementation of the user-space ashmem API for devices, which have our * ashmem-enabled kernel. See ashmem-sim.c for the "fake" tmp-based version, Loading @@ -31,8 +33,6 @@ #include <sys/sysmacros.h> #include <sys/types.h> #include <unistd.h> #include <cutils/ashmem.h> #include <log/log.h> #define ASHMEM_DEVICE "/dev/ashmem" Loading Loading @@ -192,7 +192,8 @@ int ashmem_set_prot_region(int fd, int prot) int ashmem_pin_region(int fd, size_t offset, size_t len) { struct ashmem_pin pin = { offset, len }; // TODO: should LP64 reject too-large offset/len? ashmem_pin pin = { static_cast<uint32_t>(offset), static_cast<uint32_t>(len) }; int ret = __ashmem_is_ashmem(fd, 1); if (ret < 0) { Loading @@ -204,7 +205,8 @@ int ashmem_pin_region(int fd, size_t offset, size_t len) int ashmem_unpin_region(int fd, size_t offset, size_t len) { struct ashmem_pin pin = { offset, len }; // TODO: should LP64 reject too-large offset/len? ashmem_pin pin = { static_cast<uint32_t>(offset), static_cast<uint32_t>(len) }; int ret = __ashmem_is_ashmem(fd, 1); if (ret < 0) { Loading libcutils/ashmem-host.c→libcutils/ashmem-host.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #include <cutils/ashmem.h> /* * Implementation of the user-space ashmem API for the simulator, which lacks * an ashmem-enabled kernel. See ashmem-dev.c for the real ashmem-based version. Loading @@ -31,7 +33,6 @@ #include <time.h> #include <unistd.h> #include <cutils/ashmem.h> #include <utils/Compat.h> #ifndef __unused Loading @@ -40,12 +41,12 @@ int ashmem_create_region(const char *ignored __unused, size_t size) { char template[PATH_MAX]; snprintf(template, sizeof(template), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()); int fd = mkstemp(template); char pattern[PATH_MAX]; snprintf(pattern, sizeof(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()); int fd = mkstemp(pattern); if (fd == -1) return -1; unlink(template); unlink(pattern); if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) { close(fd); Loading Loading
libcutils/Android.bp +24 −24 Original line number Diff line number Diff line Loading @@ -19,14 +19,14 @@ // which are also hard or even impossible to port to native Win32 libcutils_nonwindows_sources = [ "android_get_control_file.cpp", "fs.c", "fs.cpp", "multiuser.c", "socket_inaddr_any_server_unix.c", "socket_local_client_unix.c", "socket_local_server_unix.c", "socket_network_client_unix.c", "socket_inaddr_any_server_unix.cpp", "socket_local_client_unix.cpp", "socket_local_server_unix.cpp", "socket_network_client_unix.cpp", "sockets_unix.cpp", "str_parms.c", "str_parms.cpp", ] cc_library_headers { Loading Loading @@ -56,21 +56,21 @@ cc_library { }, host_supported: true, srcs: [ "config_utils.c", "config_utils.cpp", "fs_config.cpp", "canned_fs_config.c", "hashmap.c", "iosched_policy.c", "load_file.c", "native_handle.c", "canned_fs_config.cpp", "hashmap.cpp", "iosched_policy.cpp", "load_file.cpp", "native_handle.cpp", "open_memstream.c", "record_stream.c", "record_stream.cpp", "sched_policy.cpp", "sockets.cpp", "strdup16to8.c", "strdup8to16.c", "strdup16to8.cpp", "strdup8to16.cpp", "strlcpy.c", "threads.c", "threads.cpp", ], target: { Loading @@ -83,14 +83,14 @@ cc_library { }, not_windows: { srcs: libcutils_nonwindows_sources + [ "ashmem-host.c", "trace-host.c", "ashmem-host.cpp", "trace-host.cpp", ], }, windows: { srcs: [ "socket_inaddr_any_server_windows.c", "socket_network_client_windows.c", "socket_inaddr_any_server_windows.cpp", "socket_network_client_windows.cpp", "sockets_windows.cpp", ], Loading @@ -105,13 +105,13 @@ cc_library { android: { srcs: libcutils_nonwindows_sources + [ "android_reboot.c", "ashmem-dev.c", "android_reboot.cpp", "ashmem-dev.cpp", "klog.cpp", "partition_utils.c", "partition_utils.cpp", "properties.cpp", "qtaguid.cpp", "trace-dev.c", "trace-dev.cpp", "uevent.cpp", ], }, Loading
libcutils/android_get_control_file.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,9 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <cutils/android_get_control_file.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> Loading @@ -36,8 +39,6 @@ #include <sys/types.h> #include <unistd.h> #include <cutils/android_get_control_file.h> #include "android_get_control_env.h" #ifndef TEMP_FAILURE_RETRY Loading
libcutils/android_reboot.c→libcutils/android_reboot.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ #include <cutils/android_reboot.h> #include <stdio.h> #include <stdlib.h> #include <cutils/android_reboot.h> #include <cutils/properties.h> #define TAG "android_reboot" Loading @@ -26,7 +28,7 @@ int android_reboot(int cmd, int flags __unused, const char* arg) { const char* restart_cmd = NULL; char* prop_value; switch (cmd) { switch (static_cast<unsigned>(cmd)) { case ANDROID_RB_RESTART: // deprecated case ANDROID_RB_RESTART2: restart_cmd = "reboot"; Loading
libcutils/ashmem-dev.c→libcutils/ashmem-dev.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #include <cutils/ashmem.h> /* * Implementation of the user-space ashmem API for devices, which have our * ashmem-enabled kernel. See ashmem-sim.c for the "fake" tmp-based version, Loading @@ -31,8 +33,6 @@ #include <sys/sysmacros.h> #include <sys/types.h> #include <unistd.h> #include <cutils/ashmem.h> #include <log/log.h> #define ASHMEM_DEVICE "/dev/ashmem" Loading Loading @@ -192,7 +192,8 @@ int ashmem_set_prot_region(int fd, int prot) int ashmem_pin_region(int fd, size_t offset, size_t len) { struct ashmem_pin pin = { offset, len }; // TODO: should LP64 reject too-large offset/len? ashmem_pin pin = { static_cast<uint32_t>(offset), static_cast<uint32_t>(len) }; int ret = __ashmem_is_ashmem(fd, 1); if (ret < 0) { Loading @@ -204,7 +205,8 @@ int ashmem_pin_region(int fd, size_t offset, size_t len) int ashmem_unpin_region(int fd, size_t offset, size_t len) { struct ashmem_pin pin = { offset, len }; // TODO: should LP64 reject too-large offset/len? ashmem_pin pin = { static_cast<uint32_t>(offset), static_cast<uint32_t>(len) }; int ret = __ashmem_is_ashmem(fd, 1); if (ret < 0) { Loading
libcutils/ashmem-host.c→libcutils/ashmem-host.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ * limitations under the License. */ #include <cutils/ashmem.h> /* * Implementation of the user-space ashmem API for the simulator, which lacks * an ashmem-enabled kernel. See ashmem-dev.c for the real ashmem-based version. Loading @@ -31,7 +33,6 @@ #include <time.h> #include <unistd.h> #include <cutils/ashmem.h> #include <utils/Compat.h> #ifndef __unused Loading @@ -40,12 +41,12 @@ int ashmem_create_region(const char *ignored __unused, size_t size) { char template[PATH_MAX]; snprintf(template, sizeof(template), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()); int fd = mkstemp(template); char pattern[PATH_MAX]; snprintf(pattern, sizeof(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()); int fd = mkstemp(pattern); if (fd == -1) return -1; unlink(template); unlink(pattern); if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) { close(fd); Loading