[gnome-builder] libide: fix various compiler warnings
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: fix various compiler warnings
- Date: Mon, 23 Mar 2015 23:38:00 +0000 (UTC)
commit 8b0b41e6792c13f586da3f9f14b73f7c2f826a72
Author: Christian Hergert <christian hergert me>
Date: Wed Feb 18 21:55:05 2015 -0800
libide: fix various compiler warnings
libide/c/ide-c-indenter.c | 1 -
libide/clang/ide-clang-highlighter.c | 64 +------------
libide/clang/ide-clang-highlighter.h | 8 +-
libide/clang/ide-clang-service.c | 97 +++++---------------
libide/clang/ide-clang-service.h | 7 +-
libide/clang/ide-clang-symbol-resolver.c | 64 +------------
libide/clang/ide-clang-symbol-resolver.h | 8 +-
libide/clang/ide-clang-translation-unit.c | 3 +-
.../editorconfig/ide-editorconfig-file-settings.c | 1 -
libide/gca/ide-gca-diagnostic-provider.c | 2 -
libide/git/ide-git-search-index.c | 11 --
libide/gjs/ide-gjs-script.cpp | 4 +-
libide/ide-build-result.c | 4 +-
libide/ide-context.c | 6 +-
libide/ide-deployer.c | 68 ++------------
libide/ide-diagnostician.c | 43 +++------
libide/ide-diagnostician.h | 5 -
libide/ide-project.c | 2 +-
libide/ide-unsaved-files.c | 8 +-
libide/python/ide-python-indenter.c | 1 -
libide/xml/ide-xml-indenter.c | 3 -
tests/test-ide-back-forward-list.c | 4 -
tools/ide-build.c | 2 +-
tools/ide-list-devices.c | 2 -
tools/ide-list-diagnostics.c | 10 +--
tools/ide-list-file-settings.c | 1 -
26 files changed, 75 insertions(+), 354 deletions(-)
---
diff --git a/libide/c/ide-c-indenter.c b/libide/c/ide-c-indenter.c
index 292c35a..3d93164 100644
--- a/libide/c/ide-c-indenter.c
+++ b/libide/c/ide-c-indenter.c
@@ -1391,7 +1391,6 @@ ide_c_indenter_format (IdeIndenter *indenter,
static void
ide_c_indenter_class_init (IdeCIndenterClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
IdeIndenterClass *indenter_class = IDE_INDENTER_CLASS (klass);
indenter_class->is_trigger = ide_c_indenter_is_trigger;
diff --git a/libide/clang/ide-clang-highlighter.c b/libide/clang/ide-clang-highlighter.c
index f63e949..12bcad1 100644
--- a/libide/clang/ide-clang-highlighter.c
+++ b/libide/clang/ide-clang-highlighter.c
@@ -20,74 +20,16 @@
#include "ide-clang-highlighter.h"
-typedef struct
+struct _IdeClangHighlighter
{
- void *foo;
-} IdeClangHighlighterPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE (IdeClangHighlighter, ide_clang_highlighter,
- IDE_TYPE_HIGHLIGHTER)
-
-enum {
- PROP_0,
- LAST_PROP
+ IdeHighlighter parent_instance;
};
-static GParamSpec *gParamSpecs [LAST_PROP];
-
-IdeClangHighlighter *
-ide_clang_highlighter_new (void)
-{
- return g_object_new (IDE_TYPE_CLANG_HIGHLIGHTER, NULL);
-}
-
-static void
-ide_clang_highlighter_finalize (GObject *object)
-{
- IdeClangHighlighter *self = (IdeClangHighlighter *)object;
- IdeClangHighlighterPrivate *priv = ide_clang_highlighter_get_instance_private (self);
-
- G_OBJECT_CLASS (ide_clang_highlighter_parent_class)->finalize (object);
-}
-
-static void
-ide_clang_highlighter_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- IdeClangHighlighter *self = IDE_CLANG_HIGHLIGHTER (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-ide_clang_highlighter_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- IdeClangHighlighter *self = IDE_CLANG_HIGHLIGHTER (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
+G_DEFINE_TYPE (IdeClangHighlighter, ide_clang_highlighter, IDE_TYPE_HIGHLIGHTER)
static void
ide_clang_highlighter_class_init (IdeClangHighlighterClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = ide_clang_highlighter_finalize;
- object_class->get_property = ide_clang_highlighter_get_property;
- object_class->set_property = ide_clang_highlighter_set_property;
}
static void
diff --git a/libide/clang/ide-clang-highlighter.h b/libide/clang/ide-clang-highlighter.h
index 45ed3e3..b3fc3f9 100644
--- a/libide/clang/ide-clang-highlighter.h
+++ b/libide/clang/ide-clang-highlighter.h
@@ -25,12 +25,8 @@ G_BEGIN_DECLS
#define IDE_TYPE_CLANG_HIGHLIGHTER (ide_clang_highlighter_get_type())
-G_DECLARE_FINAL_TYPE (IdeClangHighlighter, ide_clang_highlighter, IDE, CLANG_HIGHLIGHTER, IdeHighlighter)
-
-struct _IdeClangHighlighter
-{
- IdeHighlighter parent_instance;
-};
+G_DECLARE_FINAL_TYPE (IdeClangHighlighter, ide_clang_highlighter,
+ IDE, CLANG_HIGHLIGHTER, IdeHighlighter)
G_END_DECLS
diff --git a/libide/clang/ide-clang-service.c b/libide/clang/ide-clang-service.c
index 5009561..c72bf24 100644
--- a/libide/clang/ide-clang-service.c
+++ b/libide/clang/ide-clang-service.c
@@ -26,13 +26,15 @@
#include "ide-unsaved-file.h"
#include "ide-unsaved-files.h"
-typedef struct
+struct _IdeClangService
{
+ IdeService parent_instance;
+
GHashTable *cached_units;
GRWLock cached_rwlock;
CXIndex index;
GCancellable *cancellable;
-} IdeClangServicePrivate;
+};
typedef struct
{
@@ -45,15 +47,7 @@ typedef struct
guint options;
} ParseRequest;
-G_DEFINE_TYPE_WITH_PRIVATE (IdeClangService, ide_clang_service,
- IDE_TYPE_SERVICE)
-
-enum {
- PROP_0,
- LAST_PROP
-};
-
-static GParamSpec *gParamSpecs [LAST_PROP];
+G_DEFINE_TYPE (IdeClangService, ide_clang_service, IDE_TYPE_SERVICE)
static void
parse_request_free (gpointer data)
@@ -73,12 +67,11 @@ ide_clang_service_parse_worker (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- IdeClangServicePrivate *priv;
g_autoptr(IdeClangTranslationUnit) ret = NULL;
+ IdeClangService *self = source_object;
CXTranslationUnit tu = NULL;
ParseRequest *request = task_data;
IdeContext *context;
- struct CXUnsavedFile *unsaved_files;
const gchar * const *argv;
gsize argc = 0;
const gchar *detail_error = NULL;
@@ -90,8 +83,6 @@ ide_clang_service_parse_worker (GTask *task,
g_assert (IDE_IS_CLANG_SERVICE (source_object));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
- priv = ide_clang_service_get_instance_private (source_object);
-
ar = g_array_new (FALSE, FALSE, sizeof (struct CXUnsavedFile));
for (i = 0; i < request->unsaved_files->len; i++)
@@ -104,7 +95,7 @@ ide_clang_service_parse_worker (GTask *task,
file = ide_unsaved_file_get_file (iuf);
content = ide_unsaved_file_get_content (iuf);
- uf.Filename = g_file_get_path (ide_unsaved_file_get_file (iuf));
+ uf.Filename = g_file_get_path (file);
uf.Contents = g_bytes_get_data (content, NULL);
uf.Length = g_bytes_get_size (content);
@@ -160,11 +151,11 @@ ide_clang_service_parse_worker (GTask *task,
context = ide_object_get_context (source_object);
ret = _ide_clang_translation_unit_new (context, tu, request->sequence);
- g_rw_lock_writer_lock (&priv->cached_rwlock);
- g_hash_table_replace (priv->cached_units,
+ g_rw_lock_writer_lock (&self->cached_rwlock);
+ g_hash_table_replace (self->cached_units,
g_object_ref (request->file),
g_object_ref (ret));
- g_rw_lock_writer_unlock (&priv->cached_rwlock);
+ g_rw_lock_writer_unlock (&self->cached_rwlock);
g_task_return_pointer (task, g_object_ref (ret), g_object_unref);
@@ -193,7 +184,6 @@ ide_clang_service_get_translation_unit_async (IdeClangService *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- IdeClangServicePrivate *priv = ide_clang_service_get_instance_private (self);
g_autoptr(IdeClangTranslationUnit) cached = NULL;
IdeUnsavedFiles *unsaved_files;
IdeContext *context;
@@ -208,11 +198,11 @@ ide_clang_service_get_translation_unit_async (IdeClangService *self,
context = ide_object_get_context (IDE_OBJECT (self));
unsaved_files = ide_context_get_unsaved_files (context);
- g_rw_lock_reader_lock (&priv->cached_rwlock);
- cached = g_hash_table_lookup (priv->cached_units, file);
+ g_rw_lock_reader_lock (&self->cached_rwlock);
+ cached = g_hash_table_lookup (self->cached_units, file);
if (cached)
g_object_ref (cached);
- g_rw_lock_reader_unlock (&priv->cached_rwlock);
+ g_rw_lock_reader_unlock (&self->cached_rwlock);
if (min_sequence <= 0)
min_sequence = ide_unsaved_files_get_sequence (unsaved_files);
@@ -239,7 +229,7 @@ ide_clang_service_get_translation_unit_async (IdeClangService *self,
request = g_slice_new0 (ParseRequest);
request->file = g_object_ref (file);
- request->index = priv->index;
+ request->index = self->index;
request->source_filename = g_strdup (path);
request->command_line_args = NULL; /* TODO: Get from build system */
request->unsaved_files = ide_unsaved_files_get_unsaved_files (unsaved_files);
@@ -274,16 +264,15 @@ static void
ide_clang_service_start (IdeService *service)
{
IdeClangService *self = (IdeClangService *)service;
- IdeClangServicePrivate *priv = ide_clang_service_get_instance_private (self);
g_return_if_fail (IDE_IS_CLANG_SERVICE (self));
- g_return_if_fail (!priv->index);
+ g_return_if_fail (!self->index);
- g_clear_object (&priv->cancellable);
- priv->cancellable = g_cancellable_new ();
+ g_clear_object (&self->cancellable);
+ self->cancellable = g_cancellable_new ();
- priv->index = clang_createIndex (0, 0);
- clang_CXIndex_setGlobalOptions (priv->index,
+ self->index = clang_createIndex (0, 0);
+ clang_CXIndex_setGlobalOptions (self->index,
CXGlobalOpt_ThreadBackgroundPriorityForAll);
IDE_SERVICE_CLASS (ide_clang_service_parent_class)->start (service);
@@ -293,12 +282,11 @@ static void
ide_clang_service_stop (IdeService *service)
{
IdeClangService *self = (IdeClangService *)service;
- IdeClangServicePrivate *priv = ide_clang_service_get_instance_private (self);
g_return_if_fail (IDE_IS_CLANG_SERVICE (self));
- g_return_if_fail (!priv->index);
+ g_return_if_fail (!self->index);
- g_cancellable_cancel (priv->cancellable);
+ g_cancellable_cancel (self->cancellable);
IDE_SERVICE_CLASS (ide_clang_service_parent_class)->start (service);
}
@@ -307,53 +295,20 @@ static void
ide_clang_service_dispose (GObject *object)
{
IdeClangService *self = (IdeClangService *)object;
- IdeClangServicePrivate *priv = ide_clang_service_get_instance_private (self);
- g_clear_pointer (&priv->index, clang_disposeIndex);
- g_clear_object (&priv->cancellable);
+ g_clear_pointer (&self->index, clang_disposeIndex);
+ g_clear_object (&self->cancellable);
G_OBJECT_CLASS (ide_clang_service_parent_class)->dispose (object);
}
static void
-ide_clang_service_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- IdeClangService *self = IDE_CLANG_SERVICE (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-ide_clang_service_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- IdeClangService *self = IDE_CLANG_SERVICE (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
ide_clang_service_class_init (IdeClangServiceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
IdeServiceClass *service_class = IDE_SERVICE_CLASS (klass);
object_class->dispose = ide_clang_service_dispose;
- object_class->get_property = ide_clang_service_get_property;
- object_class->set_property = ide_clang_service_set_property;
service_class->start = ide_clang_service_start;
service_class->stop = ide_clang_service_stop;
@@ -362,11 +317,9 @@ ide_clang_service_class_init (IdeClangServiceClass *klass)
static void
ide_clang_service_init (IdeClangService *self)
{
- IdeClangServicePrivate *priv = ide_clang_service_get_instance_private (self);
-
- g_rw_lock_init (&priv->cached_rwlock);
+ g_rw_lock_init (&self->cached_rwlock);
- priv->cached_units = g_hash_table_new_full ((GHashFunc)ide_file_hash,
+ self->cached_units = g_hash_table_new_full ((GHashFunc)ide_file_hash,
(GEqualFunc)ide_file_equal,
g_object_unref,
g_object_unref);
diff --git a/libide/clang/ide-clang-service.h b/libide/clang/ide-clang-service.h
index 4d47f4c..8d75d72 100644
--- a/libide/clang/ide-clang-service.h
+++ b/libide/clang/ide-clang-service.h
@@ -27,12 +27,7 @@ G_BEGIN_DECLS
#define IDE_TYPE_CLANG_SERVICE (ide_clang_service_get_type())
-G_DECLARE_DERIVABLE_TYPE (IdeClangService, ide_clang_service, IDE, CLANG_SERVICE, IdeService)
-
-struct _IdeClangServiceClass
-{
- IdeServiceClass parent;
-};
+G_DECLARE_FINAL_TYPE (IdeClangService, ide_clang_service, IDE, CLANG_SERVICE, IdeService)
void ide_clang_service_get_translation_unit_async (IdeClangService *self,
IdeFile *file,
diff --git a/libide/clang/ide-clang-symbol-resolver.c b/libide/clang/ide-clang-symbol-resolver.c
index 5bd49bd..963d60c 100644
--- a/libide/clang/ide-clang-symbol-resolver.c
+++ b/libide/clang/ide-clang-symbol-resolver.c
@@ -18,74 +18,16 @@
#include "ide-clang-symbol-resolver.h"
-typedef struct
+struct _IdeClangSymbolResolver
{
- void *foo;
-} IdeClangSymbolResolverPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE (IdeClangSymbolResolver, ide_clang_symbol_resolver,
- IDE_TYPE_SYMBOL_RESOLVER)
-
-enum {
- PROP_0,
- LAST_PROP
+ IdeSymbolResolver parent_instance;
};
-static GParamSpec *gParamSpecs [LAST_PROP];
-
-IdeClangSymbolResolver *
-ide_clang_symbol_resolver_new (void)
-{
- return g_object_new (IDE_TYPE_CLANG_SYMBOL_RESOLVER, NULL);
-}
-
-static void
-ide_clang_symbol_resolver_finalize (GObject *object)
-{
- IdeClangSymbolResolver *self = (IdeClangSymbolResolver *)object;
- IdeClangSymbolResolverPrivate *priv = ide_clang_symbol_resolver_get_instance_private (self);
-
- G_OBJECT_CLASS (ide_clang_symbol_resolver_parent_class)->finalize (object);
-}
-
-static void
-ide_clang_symbol_resolver_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- IdeClangSymbolResolver *self = IDE_CLANG_SYMBOL_RESOLVER (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-ide_clang_symbol_resolver_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- IdeClangSymbolResolver *self = IDE_CLANG_SYMBOL_RESOLVER (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
+G_DEFINE_TYPE (IdeClangSymbolResolver, ide_clang_symbol_resolver, IDE_TYPE_SYMBOL_RESOLVER)
static void
ide_clang_symbol_resolver_class_init (IdeClangSymbolResolverClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = ide_clang_symbol_resolver_finalize;
- object_class->get_property = ide_clang_symbol_resolver_get_property;
- object_class->set_property = ide_clang_symbol_resolver_set_property;
}
static void
diff --git a/libide/clang/ide-clang-symbol-resolver.h b/libide/clang/ide-clang-symbol-resolver.h
index 819b2c6..5d21000 100644
--- a/libide/clang/ide-clang-symbol-resolver.h
+++ b/libide/clang/ide-clang-symbol-resolver.h
@@ -25,12 +25,8 @@ G_BEGIN_DECLS
#define IDE_TYPE_CLANG_SYMBOL_RESOLVER (ide_clang_symbol_resolver_get_type())
-G_DECLARE_FINAL_TYPE (IdeClangSymbolResolver, ide_clang_symbol_resolver, IDE, CLANG_SYMBOL_RESOLVER,
IdeSymbolResolver)
-
-struct _IdeClangSymbolResolver
-{
- IdeSymbolResolver parent_instance;
-};
+G_DECLARE_FINAL_TYPE (IdeClangSymbolResolver, ide_clang_symbol_resolver,
+ IDE, CLANG_SYMBOL_RESOLVER, IdeSymbolResolver)
G_END_DECLS
diff --git a/libide/clang/ide-clang-translation-unit.c b/libide/clang/ide-clang-translation-unit.c
index 4fe0ade..47446df 100644
--- a/libide/clang/ide-clang-translation-unit.c
+++ b/libide/clang/ide-clang-translation-unit.c
@@ -215,6 +215,8 @@ create_diagnostic (IdeClangTranslationUnit *self,
diag = _ide_diagnostic_new (severity, spelling, loc);
+ num_ranges = clang_getDiagnosticNumRanges (cxdiag);
+
for (i = 0; i < num_ranges; i++)
{
CXSourceRange cxrange;
@@ -277,7 +279,6 @@ ide_clang_translation_unit_get_diagnostics (IdeClangTranslationUnit *self)
{
CXDiagnostic cxdiag;
IdeDiagnostic *diag;
- CXString cxstr;
cxdiag = clang_getDiagnostic (priv->tu, i);
diag = create_diagnostic (self, project, workpath, cxdiag);
diff --git a/libide/editorconfig/ide-editorconfig-file-settings.c
b/libide/editorconfig/ide-editorconfig-file-settings.c
index da6883b..b22b2b7 100644
--- a/libide/editorconfig/ide-editorconfig-file-settings.c
+++ b/libide/editorconfig/ide-editorconfig-file-settings.c
@@ -75,7 +75,6 @@ ide_editorconfig_file_settings_init_worker (GTask *task,
while (g_hash_table_iter_next (&iter, &k, &v))
{
- const gchar *prop_name;
const gchar *key = k;
const GValue *value = v;
diff --git a/libide/gca/ide-gca-diagnostic-provider.c b/libide/gca/ide-gca-diagnostic-provider.c
index bd14884..feda13f 100644
--- a/libide/gca/ide-gca-diagnostic-provider.c
+++ b/libide/gca/ide-gca-diagnostic-provider.c
@@ -190,7 +190,6 @@ get_diag_proxy_cb (GObject *object,
g_autoptr(GTask) task = user_data;
IdeGcaDiagnosticProvider *self;
GcaDiagnostics *proxy;
- DiagnoseState *state;
GError *error = NULL;
const gchar *path;
@@ -198,7 +197,6 @@ get_diag_proxy_cb (GObject *object,
g_assert (G_IS_ASYNC_RESULT (result));
self = g_task_get_source_object (task);
- state = g_task_get_task_data (task);
proxy = gca_diagnostics_proxy_new_finish (result, &error);
diff --git a/libide/git/ide-git-search-index.c b/libide/git/ide-git-search-index.c
index ba8bd5b..9d117f3 100644
--- a/libide/git/ide-git-search-index.c
+++ b/libide/git/ide-git-search-index.c
@@ -57,15 +57,6 @@ enum {
static GParamSpec *gParamSpecs [LAST_PROP];
-static void
-activate_cb (IdeSearchResult *result,
- gpointer user_data)
-{
- g_assert (IDE_IS_SEARCH_RESULT (result));
-
- /* TODO: Hook up document manager in LibIDE */
-}
-
/**
* ide_git_search_index_get_location:
*
@@ -252,7 +243,6 @@ ide_git_search_index_populate (IdeGitSearchIndex *self,
}
}
-cleanup:
g_clear_pointer (&matches, g_array_unref);
g_string_free (str, TRUE);
}
@@ -347,7 +337,6 @@ ide_git_search_index_init_worker (GTask *task,
GgitIndex *index = NULL;
GgitRef *ref;
GError *error = NULL;
- GFile *repository_dir = task_data;
guint count;
guint i;
diff --git a/libide/gjs/ide-gjs-script.cpp b/libide/gjs/ide-gjs-script.cpp
index 9afc943..7ddfd73 100644
--- a/libide/gjs/ide-gjs-script.cpp
+++ b/libide/gjs/ide-gjs-script.cpp
@@ -50,8 +50,8 @@ ide_gjs_script_load (IdeScript *script)
GjsContext *old_current;
g_autoptr(GError) error = NULL;
g_autoptr(gchar) contents = NULL;
- g_autoptr(gchar) path;
- g_autoptr(GFile) parent;
+ g_autoptr(gchar) path = NULL;
+ g_autoptr(GFile) parent = NULL;
gchar **search_path;
GFile *file;
gsize len;
diff --git a/libide/ide-build-result.c b/libide/ide-build-result.c
index 93ef6c3..581958e 100644
--- a/libide/ide-build-result.c
+++ b/libide/ide-build-result.c
@@ -59,7 +59,7 @@ _ide_build_result_open_log (IdeBuildResult *self,
if (fd != -1)
{
- g_autoptr(GFile) file;
+ g_autoptr(GFile) file = NULL;
file = g_file_new_for_path (name_used);
*read_stream = G_INPUT_STREAM (g_file_read (file, NULL, NULL));
@@ -76,7 +76,7 @@ static void
_ide_build_result_log (GOutputStream *stream,
const gchar *message)
{
- g_autoptr(gchar) buffer;
+ g_autoptr(gchar) buffer = NULL;
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
g_return_if_fail (message);
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 7673c7c..9743230 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -679,15 +679,15 @@ ide_context_init_project_name_cb (GObject *object,
if (file_info &&
(G_FILE_TYPE_DIRECTORY == g_file_info_get_file_type (file_info)))
{
- g_autoptr(gchar) name;
+ g_autoptr(gchar) name = NULL;
name = g_file_get_basename (file);
_ide_project_set_name (self->project, name);
}
else
{
- g_autoptr(GFile) parent;
- g_autoptr(gchar) name;
+ g_autoptr(GFile) parent = NULL;
+ g_autoptr(gchar) name = NULL;
parent = g_file_get_parent (file);
name = g_file_get_basename (parent);
diff --git a/libide/ide-deployer.c b/libide/ide-deployer.c
index 95776aa..2e04ec1 100644
--- a/libide/ide-deployer.c
+++ b/libide/ide-deployer.c
@@ -18,73 +18,19 @@
#include "ide-deployer.h"
-typedef struct
-{
- void *foo;
-} IdeDeployerPrivate;
-
G_DEFINE_ABSTRACT_TYPE (IdeDeployer, ide_deployer, IDE_TYPE_OBJECT)
-enum {
- PROP_0,
- LAST_PROP
-};
-
-static GParamSpec *gParamSpecs [LAST_PROP];
-
-IdeDeployer *
-ide_deployer_new (void)
-{
- return g_object_new (IDE_TYPE_DEPLOYER, NULL);
-}
-
-static void
-ide_deployer_finalize (GObject *object)
-{
- IdeDeployer *self = (IdeDeployer *)object;
- IdeDeployerPrivate *priv = ide_deployer_get_instance_private (self);
-
- G_OBJECT_CLASS (ide_deployer_parent_class)->finalize (object);
-}
-
-static void
-ide_deployer_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- IdeDeployer *self = IDE_DEPLOYER (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-ide_deployer_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- IdeDeployer *self = IDE_DEPLOYER (object);
-
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
+/*
+ * TODO:
+ *
+ * This class is the base class for the code that will deploy a project to the
+ * device where it can run. Locally, this might be a make install. On a remote
+ * device it might be a combination of things.
+ */
static void
ide_deployer_class_init (IdeDeployerClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = ide_deployer_finalize;
- object_class->get_property = ide_deployer_get_property;
- object_class->set_property = ide_deployer_set_property;
}
static void
diff --git a/libide/ide-diagnostician.c b/libide/ide-diagnostician.c
index 39accb3..d5c8014 100644
--- a/libide/ide-diagnostician.c
+++ b/libide/ide-diagnostician.c
@@ -24,10 +24,12 @@
#include "ide-file.h"
#include "ide-internal.h"
-typedef struct
+struct _IdeDiagnostician
{
+ IdeObject parent_instance;
+
GPtrArray *providers;
-} IdeDiagnosticianPrivate;
+};
typedef struct
{
@@ -36,15 +38,7 @@ typedef struct
guint active;
} DiagnoseState;
-G_DEFINE_TYPE_WITH_PRIVATE (IdeDiagnostician, ide_diagnostician,
- IDE_TYPE_OBJECT)
-
-enum {
- PROP_0,
- LAST_PROP
-};
-
-static GParamSpec *gParamSpecs [LAST_PROP];
+G_DEFINE_TYPE (IdeDiagnostician, ide_diagnostician, IDE_TYPE_OBJECT)
static void
diagnose_state_free (gpointer data)
@@ -62,24 +56,20 @@ void
_ide_diagnostician_add_provider (IdeDiagnostician *self,
IdeDiagnosticProvider *provider)
{
- IdeDiagnosticianPrivate *priv = ide_diagnostician_get_instance_private (self);
-
g_return_if_fail (IDE_IS_DIAGNOSTICIAN (self));
g_return_if_fail (IDE_IS_DIAGNOSTIC_PROVIDER (provider));
- g_ptr_array_add (priv->providers, g_object_ref (provider));
+ g_ptr_array_add (self->providers, g_object_ref (provider));
}
void
_ide_diagnostician_remove_provider (IdeDiagnostician *self,
IdeDiagnosticProvider *provider)
{
- IdeDiagnosticianPrivate *priv = ide_diagnostician_get_instance_private (self);
-
g_return_if_fail (IDE_IS_DIAGNOSTICIAN (self));
g_return_if_fail (IDE_IS_DIAGNOSTIC_PROVIDER (provider));
- g_ptr_array_remove (priv->providers, provider);
+ g_ptr_array_remove (self->providers, provider);
}
static void
@@ -127,7 +117,6 @@ ide_diagnostician_diagnose_async (IdeDiagnostician *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- IdeDiagnosticianPrivate *priv = ide_diagnostician_get_instance_private (self);
DiagnoseState *state;
g_autoptr(GTask) task = NULL;
gsize i;
@@ -138,7 +127,7 @@ ide_diagnostician_diagnose_async (IdeDiagnostician *self,
task = g_task_new (self, cancellable, callback, user_data);
- if (!priv->providers->len)
+ if (!self->providers->len)
{
g_task_return_pointer (task,
_ide_diagnostics_new (NULL),
@@ -147,16 +136,17 @@ ide_diagnostician_diagnose_async (IdeDiagnostician *self,
}
state = g_slice_new0 (DiagnoseState);
- state->active = priv->providers->len;
- state->total = priv->providers->len;
+ state->active = self->providers->len;
+ state->total = self->providers->len;
state->diagnostics = _ide_diagnostics_new (NULL);
g_task_set_task_data (task, state, diagnose_state_free);
- for (i = 0; i < priv->providers->len; i++)
+ for (i = 0; i < self->providers->len; i++)
{
- IdeDiagnosticProvider *provider = g_ptr_array_index (priv->providers, i);
+ IdeDiagnosticProvider *provider;
+ provider = g_ptr_array_index (self->providers, i);
ide_diagnostic_provider_diagnose_async (provider,
file,
cancellable,
@@ -181,9 +171,8 @@ static void
ide_diagnostician_dispose (GObject *object)
{
IdeDiagnostician *self = (IdeDiagnostician *)object;
- IdeDiagnosticianPrivate *priv = ide_diagnostician_get_instance_private (self);
- g_clear_pointer (&priv->providers, g_ptr_array_unref);
+ g_clear_pointer (&self->providers, g_ptr_array_unref);
G_OBJECT_CLASS (ide_diagnostician_parent_class)->dispose (object);
}
@@ -199,7 +188,5 @@ ide_diagnostician_class_init (IdeDiagnosticianClass *klass)
static void
ide_diagnostician_init (IdeDiagnostician *self)
{
- IdeDiagnosticianPrivate *priv = ide_diagnostician_get_instance_private (self);
-
- priv->providers = g_ptr_array_new_with_free_func (g_object_unref);
+ self->providers = g_ptr_array_new_with_free_func (g_object_unref);
}
diff --git a/libide/ide-diagnostician.h b/libide/ide-diagnostician.h
index f23f492..a55ca5e 100644
--- a/libide/ide-diagnostician.h
+++ b/libide/ide-diagnostician.h
@@ -27,11 +27,6 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (IdeDiagnostician, ide_diagnostician, IDE, DIAGNOSTICIAN, IdeObject)
-struct _IdeDiagnostician
-{
- IdeObject parent_instance;
-};
-
void ide_diagnostician_diagnose_async (IdeDiagnostician *diagnostician,
IdeFile *file,
GCancellable *cancellable,
diff --git a/libide/ide-project.c b/libide/ide-project.c
index f5f3e62..66d3d22 100644
--- a/libide/ide-project.c
+++ b/libide/ide-project.c
@@ -180,7 +180,7 @@ ide_project_get_file_for_path (IdeProject *self,
IdeProjectItem *root;
GSequenceIter *iter;
GSequence *children;
- IdeFile *file;
+ IdeFile *file = NULL;
g_return_val_if_fail (IDE_IS_PROJECT (self), NULL);
g_return_val_if_fail (path, NULL);
diff --git a/libide/ide-unsaved-files.c b/libide/ide-unsaved-files.c
index 228bbe2..9d5832a 100644
--- a/libide/ide-unsaved-files.c
+++ b/libide/ide-unsaved-files.c
@@ -212,7 +212,7 @@ ide_unsaved_files_save_async (IdeUnsavedFiles *files,
gpointer user_data)
{
IdeUnsavedFilesPrivate *priv;
- g_autoptr(GTask) task;
+ g_autoptr(GTask) task = NULL;
AsyncState *state;
gsize i;
@@ -326,7 +326,7 @@ ide_unsaved_files_restore_async (IdeUnsavedFiles *files,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_autoptr(GTask) task;
+ g_autoptr(GTask) task = NULL;
AsyncState *state;
g_return_if_fail (IDE_IS_UNSAVED_FILES (files));
@@ -553,15 +553,13 @@ ide_unsaved_files_get_unsaved_file (IdeUnsavedFiles *self,
for (i = 0; i < priv->unsaved_files->len; i++)
{
- IdeUnsavedFile *item;
UnsavedFile *uf;
uf = g_ptr_array_index (priv->unsaved_files, i);
if (g_file_equal (uf->file, file))
{
- ret = _ide_unsaved_file_new (uf->file, uf->content, uf->temp_path,
- uf->sequence);
+ ret = _ide_unsaved_file_new (uf->file, uf->content, uf->temp_path, uf->sequence);
break;
}
}
diff --git a/libide/python/ide-python-indenter.c b/libide/python/ide-python-indenter.c
index 7bab004..19408c1 100644
--- a/libide/python/ide-python-indenter.c
+++ b/libide/python/ide-python-indenter.c
@@ -586,7 +586,6 @@ ide_python_indenter_format (IdeIndenter *indenter,
GdkEventKey *event)
{
IdePythonIndenter *python = (IdePythonIndenter *)indenter;
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
GtkTextIter iter = *begin;
gunichar ch;
gint line;
diff --git a/libide/xml/ide-xml-indenter.c b/libide/xml/ide-xml-indenter.c
index 88ae18d..66b2c9b 100644
--- a/libide/xml/ide-xml-indenter.c
+++ b/libide/xml/ide-xml-indenter.c
@@ -378,14 +378,11 @@ ide_xml_indenter_format (IdeIndenter *indenter,
GdkEventKey *trigger)
{
IdeXmlIndenter *xml = (IdeXmlIndenter *)indenter;
- GtkTextBuffer *buffer;
guint tab_width = 2;
gint indent_width = -1;
g_return_val_if_fail (IDE_IS_XML_INDENTER (xml), NULL);
- buffer = gtk_text_view_get_buffer (view);
-
*cursor_offset = 0;
if (GTK_SOURCE_IS_VIEW (view))
diff --git a/tests/test-ide-back-forward-list.c b/tests/test-ide-back-forward-list.c
index 9a52ed6..04927ed 100644
--- a/tests/test-ide-back-forward-list.c
+++ b/tests/test-ide-back-forward-list.c
@@ -36,10 +36,6 @@ parse_item (test_state_t *state,
IdeFile *file;
gchar **parts;
GFile *gfile;
- gsize i;
- guint offset;
- guint line;
- guint line_offset;
parts = g_strsplit (str, " ", 0);
diff --git a/tools/ide-build.c b/tools/ide-build.c
index 6dff089..3a4706b 100644
--- a/tools/ide-build.c
+++ b/tools/ide-build.c
@@ -169,7 +169,7 @@ print_build_info (IdeContext *context,
const gchar *build_system_name;
const gchar *device_id;
const gchar *system_type;
- g_autoptr(gchar) build_date;
+ g_autoptr(gchar) build_date = NULL;
GTimeVal tv;
project = ide_context_get_project (context);
diff --git a/tools/ide-list-devices.c b/tools/ide-list-devices.c
index 1402dd3..56252ee 100644
--- a/tools/ide-list-devices.c
+++ b/tools/ide-list-devices.c
@@ -69,8 +69,6 @@ context_cb (GObject *object,
g_autoptr(IdeContext) context = NULL;
g_autoptr(GError) error = NULL;
IdeDeviceManager *device_manager;
- IdeProjectItem *root;
- IdeProject *project;
context = ide_context_new_finish (result, &error);
diff --git a/tools/ide-list-diagnostics.c b/tools/ide-list-diagnostics.c
index 2b1eff2..5411b91 100644
--- a/tools/ide-list-diagnostics.c
+++ b/tools/ide-list-diagnostics.c
@@ -93,11 +93,11 @@ print_diagnostic (IdeDiagnostic *diag)
g_autoptr(gchar) path = NULL;
IdeDiagnosticSeverity severity;
GFile *gfile;
- gsize i;
gsize num_ranges;
guint line;
guint column;
g_autoptr(gchar) linestr = NULL;
+ gsize i;
text = ide_diagnostic_get_text (diag);
num_ranges = ide_diagnostic_get_num_ranges (diag);
@@ -138,9 +138,9 @@ print_diagnostic (IdeDiagnostic *diag)
g_print ("^\n");
}
-#if 0
for (i = 0; i < num_ranges; i++)
{
+#if 0
IdeSourceRange *range;
IdeSourceLocation *begin;
IdeSourceLocation *end;
@@ -160,11 +160,8 @@ print_diagnostic (IdeDiagnostic *diag)
path = ide_file_get_path (file);
g_print ("%s:%u:%u\n", path, line+1, column+1);
- }
-
- if (!num_ranges)
- g_print (">> %s\n", text);
#endif
+ }
}
static void
@@ -219,7 +216,6 @@ context_cb (GObject *object,
g_autoptr(IdeContext) context = NULL;
g_autoptr(GError) error = NULL;
IdeDiagnostician *diagnostician;
- IdeProjectItem *root;
IdeLanguage *language;
IdeProject *project;
IdeFile *file;
diff --git a/tools/ide-list-file-settings.c b/tools/ide-list-file-settings.c
index d6c8a58..51b7c84 100644
--- a/tools/ide-list-file-settings.c
+++ b/tools/ide-list-file-settings.c
@@ -76,7 +76,6 @@ load_settings_cb (GObject *object,
IdeFileSettings *settings;
IdeFile *file = (IdeFile *)object;
GError *error = NULL;
- gint exit_code = EXIT_SUCCESS;
settings = ide_file_load_settings_finish (file, result, &error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]