|
|
@@ -61,7 +61,7 @@ static int wipe_testdir()
|
|
|
}
|
|
|
|
|
|
static int setup_testenv(void **state) {
|
|
|
- int rc;
|
|
|
+ int rc = 0;
|
|
|
|
|
|
rc = wipe_testdir();
|
|
|
assert_int_equal(rc, 0);
|
|
|
@@ -80,7 +80,7 @@ static int setup_testenv(void **state) {
|
|
|
assert_int_equal(rc, 0);
|
|
|
|
|
|
/* --- initialize csync */
|
|
|
- statevar *mystate = new statevar;
|
|
|
+ auto mystate = new statevar;
|
|
|
*state = mystate;
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -91,7 +91,7 @@ static void output( const char *text )
|
|
|
}
|
|
|
|
|
|
static int teardown(void **state) {
|
|
|
- int rc;
|
|
|
+ int rc = -1;
|
|
|
|
|
|
output("================== Tearing down!\n");
|
|
|
|
|
|
@@ -110,7 +110,7 @@ static int teardown(void **state) {
|
|
|
*/
|
|
|
static void create_dirs( const char *path )
|
|
|
{
|
|
|
- int rc;
|
|
|
+ int rc = -1;
|
|
|
auto _mypath = QStringLiteral("%1/%2").arg(CSYNC_TEST_DIR, QString::fromUtf8(path)).toUtf8();
|
|
|
char *mypath = _mypath.data();
|
|
|
|
|
|
@@ -149,13 +149,13 @@ static void create_dirs( const char *path )
|
|
|
*/
|
|
|
static void traverse_dir(void **state, const QString &dir, int *cnt)
|
|
|
{
|
|
|
- csync_vio_handle_t *dh;
|
|
|
+ csync_vio_handle_t *dh = nullptr;
|
|
|
std::unique_ptr<csync_file_stat_t> dirent;
|
|
|
- statevar *sv = (statevar*) *state;
|
|
|
+ auto sv = (statevar*) *state;
|
|
|
QByteArray subdir;
|
|
|
QByteArray subdir_out;
|
|
|
- int rc;
|
|
|
- int is_dir;
|
|
|
+ int rc = -1;
|
|
|
+ int is_dir = 0;
|
|
|
|
|
|
dh = csync_vio_local_opendir(dir);
|
|
|
assert_non_null(dh);
|
|
|
@@ -208,7 +208,7 @@ static void create_file( const char *path, const char *name, const char *content
|
|
|
|
|
|
static void check_readdir_shorttree(void **state)
|
|
|
{
|
|
|
- statevar *sv = (statevar*) *state;
|
|
|
+ auto sv = (statevar*) *state;
|
|
|
|
|
|
const char *t1 = "alibaba/und/die/vierzig/räuber/";
|
|
|
create_dirs( t1 );
|
|
|
@@ -230,7 +230,7 @@ static void check_readdir_shorttree(void **state)
|
|
|
|
|
|
static void check_readdir_with_content(void **state)
|
|
|
{
|
|
|
- statevar *sv = (statevar*) *state;
|
|
|
+ auto sv = (statevar*) *state;
|
|
|
int files_cnt = 0;
|
|
|
|
|
|
const char *t1 = "warum/nur/40/Räuber/";
|
|
|
@@ -257,7 +257,7 @@ static void check_readdir_with_content(void **state)
|
|
|
|
|
|
static void check_readdir_longtree(void **state)
|
|
|
{
|
|
|
- statevar *sv = (statevar*) *state;
|
|
|
+ auto sv = (statevar*) *state;
|
|
|
|
|
|
/* Strange things here: Compilers only support strings with length of 4k max.
|
|
|
* The expected result string is longer, so it needs to be split up in r1, r2 and r3
|
|
|
@@ -327,7 +327,7 @@ static void check_readdir_longtree(void **state)
|
|
|
// https://github.com/owncloud/client/issues/3128 https://github.com/owncloud/client/issues/2777
|
|
|
static void check_readdir_bigunicode(void **state)
|
|
|
{
|
|
|
- statevar *sv = (statevar*) *state;
|
|
|
+ auto sv = (statevar*) *state;
|
|
|
// 1: ? ASCII: 239 - EF
|
|
|
// 2: ? ASCII: 187 - BB
|
|
|
// 3: ? ASCII: 191 - BF
|
|
|
@@ -362,5 +362,5 @@ int torture_run_tests(void)
|
|
|
cmocka_unit_test_setup_teardown(check_readdir_bigunicode, setup_testenv, teardown),
|
|
|
};
|
|
|
|
|
|
- return cmocka_run_group_tests(tests, NULL, NULL);
|
|
|
+ return cmocka_run_group_tests(tests, nullptr, nullptr);
|
|
|
}
|