contrib/vcdimager/resurrect_library_symbols.patch
2019-03-05 18:34:24 +11:00

96 lines
2.6 KiB
Diff

Description: Resurrect symbols in libvcdinfo
The library with SONAME libvcdinfo.so.0 used to have symbols vcdinfo_msf2lba,
vcdinfo_lba2msf, vcdinfo_msf2lsn and _vcd_malloc; resurrect them not to break
the ABI.
Author: Nicolas Boullis <nboullis@debian.org>
https://sources.debian.org/data/main/v/vcdimager/2.0.1+dfsg-3/debian/patches/resurrect_library_symbols
Index: b/lib/info.c
===================================================================
--- a/lib/info.c
+++ b/lib/info.c
@@ -1640,6 +1640,48 @@ vcdinfo_inc_msf (uint8_t *p_min, uint8_t
}
}
+/*!
+ Convert minutes, seconds and frame (MSF components) into a
+ logical block address (or LBA).
+ See also cdio_msf_to_lba which uses msf_t as its single parameter.
+*/
+#undef vcdinfo_msf2lba
+lba_t
+vcdinfo_msf2lba (uint8_t min, uint8_t sec, int8_t frame)
+{
+ return CDIO_CD_FRAMES_PER_SEC*(CDIO_CD_SECS_PER_MIN*min + sec) + frame;
+}
+
+/*!
+ Convert minutes, seconds and frame (MSF components) into a
+ logical block address (or LBA).
+ See also cdio_msf_to_lba which uses msf_t as its single parameter.
+*/
+void
+vcdinfo_lba2msf (lba_t lba, uint8_t *p_min, uint8_t *p_sec, uint8_t *p_frame)
+{
+ *p_min = lba / (60*75);
+ lba %= (60*75);
+ *p_sec = lba / 75;
+ *p_frame = lba % 75;
+}
+
+/*!
+ Convert minutes, seconds and frame (MSF components) into a
+ logical sector number (or LSN).
+*/
+lsn_t
+vcdinfo_msf2lsn (uint8_t min, uint8_t sec, int8_t frame)
+{
+ lba_t lba=75*(60*min + sec) + frame;
+ if (lba < CDIO_PREGAP_SECTORS) {
+ vcd_error ("lba (%u) less than pregap sector (%u)",
+ (unsigned int) lba, CDIO_PREGAP_SECTORS);
+ return lba;
+ }
+ return lba - CDIO_PREGAP_SECTORS;
+}
+
const char *
vcdinfo_ofs2str (const vcdinfo_obj_t *p_obj, unsigned int offset, bool ext)
{
Index: b/lib/util.c
===================================================================
--- a/lib/util.c
+++ b/lib/util.c
@@ -119,6 +119,18 @@ _vcd_strsplit(const char str[], char del
}
void *
+_vcd_malloc (size_t size)
+{
+ void *new_mem = malloc (size);
+
+ vcd_assert (new_mem != NULL);
+
+ memset (new_mem, 0, size);
+
+ return new_mem;
+}
+
+void *
_vcd_memdup (const void *mem, size_t count)
{
void *new_mem = NULL;
Index: b/include/libvcd/info.h
===================================================================
--- a/include/libvcd/info.h
+++ b/include/libvcd/info.h
@@ -752,7 +752,7 @@ extern "C" {
See also msf_to_lba which uses msf_t as its single parameter.
*/
void
- vcdinfo_lba2msf (lba_t lba, uint8_t *min, uint8_t *sec, uint8_t *frame);
+ vcdinfo_lba2msf (lba_t lba, uint8_t *p_min, uint8_t *p_sec, uint8_t *p_frame);
/*!
Get the item id for a given list ID.