Author: abrander
Date: 2010-01-26 23:34:18 +0100 (Tue, 26 Jan 2010)
New Revision: 3086
Modified:
branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c
branches/rawstudio-ng-color/librawstudio/rs-dcp-file.c
branches/rawstudio-ng-color/librawstudio/rs-dcp-file.h
Log:
Changed rs_dcp_get_id() to return const.
Modified: branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c 2010-01-26
21:45:22 UTC (rev 3085)
+++ branches/rawstudio-ng-color/librawstudio/rs-dcp-factory.c 2010-01-26
22:34:18 UTC (rev 3086)
@@ -120,7 +120,7 @@
{
RSDcpFile *dcp = RS_DCP_FILE(node->data);
- gchar* dcp_id = rs_dcp_get_id(dcp);
+ const gchar *dcp_id = rs_dcp_get_id(dcp);
if (g_str_equal(id, dcp_id))
{
@@ -128,8 +128,6 @@
g_warning("WARNING: Duplicate profiles detected
in file: %s, for %s, named:%s.\nUnsing last found profile.",
rs_tiff_get_filename_nopath(RS_TIFF(dcp)), rs_dcp_file_get_model(dcp),
rs_dcp_file_get_name(dcp));
ret = dcp;
}
-
- g_free(dcp_id);
}
return ret;
Modified: branches/rawstudio-ng-color/librawstudio/rs-dcp-file.c
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-dcp-file.c 2010-01-26
21:45:22 UTC (rev 3085)
+++ branches/rawstudio-ng-color/librawstudio/rs-dcp-file.c 2010-01-26
22:34:18 UTC (rev 3086)
@@ -27,6 +27,7 @@
gchar *signature;
gchar *name;
gchar *copyright;
+ gchar *id;
};
static gboolean read_file_header(RSTiff *tiff);
@@ -46,6 +47,7 @@
g_free(dcp_file->signature);
g_free(dcp_file->name);
g_free(dcp_file->copyright);
+ g_free(dcp_file->id);
}
G_OBJECT_CLASS(rs_dcp_file_parent_class)->dispose(object);
@@ -305,19 +307,24 @@
return rs_huesat_map_new_from_dcp(RS_TIFF(dcp_file), 0, 0xc725, 0xc726);
}
-gchar*
+const gchar *
rs_dcp_get_id(RSDcpFile *dcp_file)
{
- const gchar* dcp_filename =
rs_tiff_get_filename_nopath(RS_TIFF(dcp_file));
- const gchar* dcp_model = rs_dcp_file_get_model(dcp_file);
- const gchar* dcp_name = rs_dcp_file_get_name(dcp_file);
+ g_assert(RS_IS_DCP_FILE(dcp_file));
+
+ if (dcp_file->id)
+ return dcp_file->id;
+
+ const gchar *dcp_filename =
rs_tiff_get_filename_nopath(RS_TIFF(dcp_file));
+ const gchar *dcp_model = rs_dcp_file_get_model(dcp_file);
+ const gchar *dcp_name = rs_dcp_file_get_name(dcp_file);
/* Concat all three elements */
gchar *id = g_strconcat(dcp_filename, dcp_model, dcp_name, NULL);
/* Convert to lower case to eliminate case mismatches */
- gchar *id_return = g_ascii_strdown(id, -1);
+ dcp_file->id = g_ascii_strdown(id, -1);
g_free(id);
- return id_return;
+ return dcp_file->id;
}
Modified: branches/rawstudio-ng-color/librawstudio/rs-dcp-file.h
===================================================================
--- branches/rawstudio-ng-color/librawstudio/rs-dcp-file.h 2010-01-26
21:45:22 UTC (rev 3085)
+++ branches/rawstudio-ng-color/librawstudio/rs-dcp-file.h 2010-01-26
22:34:18 UTC (rev 3086)
@@ -73,8 +73,7 @@
RSHuesatMap *rs_dcp_file_get_looktable(RSDcpFile *dcp_file);
/* Returns a generated (hopefully) unique id, that should make it possible to
find this profile again */
-/* returned result must be free using g_free() */
-gchar* rs_dcp_get_id(RSDcpFile *dcp_file);
+const gchar *rs_dcp_get_id(RSDcpFile *dcp_file);
G_END_DECLS
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit