aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2023-06-30 08:08:39 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2023-06-30 08:12:07 +0900
commit48464a5be29e8f0e846f3dce9ab784ce6c48ec29 (patch)
tree746ea31a70262a583eaa11e40ef0588284deeb65
parentee23d4fe86527dc4a50ddcdb742ae72f9aebd456 (diff)
downloadlibhinawa-48464a5be29e8f0e846f3dce9ab784ce6c48ec29.tar.gz
cycle_time: constify self parameter when retrieving parameter
In the most methods of Hinawa.CycleTime, the instance is immutable. This commit adds const qualifier to express it. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--src/cycle_time.c10
-rw-r--r--src/cycle_time.h11
2 files changed, 11 insertions, 10 deletions
diff --git a/src/cycle_time.c b/src/cycle_time.c
index 637721e..3a12697 100644
--- a/src/cycle_time.c
+++ b/src/cycle_time.c
@@ -48,7 +48,7 @@ HinawaCycleTime *hinawa_cycle_time_new()
*
* Since: 2.6.
*/
-void hinawa_cycle_time_get_system_time(HinawaCycleTime *self, gint64 *tv_sec, gint32 *tv_nsec)
+void hinawa_cycle_time_get_system_time(const HinawaCycleTime *self, gint64 *tv_sec, gint32 *tv_nsec)
{
*tv_sec = self->tv_sec;
*tv_nsec = self->tv_nsec;
@@ -65,7 +65,7 @@ void hinawa_cycle_time_get_system_time(HinawaCycleTime *self, gint64 *tv_sec, gi
*
* Since: 2.6.
*/
-void hinawa_cycle_time_get_clock_id(HinawaCycleTime *self, gint *clock_id)
+void hinawa_cycle_time_get_clock_id(const HinawaCycleTime *self, gint *clock_id)
{
*clock_id = self->clk_id;
}
@@ -103,7 +103,7 @@ static guint ieee1394_cycle_time_to_offset(guint32 cycle_time)
*
* Since: 2.6.
*/
-void hinawa_cycle_time_get_fields(HinawaCycleTime *self, guint16 cycle_time[3])
+void hinawa_cycle_time_get_fields(const HinawaCycleTime *self, guint16 cycle_time[3])
{
cycle_time[0] = ieee1394_cycle_time_to_sec(self->cycle_timer);
cycle_time[1] = ieee1394_cycle_time_to_cycle(self->cycle_timer);
@@ -119,7 +119,7 @@ void hinawa_cycle_time_get_fields(HinawaCycleTime *self, guint16 cycle_time[3])
*
* Since: 2.6.
*/
-void hinawa_cycle_time_get_raw(HinawaCycleTime *self, guint32 *raw)
+void hinawa_cycle_time_get_raw(const HinawaCycleTime *self, guint32 *raw)
{
*raw = self->cycle_timer;
}
@@ -149,7 +149,7 @@ void hinawa_cycle_time_get_raw(HinawaCycleTime *self, guint32 *raw)
*
* Since: 2.6
*/
-void hinawa_cycle_time_compute_tstamp(HinawaCycleTime *self, guint tstamp, guint **isoc_cycle)
+void hinawa_cycle_time_compute_tstamp(const HinawaCycleTime *self, guint tstamp, guint **isoc_cycle)
{
guint tstamp_sec_low = (tstamp & OHCI1394_TSTAMP_SEC_MASK) >> OHCI1394_TSTAMP_SEC_SHIFT;
guint curr_sec_low = ieee1394_cycle_time_to_sec(self->cycle_timer) & 0x7;
diff --git a/src/cycle_time.h b/src/cycle_time.h
index 785405b..e01ca3d 100644
--- a/src/cycle_time.h
+++ b/src/cycle_time.h
@@ -14,15 +14,16 @@ GType hinawa_cycle_time_get_type() G_GNUC_CONST;
HinawaCycleTime *hinawa_cycle_time_new();
-void hinawa_cycle_time_get_system_time(HinawaCycleTime *self, gint64 *tv_sec, gint32 *tv_nsec);
+void hinawa_cycle_time_get_system_time(const HinawaCycleTime *self, gint64 *tv_sec,
+ gint32 *tv_nsec);
-void hinawa_cycle_time_get_clock_id(HinawaCycleTime *self, gint *clock_id);
+void hinawa_cycle_time_get_clock_id(const HinawaCycleTime *self, gint *clock_id);
-void hinawa_cycle_time_get_fields(HinawaCycleTime *self, guint16 cycle_time[3]);
+void hinawa_cycle_time_get_fields(const HinawaCycleTime *self, guint16 cycle_time[3]);
-void hinawa_cycle_time_get_raw(HinawaCycleTime *self, guint32 *raw);
+void hinawa_cycle_time_get_raw(const HinawaCycleTime *self, guint32 *raw);
-void hinawa_cycle_time_compute_tstamp(HinawaCycleTime *self, guint tstamp, guint **isoc_cycle);
+void hinawa_cycle_time_compute_tstamp(const HinawaCycleTime *self, guint tstamp, guint **isoc_cycle);
void hinawa_cycle_time_parse_tstamp(guint tstamp, guint **isoc_cycle);