~binli/ubuntu/vivid/pulseaudio/fix-atoi

« back to all changes in this revision

Viewing changes to debian/patches/0406-tagstruct-add-copy-method.patch

  • Committer: Bin Li
  • Date: 2016-07-05 03:39:49 UTC
  • Revision ID: bin.li@canonical.com-20160705033949-rz4p9x4hbi2danxk
first version based on pulseaudio_6.0-0ubuntu9.27

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 21dee4b1b96e100d77ab9412c721e3b410e570b2 Mon Sep 17 00:00:00 2001
 
2
From: Wim Taymans <wim.taymans@gmail.com>
 
3
Date: Tue, 7 Apr 2015 17:13:13 +0200
 
4
Subject: [PATCH 1/5] tagstruct: add copy method
 
5
 
 
6
Add a method to copy a tagstruct. This will also reset the read pointer
 
7
back to the beginning.
 
8
---
 
9
 src/pulsecore/tagstruct.c | 13 +++++++++++++
 
10
 src/pulsecore/tagstruct.h |  2 ++
 
11
 2 files changed, 15 insertions(+)
 
12
 
 
13
diff --git a/src/pulsecore/tagstruct.c b/src/pulsecore/tagstruct.c
 
14
index 8a29957..c29e49b 100644
 
15
--- a/src/pulsecore/tagstruct.c
 
16
+++ b/src/pulsecore/tagstruct.c
 
17
@@ -97,6 +97,19 @@ void pa_tagstruct_free(pa_tagstruct*t) {
 
18
         pa_xfree(t);
 
19
 }
 
20
 
 
21
+pa_tagstruct *pa_tagstruct_copy(pa_tagstruct*t) {
 
22
+    pa_tagstruct*tc;
 
23
+
 
24
+    if (!(tc = pa_flist_pop(PA_STATIC_FLIST_GET(tagstructs))))
 
25
+        tc = pa_xnew(pa_tagstruct, 1);
 
26
+    tc->data = pa_xmemdup(t->data, t->length);
 
27
+    tc->allocated = t->length;
 
28
+    tc->rindex = 0;
 
29
+    tc->type = PA_TAGSTRUCT_DYNAMIC;
 
30
+
 
31
+    return tc;
 
32
+}
 
33
+
 
34
 static inline void extend(pa_tagstruct*t, size_t l) {
 
35
     pa_assert(t);
 
36
     pa_assert(t->type != PA_TAGSTRUCT_FIXED);
 
37
diff --git a/src/pulsecore/tagstruct.h b/src/pulsecore/tagstruct.h
 
38
index 348c65d..e648d75 100644
 
39
--- a/src/pulsecore/tagstruct.h
 
40
+++ b/src/pulsecore/tagstruct.h
 
41
@@ -64,6 +64,8 @@ pa_tagstruct *pa_tagstruct_new(void);
 
42
 pa_tagstruct *pa_tagstruct_new_fixed(const uint8_t* data, size_t length);
 
43
 void pa_tagstruct_free(pa_tagstruct*t);
 
44
 
 
45
+pa_tagstruct *pa_tagstruct_copy(pa_tagstruct*t);
 
46
+
 
47
 int pa_tagstruct_eof(pa_tagstruct*t);
 
48
 const uint8_t* pa_tagstruct_data(pa_tagstruct*t, size_t *l);
 
49
 
 
50
-- 
 
51
2.1.4
 
52