Replace "cannot" by "could not"

This commit is contained in:
Romain Vimont 2019-06-23 20:49:38 +02:00
parent 439b009a79
commit 056e47e752
13 changed files with 37 additions and 37 deletions

View file

@ -91,7 +91,7 @@ run_controller(void *data) {
bool ok = process_msg(controller, &msg); bool ok = process_msg(controller, &msg);
control_msg_destroy(&msg); control_msg_destroy(&msg);
if (!ok) { if (!ok) {
LOGD("Cannot write msg to socket"); LOGD("Could not write msg to socket");
break; break;
} }
} }

View file

@ -31,7 +31,7 @@ file_handler_init(struct file_handler *file_handler, const char *serial) {
if (serial) { if (serial) {
file_handler->serial = SDL_strdup(serial); file_handler->serial = SDL_strdup(serial);
if (!file_handler->serial) { if (!file_handler->serial) {
LOGW("Cannot strdup serial"); LOGW("Could not strdup serial");
SDL_DestroyCond(file_handler->event_cond); SDL_DestroyCond(file_handler->event_cond);
SDL_DestroyMutex(file_handler->mutex); SDL_DestroyMutex(file_handler->mutex);
return false; return false;
@ -169,7 +169,7 @@ file_handler_stop(struct file_handler *file_handler) {
cond_signal(file_handler->event_cond); cond_signal(file_handler->event_cond);
if (file_handler->current_process != PROCESS_NONE) { if (file_handler->current_process != PROCESS_NONE) {
if (!cmd_terminate(file_handler->current_process)) { if (!cmd_terminate(file_handler->current_process)) {
LOGW("Cannot terminate install process"); LOGW("Could not terminate install process");
} }
cmd_simple_wait(file_handler->current_process, NULL); cmd_simple_wait(file_handler->current_process, NULL);
file_handler->current_process = PROCESS_NONE; file_handler->current_process = PROCESS_NONE;

View file

@ -47,7 +47,7 @@ send_keycode(struct controller *controller, enum android_keycode keycode,
if (actions & ACTION_DOWN) { if (actions & ACTION_DOWN) {
msg.inject_keycode.action = AKEY_EVENT_ACTION_DOWN; msg.inject_keycode.action = AKEY_EVENT_ACTION_DOWN;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request 'inject %s (DOWN)'", name); LOGW("Could not request 'inject %s (DOWN)'", name);
return; return;
} }
} }
@ -55,7 +55,7 @@ send_keycode(struct controller *controller, enum android_keycode keycode,
if (actions & ACTION_UP) { if (actions & ACTION_UP) {
msg.inject_keycode.action = AKEY_EVENT_ACTION_UP; msg.inject_keycode.action = AKEY_EVENT_ACTION_UP;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request 'inject %s (UP)'", name); LOGW("Could not request 'inject %s (UP)'", name);
} }
} }
} }
@ -102,7 +102,7 @@ press_back_or_turn_screen_on(struct controller *controller) {
msg.type = CONTROL_MSG_TYPE_BACK_OR_SCREEN_ON; msg.type = CONTROL_MSG_TYPE_BACK_OR_SCREEN_ON;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request 'turn screen on'"); LOGW("Could not request 'turn screen on'");
} }
} }
@ -112,7 +112,7 @@ expand_notification_panel(struct controller *controller) {
msg.type = CONTROL_MSG_TYPE_EXPAND_NOTIFICATION_PANEL; msg.type = CONTROL_MSG_TYPE_EXPAND_NOTIFICATION_PANEL;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request 'expand notification panel'"); LOGW("Could not request 'expand notification panel'");
} }
} }
@ -122,7 +122,7 @@ collapse_notification_panel(struct controller *controller) {
msg.type = CONTROL_MSG_TYPE_COLLAPSE_NOTIFICATION_PANEL; msg.type = CONTROL_MSG_TYPE_COLLAPSE_NOTIFICATION_PANEL;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request 'collapse notification panel'"); LOGW("Could not request 'collapse notification panel'");
} }
} }
@ -132,7 +132,7 @@ request_device_clipboard(struct controller *controller) {
msg.type = CONTROL_MSG_TYPE_GET_CLIPBOARD; msg.type = CONTROL_MSG_TYPE_GET_CLIPBOARD;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request device clipboard"); LOGW("Could not request device clipboard");
} }
} }
@ -140,7 +140,7 @@ static void
set_device_clipboard(struct controller *controller) { set_device_clipboard(struct controller *controller) {
char *text = SDL_GetClipboardText(); char *text = SDL_GetClipboardText();
if (!text) { if (!text) {
LOGW("Cannot get clipboard text: %s", SDL_GetError()); LOGW("Could not get clipboard text: %s", SDL_GetError());
return; return;
} }
if (!*text) { if (!*text) {
@ -155,7 +155,7 @@ set_device_clipboard(struct controller *controller) {
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
SDL_free(text); SDL_free(text);
LOGW("Cannot request 'set device clipboard'"); LOGW("Could not request 'set device clipboard'");
} }
} }
@ -167,7 +167,7 @@ set_screen_power_mode(struct controller *controller,
msg.set_screen_power_mode.mode = mode; msg.set_screen_power_mode.mode = mode;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request 'set screen power mode'"); LOGW("Could not request 'set screen power mode'");
} }
} }
@ -191,7 +191,7 @@ static void
clipboard_paste(struct controller *controller) { clipboard_paste(struct controller *controller) {
char *text = SDL_GetClipboardText(); char *text = SDL_GetClipboardText();
if (!text) { if (!text) {
LOGW("Cannot get clipboard text: %s", SDL_GetError()); LOGW("Could not get clipboard text: %s", SDL_GetError());
return; return;
} }
if (!*text) { if (!*text) {
@ -205,7 +205,7 @@ clipboard_paste(struct controller *controller) {
msg.inject_text.text = text; msg.inject_text.text = text;
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
SDL_free(text); SDL_free(text);
LOGW("Cannot request 'paste clipboard'"); LOGW("Could not request 'paste clipboard'");
} }
} }
@ -222,12 +222,12 @@ input_manager_process_text_input(struct input_manager *input_manager,
msg.type = CONTROL_MSG_TYPE_INJECT_TEXT; msg.type = CONTROL_MSG_TYPE_INJECT_TEXT;
msg.inject_text.text = SDL_strdup(event->text); msg.inject_text.text = SDL_strdup(event->text);
if (!msg.inject_text.text) { if (!msg.inject_text.text) {
LOGW("Cannot strdup input text"); LOGW("Could not strdup input text");
return; return;
} }
if (!controller_push_msg(input_manager->controller, &msg)) { if (!controller_push_msg(input_manager->controller, &msg)) {
SDL_free(msg.inject_text.text); SDL_free(msg.inject_text.text);
LOGW("Cannot request 'inject text'"); LOGW("Could not request 'inject text'");
} }
} }
@ -368,7 +368,7 @@ input_manager_process_key(struct input_manager *input_manager,
struct control_msg msg; struct control_msg msg;
if (input_key_from_sdl_to_android(event, &msg)) { if (input_key_from_sdl_to_android(event, &msg)) {
if (!controller_push_msg(controller, &msg)) { if (!controller_push_msg(controller, &msg)) {
LOGW("Cannot request 'inject keycode'"); LOGW("Could not request 'inject keycode'");
} }
} }
} }
@ -385,7 +385,7 @@ input_manager_process_mouse_motion(struct input_manager *input_manager,
input_manager->screen->frame_size, input_manager->screen->frame_size,
&msg)) { &msg)) {
if (!controller_push_msg(input_manager->controller, &msg)) { if (!controller_push_msg(input_manager->controller, &msg)) {
LOGW("Cannot request 'inject mouse motion event'"); LOGW("Could not request 'inject mouse motion event'");
} }
} }
} }
@ -431,7 +431,7 @@ input_manager_process_mouse_button(struct input_manager *input_manager,
input_manager->screen->frame_size, input_manager->screen->frame_size,
&msg)) { &msg)) {
if (!controller_push_msg(input_manager->controller, &msg)) { if (!controller_push_msg(input_manager->controller, &msg)) {
LOGW("Cannot request 'inject mouse button event'"); LOGW("Could not request 'inject mouse button event'");
} }
} }
} }
@ -446,7 +446,7 @@ input_manager_process_mouse_wheel(struct input_manager *input_manager,
struct control_msg msg; struct control_msg msg;
if (mouse_wheel_from_sdl_to_android(event, position, &msg)) { if (mouse_wheel_from_sdl_to_android(event, position, &msg)) {
if (!controller_push_msg(input_manager->controller, &msg)) { if (!controller_push_msg(input_manager->controller, &msg)) {
LOGW("Cannot request 'inject mouse wheel event'"); LOGW("Could not request 'inject mouse wheel event'");
} }
} }
} }

