Romain Vimont
057c7a4df4
Move str_util to str
...
Simplify naming.
2021-11-14 01:22:22 +01:00
Romain Vimont
979ce64dc0
Improve string util API
...
Use prefixed names and improve documentation.
2021-11-14 01:22:22 +01:00
Romain Vimont
9ec3406568
Add line wrapper
...
Add a tool to wrap lines at words boundaries (spaces) to fit in a
specified number of columns, left-indented by a specified number of
spaces.
2021-11-11 14:55:53 +01:00
Romain Vimont
ffc00210e9
Add strlist_contains()
...
Add a function to know if a string list, using some separator, contains
a specific string.
2021-04-25 14:38:42 +02:00
Romain Vimont
30e619d37f
Replace SDL_strdup() by strdup()
...
The functions SDL_malloc(), SDL_free() and SDL_strdup() were used only
because strdup() was not available everywhere.
Now that it is available, use the native version of these functions.
2021-02-17 09:54:03 +01:00
Romain Vimont
ab912c23e7
Define feature test macros in common.h
...
This enables necessary functions once for all.
As a consequence, define common.h before any other header.
2021-01-17 14:08:48 +01:00
Romain Vimont
199c74f62f
Declare main() with argc/argv params in tests
...
Declaring the main method as "int main(void)" causes issues with SDL.
Fixes #1209 <https://github.com/Genymobile/scrcpy/issues/1209 >
2020-07-15 12:17:04 +02:00
Romain Vimont
2a3a9d4ea9
Add util function to parse a list of integers
...
This will help parsing arguments like '1234:5678' into a list of
integers.
2020-01-18 17:21:00 +01:00
Romain Vimont
ba1b36758e
Define SDL_MAIN_HANDLED in all tests
...
Each test defines its own main() function. If this flag is not set, then
SDL redefines it to SDL_main(), causing compilation failures.
2019-12-09 23:24:39 +01:00
Romain Vimont
61274a7cdb
Factorize integer argument parsing
...
Add util functions for integer parsing (with tests), and factorize
integer argument parsing to avoid code duplication.
2019-12-08 21:19:53 +01:00
Romain Vimont
3259c60b22
Fix test compilation on mingw
...
Including SDL2/SDL.h redefines main to SDL_main by default.
2019-12-05 21:06:49 +01:00
Yu-Chen Lin
5eeaed09ae
Add test_strquote
...
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
2019-12-04 19:24:59 +01:00
Romain Vimont
dfd0707a29
Move utilities to util/
2019-11-24 11:53:23 +01:00
Romain Vimont
0a7fe7ad57
Add helpers to truncate UTF-8 at code points
...
This will help to avoid truncating a UTF-8 string in the middle of a
code point, producing an invalid UTF-8 result.
2019-05-30 22:30:18 +02:00
Romain Vimont
ff4430b2a3
Declare fun(void) functions with no parameters
...
This is not C++.
2018-10-04 17:04:20 +02: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
f75c404a26
Add tests for strutil
...
Test our custom string handling functions.
2018-01-18 17:25:13 +01:00