[Pianod] Pianod Digest, Vol 20, Issue 5

Ansen F. Labardee alabardee at veinclinicpa.net
Mon Jun 23 12:42:52 PDT 2014


Ok I was able to get it working by actually substituting the code from libpiano/response.c from pianobars sourceforge 
I dropped the following in place instead of "surrounding the loop". 


/* parse feedback */ 
json_object * feedback = json_object_object_get ( result , 
"feedback" ); 
if ( feedback != NULL ) { 
static const char * const keys [] = { "thumbsUp" , "thumbsDown" }; 
for ( size_t i = 0 ; i < sizeof ( keys ) / sizeof ( * keys ); i ++ ) { 
json_object * const val = json_object_object_get ( feedback , 
keys [ i ]); 
if ( val == NULL ) { 
continue ; 
} 
assert ( json_object_is_type ( val , json_type_array )); 
for ( int i = 0 ; i < json_object_array_length ( val ); i ++ ) { 
json_object * s = json_object_array_get_idx ( val , i ); 
PianoSong_t * feedbackSong ; 


feedbackSong = calloc ( 1 , sizeof ( * feedbackSong )); 
if ( feedbackSong == NULL ) { 
return PIANO_RET_OUT_OF_MEMORY ; 
} 


feedbackSong -> title = PianoJsonStrdup ( s , "songName" ); 
feedbackSong -> artist = PianoJsonStrdup ( s , 
"artistName" ); 
feedbackSong -> feedbackId = PianoJsonStrdup ( s , 
"feedbackId" ); 
feedbackSong -> rating = json_object_get_boolean ( 
json_object_object_get ( s , "isPositive" )) ? 
PIANO_RATE_LOVE : PIANO_RATE_BAN ; 


info -> feedback = PianoListAppendP ( info -> feedback , 
feedbackSong ); 




----- Original Message -----

From: "Ansen F. Labardee" <alabardee at veinclinicpa.net> 
To: pianod at lists.deviousfish.com 
Sent: Monday, June 23, 2014 2:19:52 PM 
Subject: Re: Pianod Digest, Vol 20, Issue 5 


I just don't understand the code at all what is supposed to be replaced or added? 
>From this point I think I've figured out that you are talking about lines 653-657 I guess I just don't understand how to "surround the loop" and where the loop is... 
can you should the before and after of the applicable line numbers? 


----- Original Message -----

From: pianod-request at lists.deviousfish.com 
To: pianod at lists.deviousfish.com 
Sent: Saturday, June 21, 2014 3:42:06 PM 
Subject: Pianod Digest, Vol 20, Issue 5 

Send Pianod mailing list submissions to 
pianod at lists.deviousfish.com 

To subscribe or unsubscribe via the World Wide Web, visit 
http://lists.deviousfish.com/listinfo.cgi/pianod-deviousfish.com 
or, via email, send a message with subject or body 'help' to 
pianod-request at lists.deviousfish.com 

You can reach the person managing the list at 
pianod-owner at lists.deviousfish.com 

When replying, please edit your Subject line so it is more specific 
than "Re: Contents of Pianod digest..." 


Today's Topics: 

1. Re: Segmentation Fault (Henry So) 
2. Re: Segmentation Fault (ednewbauer at yahoo.com) 


---------------------------------------------------------------------- 

Message: 1 
Date: Fri, 20 Jun 2014 21:56:54 +0000 
From: Henry So <Henry at racetechnologies.com> 
To: pianod <pianod at lists.deviousfish.com> 
Subject: Re: [Pianod] Segmentation Fault 
Message-ID: 
<A5C55AF05254AD41AED00876596D463E53D1CDDE at EXCHANGE5.cloud.etsonline.com> 

Content-Type: text/plain; charset="utf-8" 

Hi Brian, 
Thanks for the code snippet. I?ve been successfully using pianod all day. 

Best Regards, 
Henry 

From: Pianod [mailto:pianod-bounces at lists.deviousfish.com] On Behalf Of Brian Moyer 
Sent: Friday, June 20, 2014 6:08 AM 
To: pianod 
Subject: Re: [Pianod] Segmentation Fault 

I surrounded the for loop with an if statement checking the json type. 
if(json_object_get_type(val) == json_type_array) 
{ 
for (size_t i=0; i < json_object_array_length(val); i++) { 
... 
} 
} 

On Thu, Jun 19, 2014 at 4:56 PM, Ansen F. Labardee <alabardee at veinclinicpa.net<mailto:alabardee at veinclinicpa.net>> wrote: 
Brian, 

What did you replace the offending code with? Forgive me, my coding is quite rough. 

-- 
Ansen Labardee 


This email message is for the sole use of the intended recipients and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message 

_______________________________________________ 
Pianod mailing list 
Pianod at lists.deviousfish.com<mailto:Pianod at lists.deviousfish.com> 
http://lists.deviousfish.com/listinfo.cgi/pianod-deviousfish.com 

-------------- next part -------------- 
An HTML attachment was scrubbed... 
URL: <http://lists.deviousfish.com/pipermail/pianod-deviousfish.com/attachments/20140620/6c65e69a/attachment.html> 

------------------------------ 

Message: 2 
Date: Fri, 20 Jun 2014 20:46:48 -0700 
From: "ednewbauer at yahoo.com" <ednewbauer at yahoo.com> 
To: pianod <pianod at lists.deviousfish.com> 
Subject: Re: [Pianod] Segmentation Fault 
Message-ID: 
<1403322408.64925.YahooMailAndroidMobile at web122305.mail.ne1.yahoo.com> 
Content-Type: text/plain; charset="iso-8859-1" 

Confirmed here. 
good find! 
ed 

Sent from Yahoo Mail on Android 

-------------- next part -------------- 
An HTML attachment was scrubbed... 
URL: <http://lists.deviousfish.com/pipermail/pianod-deviousfish.com/attachments/20140620/9be597c0/attachment-0001.htm> 

------------------------------ 

Subject: Digest Footer 

_______________________________________________ 
Pianod mailing list 
Pianod at lists.deviousfish.com 
http://lists.deviousfish.com/listinfo.cgi/pianod-deviousfish.com 


------------------------------ 

End of Pianod Digest, Vol 20, Issue 5 
************************************* 



This email message is for the sole use of the intended recipients and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deviousfish.com/pipermail/pianod-deviousfish.com/attachments/20140623/9f162570/attachment-0002.htm>


More information about the Pianod mailing list