View file

@ -415,7 +415,7 @@ parse_args(struct args *args, int argc, char *argv[]) {
} }
if (args->no_control && args->turn_screen_off) { if (args->no_control && args->turn_screen_off) {
LOGE("Cannot request to turn screen off if control is disabled"); LOGE("Could not request to turn screen off if control is disabled");
return false; return false;
} }

View file

@ -33,7 +33,7 @@ recorder_init(struct recorder *recorder,
struct size declared_frame_size) { struct size declared_frame_size) {
recorder->filename = SDL_strdup(filename); recorder->filename = SDL_strdup(filename);
if (!recorder->filename) { if (!recorder->filename) {
LOGE("Cannot strdup filename"); LOGE("Could not strdup filename");
return false; return false;
} }
@ -133,7 +133,7 @@ recorder_write_header(struct recorder *recorder, const AVPacket *packet) {
uint8_t *extradata = av_malloc(packet->size * sizeof(uint8_t)); uint8_t *extradata = av_malloc(packet->size * sizeof(uint8_t));
if (!extradata) { if (!extradata) {
LOGC("Cannot allocate extradata"); LOGC("Could not allocate extradata");
return false; return false;
} }

View file

@ -259,7 +259,7 @@ av_log_callback(void *avcl, int level, const char *fmt, va_list vl) {
} }
char *local_fmt = SDL_malloc(strlen(fmt) + 10); char *local_fmt = SDL_malloc(strlen(fmt) + 10);
if (!local_fmt) { if (!local_fmt) {
LOGC("Cannot allocate string"); LOGC("Could not allocate string");
return; return;
} }
// strcpy is safe here, the destination is large enough // strcpy is safe here, the destination is large enough
@ -391,7 +391,7 @@ scrcpy(const struct scrcpy_options *options) {
msg.set_screen_power_mode.mode = SCREEN_POWER_MODE_OFF; msg.set_screen_power_mode.mode = SCREEN_POWER_MODE_OFF;
if (!controller_push_msg(&controller, &msg)) { if (!controller_push_msg(&controller, &msg)) {
LOGW("Cannot request 'set screen power mode'"); LOGW("Could not request 'set screen power mode'");
} }
} }

