Package: vcdimager / 0.7.24+dfsg-0.2

resurrect_library_symbols Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Description: Ressurect 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>
--- a/lib/info.c
+++ b/lib/info.c
@@ -1628,6 +1628,48 @@
   }
 }
 
+/*!
+  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)
 {
--- a/lib/util.c
+++ b/lib/util.c
@@ -123,6 +123,18 @@
 }
 
 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;
--- a/include/libvcd/info.h
+++ b/include/libvcd/info.h
@@ -734,7 +734,7 @@
     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.