Hi again Sean!

I'm sorry it took so long, but I finally was able to test your patch:

Am Mittwoch, den 30.03.2011, 13:44 -0400 schrieb Sean McNamara:
> FYI, this page is an absolute lifesaver:
> http://live.gnome.org/Vala/Manual/Attributes#CCode_Attribute

Thanks, that's *very* helpful!

> With the attached patch, I get:
> 
> $ valac --pkg=libpulse --vapidir=/usr/share/vala-0.12/vapi test2.vala
> test2.vala:2.16-2.40: warning: field `MyClass.map' never used
>                PulseAudio.ChannelMap map;
>                ^^^^^^^^^^^^^^^^^^^^^^^^^
> Compilation succeeded - 1 warning(s)

Hmm, with the current upstream version (which contains your patch) I get
this:

        $ cat Test.vala 
        class Test : Object {
                PulseAudio.ChannelMap map;
                public static void main(){
                }
        }
        $ valac-0.12 --pkg=libpulse --vapidir=. Test.vala 
        Test.vala:2.2-2.26: warning: field `Test.map' never used
                PulseAudio.ChannelMap map;
                ^^^^^^^^^^^^^^^^^^^^^^^^^
        /home/alexander/Test.vala.c: In function 
‘pulse_audio_channel_map_destroy’:
        /home/alexander/Test.vala.c:50: error: incompatible types when 
assigning to type ‘enum pa_channel_position_t[32]’ from type ‘void *’
        error: cc exited with status 256
        Compilation failed: 1 error(s), 1 warning(s)
        $ 

The attached patch fixes the issue for me:

        $ valac-0.12 --pkg=libpulse --vapidir=. Test.vala 
        Test.vala:2.2-2.26: warning: field `Test.map' never used
                PulseAudio.ChannelMap map;
                ^^^^^^^^^^^^^^^^^^^^^^^^^
        Compilation succeeded - 1 warning(s)
        $

However, I'm not quite certain whether this is the correct solution,
since I means hardcoding the array size (constants are not supported).

What do you think? Does the current upstream libpulse.vapi file really
work for you w/o modifications?

Best regards

Alexander Kurtz
--- libpulse.vapi.old	2011-04-05 12:24:12.000000000 +0200
+++ libpulse.vapi	2011-04-14 13:42:36.773584634 +0200
@@ -376,7 +376,7 @@
         [CCode (cname="pa_channel_map",has_destroy_function=false)]
         public struct ChannelMap {
                 public uint8 channels;
-                public ChannelPosition map[];
+                public ChannelPosition map[32];
 
                 [CCode (cname="PA_CHANNEL_MAP_SNPRINT_MAX")]
                 public static const size_t SNPRINT_MAX;

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to