[Vala] string.to_double



Dear friends,

I can not find any way to make it work.
It keeps reporting can not pass an owned object to an unowned object
stuff:

       protected override void from_string(string str){
            weak string s = str;
            weak string end_ptr = null;
            int dimensions = 0;
            while(true) {
                s.to_double(out end_ptr);
                if((void*) s == (void*) end_ptr) break;
                s = end_ptr;
                dimensions ++ ;
            }
            this.dimensions = dimensions;
            s = str;
            for(int i = 0; i< dimensions; i++){
                positions[i] = s.to_double(out s);
                dimensions ++ ;
            }
        }


If I remove the weak prefix, the compiler will leave me with a lot of
'strdup's. If I add a weak prefix in glib-2.0.vapi, vala can produce
good code.

Shouldn't the end_ptr parameter in to_xxx functions be declared as weak?


Yu




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]