Skip to content
Newer
Older
100644 72 lines (59 sloc) 3.25 KB
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
1 /*
2 +----------------------------------------------------------------------+
3 | All rights reserved |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions |
7 | are met: |
8 | |
9 | 1. Redistributions of source code must retain the above copyright |
10 | notice, this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in |
13 | the documentation and/or other materials provided with the |
14 | distribution. |
15 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
19 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
20 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
25 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
26 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
27 | POSSIBILITY OF SUCH DAMAGE. |
28 +----------------------------------------------------------------------+
29 | Authors: David Soria Parra <dsp@php.net> |
30 +----------------------------------------------------------------------+
31 */
32
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
33 #include "php_ktaglib.h"
34 #include "ktaglibrary.h"
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
35
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
36 PHPAPI zend_class_entry * ktaglib_ce_ID3v2_Frame = NULL;
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
37
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
38 PHP_METHOD(KTaglib_ID3v2_Frame, getSize)
d38f5db @dsp Add getSize method
authored Apr 15, 2008
39 {
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
40 ze_ktaglib_object *intern = NULL;
d38f5db @dsp Add getSize method
authored Apr 15, 2008
41
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
42 intern = (ze_ktaglib_object*) zend_object_store_get_object(getThis() TSRMLS_CC);
d38f5db @dsp Add getSize method
authored Apr 15, 2008
43
44 RETURN_LONG(((TagLib::ID3v2::Frame *) intern->frame)->size());
45 }
46
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
47 PHP_METHOD(KTaglib_ID3v2_Frame, __toString)
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
48 {
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
49 ze_ktaglib_object *intern = NULL;
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
50
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
51 intern = (ze_ktaglib_object*) zend_object_store_get_object(getThis() TSRMLS_CC);
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
52
ea64394 Use estrdup instead of strdup and don't clone strings
Mikko Koppanen authored May 14, 2008
53 char* str = estrdup((char*) ((TagLib::ID3v2::Frame *) intern->frame)->toString().toCString());
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
54
ea64394 Use estrdup instead of strdup and don't clone strings
Mikko Koppanen authored May 14, 2008
55 RETURN_STRING(str, 0);
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
56 }
57
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
58 static zend_function_entry KTaglib_ID3v2_Frame_methods[] = {
59 PHP_ME(KTaglib_ID3v2_Frame, __toString, NULL, ZEND_ACC_PUBLIC)
60 PHP_ME(KTaglib_ID3v2_Frame, getSize, NULL, ZEND_ACC_PUBLIC)
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
61 { NULL, NULL, NULL }
62 };
63
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
64 void ktaglib_init_KTaglib_ID3v2_Frame(void)
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
65 {
66 zend_class_entry ce;
67
2f5ffbb @dsp Rename taglib to ktaglib
authored Aug 1, 2008
68 INIT_CLASS_ENTRY(ce, "KTaglib_ID3v2_Frame", KTaglib_ID3v2_Frame_methods);
69 ce.create_object = ktaglib_init_KTaglib_new;
70 ktaglib_ce_ID3v2_Frame = zend_register_internal_class(&ce TSRMLS_CC);
e53f0e9 @dsp Initial version of ext/taglib
authored Apr 8, 2008
71 }
Something went wrong with that request. Please try again.