View file

@ -85,7 +85,7 @@ get_optimal_size(struct size current_size, struct size frame_size) {
uint32_t h; uint32_t h;
if (!get_preferred_display_bounds(&display_size)) { if (!get_preferred_display_bounds(&display_size)) {
// cannot get display bounds, do not constraint the size // could not get display bounds, do not constraint the size
w = current_size.width; w = current_size.width;
h = current_size.height; h = current_size.height;
} else { } else {

View file

@ -35,7 +35,7 @@ get_server_path(void) {
// use scrcpy-server.jar in the same directory as the executable // use scrcpy-server.jar in the same directory as the executable
char *executable_path = get_executable_path(); char *executable_path = get_executable_path();
if (!executable_path) { if (!executable_path) {
LOGE("Cannot get executable path, " LOGE("Could not get executable path, "
"using " SERVER_FILENAME " from current directory"); "using " SERVER_FILENAME " from current directory");
// not found, use current directory // not found, use current directory
return SERVER_FILENAME; return SERVER_FILENAME;
@ -47,7 +47,7 @@ get_server_path(void) {
size_t len = dirlen + 1 + sizeof(SERVER_FILENAME); size_t len = dirlen + 1 + sizeof(SERVER_FILENAME);
char *server_path = SDL_malloc(len); char *server_path = SDL_malloc(len);
if (!server_path) { if (!server_path) {
LOGE("Cannot alloc server path string, " LOGE("Could not alloc server path string, "
"using " SERVER_FILENAME " from current directory"); "using " SERVER_FILENAME " from current directory");
SDL_free(executable_path); SDL_free(executable_path);
return SERVER_FILENAME; return SERVER_FILENAME;
@ -182,7 +182,7 @@ close_socket(socket_t *socket) {
SDL_assert(*socket != INVALID_SOCKET); SDL_assert(*socket != INVALID_SOCKET);
net_shutdown(*socket, SHUT_RDWR); net_shutdown(*socket, SHUT_RDWR);
if (!net_close(*socket)) { if (!net_close(*socket)) {
LOGW("Cannot close socket"); LOGW("Could not close socket");
return; return;
} }
*socket = INVALID_SOCKET; *socket = INVALID_SOCKET;
@ -306,7 +306,7 @@ server_stop(struct server *server) {
SDL_assert(server->process != PROCESS_NONE); SDL_assert(server->process != PROCESS_NONE);
if (!cmd_terminate(server->process)) { if (!cmd_terminate(server->process)) {
LOGW("Cannot terminate server"); LOGW("Could not terminate server");
} }
cmd_simple_wait(server->process, NULL); // ignore exit code cmd_simple_wait(server->process, NULL); // ignore exit code

View file

@ -100,7 +100,7 @@ read_packet_with_meta(void *opaque, uint8_t *buf, int buf_size) {
if (pts != NO_PTS && !receiver_state_push_meta(state, pts)) { if (pts != NO_PTS && !receiver_state_push_meta(state, pts)) {
LOGE("Could not store PTS for recording"); LOGE("Could not store PTS for recording");
// we cannot save the PTS, the recording would be broken // we could not save the PTS, the recording would be broken
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
} }

View file

@ -94,7 +94,7 @@ cmd_simple_wait(pid_t pid, int *exit_code) {
int status; int status;
int code; int code;
if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status)) { if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status)) {
// cannot wait, or exited unexpectedly, probably by a signal // could not wait, or exited unexpectedly, probably by a signal
code = -1; code = -1;
} else { } else {
code = WEXITSTATUS(status); code = WEXITSTATUS(status);

View file

@ -33,7 +33,7 @@ cmd_execute(const char *path, const char *const argv[], HANDLE *handle) {
wchar_t *wide = utf8_to_wide_char(cmd); wchar_t *wide = utf8_to_wide_char(cmd);
if (!wide) { if (!wide) {
LOGC("Cannot allocate wide char string"); LOGC("Could not allocate wide char string");
return PROCESS_ERROR_GENERIC; return PROCESS_ERROR_GENERIC;
} }
@ -67,7 +67,7 @@ cmd_simple_wait(HANDLE handle, DWORD *exit_code) {
DWORD code; DWORD code;
if (WaitForSingleObject(handle, INFINITE) != WAIT_OBJECT_0 if (WaitForSingleObject(handle, INFINITE) != WAIT_OBJECT_0
|| !GetExitCodeProcess(handle, &code)) { || !GetExitCodeProcess(handle, &code)) {
// cannot wait or retrieve the exit code // could not wait or retrieve the exit code
code = -1; // max value, it's unsigned code = -1; // max value, it's unsigned
} }
if (exit_code) { if (exit_code) {

View file

@ -116,7 +116,7 @@ public final class Server {
try { try {
new File(SERVER_PATH).delete(); new File(SERVER_PATH).delete();
} catch (Exception e) { } catch (Exception e) {
Ln.e("Cannot unlink server", e); Ln.e("Could not unlink server", e);
} }
} }

View file

@ -29,7 +29,7 @@ public class StatusBarManager {
try { try {
expandNotificationsPanelMethod.invoke(manager); expandNotificationsPanelMethod.invoke(manager);
} catch (InvocationTargetException | IllegalAccessException e) { } catch (InvocationTargetException | IllegalAccessException e) {
Ln.e("Cannot invoke ServiceBarManager.expandNotificationsPanel()", e); Ln.e("Could not invoke ServiceBarManager.expandNotificationsPanel()", e);
} }
} }
@ -45,7 +45,7 @@ public class StatusBarManager {
try { try {
collapsePanelsMethod.invoke(manager); collapsePanelsMethod.invoke(manager);
} catch (InvocationTargetException | IllegalAccessException e) { } catch (InvocationTargetException | IllegalAccessException e) {
Ln.e("Cannot invoke ServiceBarManager.collapsePanels()", e); Ln.e("Could not invoke ServiceBarManager.collapsePanels()", e);
} }
} }
} }