Commit graph

24 commits

Author SHA1 Message Date
Romain Vimont
d8e9ad20b0 Improve file handler error message
Terminating the file handler current process may be either a "push" or
"install" command.
2021-01-24 14:24:24 +01:00
Romain Vimont
7afd149f4b Fix file_handler process race condition
The current process could be waited both by run_file_handler() and
file_handler_stop().

To avoid the race condition, wait the process without closing, then
close with mutex locked.
2021-01-24 14:24:24 +01:00
Romain Vimont
6a50231698 Expose a single process_wait()
There were two versions: process_wait() and process_wait_noclose().

Expose a single version with a flag (it was already implemented that way
internally).
2021-01-24 14:24:18 +01:00
Romain Vimont
b8edcf52b0 Simplify process_wait()
The function process_wait() returned a bool (true if the process
terminated successfully) and provided the exit code via an output
parameter exit_code.

But the returned value was always equivalent to exit_code == 0, so just
return the exit code instead.
2021-01-22 18:29:21 +01:00
Romain Vimont
59feb2a15c Group common includes into common.h
Include config.h and compat.h in common.h, and include common.h from all
source files.
2021-01-08 19:22:10 +01:00
Romain Vimont
821c175730 Rename process_simple_wait to process_wait
Adding "simple" in the function name brings no benefit.
2021-01-08 16:44:21 +01:00
Romain Vimont
4bd9da4c93 Split command into process and adb
The process API provides the system-specific implementation, the adb API
uses it to expose adb commands.
2021-01-08 16:44:21 +01:00
Romain Vimont
510caff0cd Replace SDL_assert() by assert()
SDL_assert() open a dialog on assertion failure.

There is no reason not to use assert() directly.
2019-11-27 21:19:46 +01:00
Romain Vimont
dfd0707a29 Move utilities to util/ 2019-11-24 11:53:23 +01:00
Romain Vimont
a90ccbdf3b Add option to change the push target
A drag & drop always pushed the file to /sdcard/.

Add an option to customize the target directory.

Fixes <https://github.com/Genymobile/scrcpy/issues/659>
2019-07-31 01:53:16 +02:00
Romain Vimont
056e47e752 Replace "cannot" by "could not" 2019-06-23 20:52:03 +02:00
Romain Vimont
073181b294 Use cbuf for file handler request queue
Replace the file_handler_request_queue implementation by cbuf.
2019-05-30 22:30:18 +02:00
Romain Vimont
507b0bcccf Fix memory leak on error
The variable condition was not destroyed on strdup() failure.
2019-05-30 22:30:18 +02:00
Romain Vimont
a41dd6c79f Make owned filename a pointer-to-non-const
The file handler owns the filename string, so it needs to free it.
Therefore, it should not be a pointer-to-const.
2019-05-24 17:25:31 +02:00
Romain Vimont
c3779d8513 Make owned serial a pointer-to-non-const
The file handler owns the serial, so it needs to free it. Therefore, it
should not be a pointer-to-const.
2019-05-24 17:24:17 +02:00
Romain Vimont
b3bd5f1b80 Remove useless casts to (void *) 2019-05-24 17:23:21 +02:00
Romain Vimont
dfed1b250e Replace SDL types by C99 standard types
Scrcpy is a C11 project. Use the C99 standard types instead of the
SDL-specific types:

    SDL_bool -> bool
    SintXX   -> intXX_t
    UintXX   -> uintXX_t
2019-03-02 23:55:23 +01:00
Romain Vimont
aeda583a2c Update code style
Limit source code to 80 chars, and declare functions return type and
modifiers on a separate line.

This allows to avoid very long lines, and all function names are
aligned.

(We do this on VLC, and I like it.)
2019-03-02 20:28:46 +01:00
Romain Vimont
536b31829a Separate multi-words filenames by '_'
Rename foobar.ext to foo_bar.ext.

<https://github.com/Genymobile/scrcpy/pull/226#discussion_r209454865>
2018-08-15 19:30:01 +02:00
Romain Vimont
6581f9feb9 Make request_queue functions static
These functions are local to file_handler.c.
2018-08-15 17:19:32 +02:00
Romain Vimont
359685b1db Simplify SDL_assert() calls
SDL_assert() already prevents "unused variable" warnings.
2018-08-15 17:19:32 +02:00
Romain Vimont
4527be4cde Add missing include config.h
When config.h is not included, BUILD_DEBUG is not set.
2018-08-15 17:19:32 +02:00
npes87184
66f45f9dae Support drag&drop a file to transfer it to device
Signed-off-by: npes87184 <npes87184@gmail.com>
2018-08-15 17:12:10 +02:00
npes87184
aa97eed24b installer -> file_handler
Signed-off-by: npes87184 <npes87184@gmail.com>
2018-08-15 17:11:41 +02:00