From 92f34d40297a59c470d17c4b64b81b06dfc80097 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Tue, 22 Dec 2020 21:15:41 +0000
Subject: [PATCH] (internal.c) Fix -Wcast-qual warning
internal.c:400:14: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
tmp_path = sftpfs_fix_filename (path_element2->path, &tmp_path_len);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
internal.c:601:25: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
tmp_path = (char *) sftpfs_fix_filename (path_element2->path, &tmp_path_len);
^
Found by Clang-11
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/vfs/sftpfs/internal.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/vfs/sftpfs/internal.c b/src/vfs/sftpfs/internal.c
index baa2de4f7..74a4d5c67 100644
a
|
b
|
sftpfs_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2, GError ** |
391 | 391 | const vfs_path_element_t *path_element1; |
392 | 392 | const vfs_path_element_t *path_element2 = NULL; |
393 | 393 | char *tmp_path; |
| 394 | const char *ctmp_path; |
394 | 395 | unsigned int tmp_path_len; |
395 | 396 | int res; |
396 | 397 | |
397 | 398 | if (!sftpfs_op_init (&super, &path_element2, vpath2, mcerror)) |
398 | 399 | return -1; |
399 | 400 | |
400 | | tmp_path = (char *) sftpfs_fix_filename (path_element2->path, &tmp_path_len); |
401 | | tmp_path = g_strndup (tmp_path, tmp_path_len); |
| 401 | ctmp_path = sftpfs_fix_filename (path_element2->path, &tmp_path_len); |
| 402 | tmp_path = g_strndup (ctmp_path, tmp_path_len); |
402 | 403 | |
403 | 404 | path_element1 = vfs_path_get_by_index (vpath1, -1); |
404 | 405 | |
… |
… |
sftpfs_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2, GError ** m |
592 | 593 | const vfs_path_element_t *path_element1; |
593 | 594 | const vfs_path_element_t *path_element2 = NULL; |
594 | 595 | char *tmp_path; |
| 596 | const char *ctmp_path; |
595 | 597 | unsigned int tmp_path_len; |
596 | 598 | int res; |
597 | 599 | |
598 | 600 | if (!sftpfs_op_init (&super, &path_element2, vpath2, mcerror)) |
599 | 601 | return -1; |
600 | 602 | |
601 | | tmp_path = (char *) sftpfs_fix_filename (path_element2->path, &tmp_path_len); |
602 | | tmp_path = g_strndup (tmp_path, tmp_path_len); |
| 603 | ctmp_path = sftpfs_fix_filename (path_element2->path, &tmp_path_len); |
| 604 | tmp_path = g_strndup (ctmp_path, tmp_path_len); |
603 | 605 | |
604 | 606 | path_element1 = vfs_path_get_by_index (vpath1, -1); |
605 | 607 | |