You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
improve --help output and code style in main.c, use ARRAY_SIZE consistently
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "../generated_headers/android_media_MediaCodec.h"
|
#include "../generated_headers/android_media_MediaCodec.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
#include "src/api-impl-jni/defines.h"
|
#include "../defines.h"
|
||||||
#include "../../libandroid/native_window.h"
|
#include "../../libandroid/native_window.h"
|
||||||
|
|
||||||
struct ATL_codec_context {
|
struct ATL_codec_context {
|
||||||
@@ -111,7 +111,7 @@ static uint32_t get_drm_frame_format(const AVDRMFrameDescriptor *drm_frame_desc)
|
|||||||
if (drm_frame_desc->nb_layers == 1) {
|
if (drm_frame_desc->nb_layers == 1) {
|
||||||
return drm_frame_desc->layers[0].format;
|
return drm_frame_desc->layers[0].format;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < sizeof(drm_format_map) / sizeof(drm_format_map[0]); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(drm_format_map); i++) {
|
||||||
if (drm_format_map[i].nb_layers != drm_frame_desc->nb_layers) {
|
if (drm_format_map[i].nb_layers != drm_frame_desc->nb_layers) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -604,8 +604,6 @@ PFN_vkVoidFunction bionic_vkGetInstanceProcAddr(VkInstance instance, const char
|
|||||||
|
|
||||||
typedef XrResult(*xr_func)();
|
typedef XrResult(*xr_func)();
|
||||||
|
|
||||||
#define ARRRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
|
||||||
|
|
||||||
// avoid hard dependency on libopenxr_loader for the three functions that we only ever call when running a VR app
|
// avoid hard dependency on libopenxr_loader for the three functions that we only ever call when running a VR app
|
||||||
static void *openxr_loader_handle = NULL;
|
static void *openxr_loader_handle = NULL;
|
||||||
static inline __attribute__((__always_inline__)) XrResult xr_lazy_call(char *func_name, ...) {
|
static inline __attribute__((__always_inline__)) XrResult xr_lazy_call(char *func_name, ...) {
|
||||||
@@ -677,7 +675,7 @@ XrResult bionic_xrCreateInstance(XrInstanceCreateInfo *createInfo, XrInstance *i
|
|||||||
|
|
||||||
const char * const*old_names = createInfo->enabledExtensionNames;
|
const char * const*old_names = createInfo->enabledExtensionNames;
|
||||||
const char **new_names;
|
const char **new_names;
|
||||||
int new_count = createInfo->enabledExtensionCount + ARRRAY_SIZE(extra_exts);
|
int new_count = createInfo->enabledExtensionCount + ARRAY_SIZE(extra_exts);
|
||||||
|
|
||||||
//FIXME: Leak?
|
//FIXME: Leak?
|
||||||
new_names = malloc(sizeof(*new_names) * new_count);
|
new_names = malloc(sizeof(*new_names) * new_count);
|
||||||
@@ -688,7 +686,7 @@ XrResult bionic_xrCreateInstance(XrInstanceCreateInfo *createInfo, XrInstance *i
|
|||||||
new_names[i] = harmless_extension;
|
new_names[i] = harmless_extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ARRRAY_SIZE(extra_exts); i++)
|
for (int i = 0; i < ARRAY_SIZE(extra_exts); i++)
|
||||||
new_names[createInfo->enabledExtensionCount + i] = extra_exts[i];
|
new_names[createInfo->enabledExtensionCount + i] = extra_exts[i];
|
||||||
|
|
||||||
createInfo->enabledExtensionCount = new_count;
|
createInfo->enabledExtensionCount = new_count;
|
||||||
@@ -751,7 +749,7 @@ XrResult bionic_xrGetInstanceProcAddr(XrInstance instance, const char *name, PFN
|
|||||||
printf("xrGetInstanceProcAddr(%s)\n", name);
|
printf("xrGetInstanceProcAddr(%s)\n", name);
|
||||||
|
|
||||||
struct xr_proc_override *match = bsearch(name, xr_proc_override_tbl,
|
struct xr_proc_override *match = bsearch(name, xr_proc_override_tbl,
|
||||||
ARRRAY_SIZE(xr_proc_override_tbl),
|
ARRAY_SIZE(xr_proc_override_tbl),
|
||||||
sizeof(xr_proc_override_tbl[0]),
|
sizeof(xr_proc_override_tbl[0]),
|
||||||
(int (*)(const void *, const void *))strcmp);
|
(int (*)(const void *, const void *))strcmp);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user