[nautilus-python/nautilus-python-gcc10: 2/2] Fix compiler warnings




commit 432a27f23c341977811bf63ae88e58d044086953
Author: Jan Tojnar <jtojnar gmail com>
Date:   Thu Aug 11 00:12:01 2022 +0200

    Fix compiler warnings
    
    nautilus-python-object.c: In function '__PyString_AsString':
    nautilus-python-object.c:45:12: warning: return discards 'const' qualifier from pointer target type 
[8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wdiscarded-qualifiers-Wdiscarded-qualifiers8;;]
       45 |     return PyUnicode_AsUTF8(obj);
          |            ^~~~~~~~~~~~~~~~~~~~~
    nautilus-python.c: In function 'nautilus_python_check_all_directories':
    nautilus-python.c:249:12: warning: unused variable 'extensions_dir' 
[8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-variable-Wunused-variable8;;]
      249 |     gchar *extensions_dir = NULL;
          |            ^~~~~~~~~~~~~~
    nautilus-python.c: In function 'nautilus_module_initialize':
    nautilus-python.c:286:12: warning: unused variable 'user_extensions_dir' 
[8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-variable-Wunused-variable8;;]
      286 |     gchar *user_extensions_dir;
          |            ^~~~~~~~~~~~~~~~~~~
    
    Co-Authored-By: Andreas Henriksson <andreas fatal se>

 src/nautilus-python-object.c | 2 +-
 src/nautilus-python.c        | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)
---
diff --git a/src/nautilus-python-object.c b/src/nautilus-python-object.c
index 1fe1098..1eafa33 100644
--- a/src/nautilus-python-object.c
+++ b/src/nautilus-python-object.c
@@ -40,7 +40,7 @@ int __PyString_Check(PyObject *obj) {
 #endif
 }
 
-char* __PyString_AsString(PyObject *obj) {
+const char* __PyString_AsString(PyObject *obj) {
 #if PY_MAJOR_VERSION >= 3
     return PyUnicode_AsUTF8(obj);
 #else
diff --git a/src/nautilus-python.c b/src/nautilus-python.c
index 510cdfb..6432922 100644
--- a/src/nautilus-python.c
+++ b/src/nautilus-python.c
@@ -243,8 +243,6 @@ nautilus_python_init_python (void) {
 
 static void
 nautilus_python_check_all_directories(GTypeModule *module) {
-    gchar *extensions_dir = NULL;
-
     GList *dirs = NULL;
 
     // Check ~/.local/share first
@@ -280,7 +278,6 @@ nautilus_python_check_all_directories(GTypeModule *module) {
 
 void
 nautilus_module_initialize(GTypeModule *module) {
-    gchar *user_extensions_dir;
     const gchar *env_string;
 
     env_string = g_getenv("NAUTILUS_PYTHON_DEBUG");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]