bugGPSD - Bugs: bug #44183, Some bugs in json-encoding

 
 

bug #44183: Some bugs in json-encoding

Submitted by:  None
Submitted on:  Tue 03 Feb 2015 11:08:48 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Eric S. Raymond <esr>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 03 Feb 2015 11:08:48 PM UTC, original submission:

Below are diffs of three minor bug fixes, which fix json encoding of aivdm sentences. Hope you get the point.

diff --git a/gpsd_json.c b/gpsd_json.c
index 721ff89..d17e595 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -2799,7 +2799,7 @@ void json_aivdm_dump(const struct ais_t *ais,
"\"speed_q\":%s,"
"\"course_q\":%s,"
"\"heading_q\":%s}\r\n",
- ais->type8.dac200fid10.vin,
+ json_stringify(buf1, sizeof(buf1), ais->type8.dac200fid10.vin),
ais->type8.dac200fid10.length,
ais->type8.dac200fid10.beam,
ais->type8.dac200fid10.shiptype,
@@ -2861,7 +2861,7 @@ void json_aivdm_dump(const struct ais_t *ais,
ais->type8.dac200fid24.country);
for (i = 0; i < ais->type8.dac200fid24.ngauges; i++) {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "{\"id\":%u,\"level\":%d}",
+ "{\"id\":%u,\"level\":%d},",
ais->type8.dac200fid24.gauges[i].id,
ais->type8.dac200fid24.gauges[i].level);
}
@@ -3312,7 +3312,7 @@ void json_aivdm_dump(const struct ais_t *ais,
ais->type24.callsign));
if (AIS_AUXILIARY_MMSI(ais->mmsi)) {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "\"mothership_mmsi\":%u}\r\n",
+ "\"mothership_mmsi\":%u,",
ais->type24.mothership_mmsi);
} else {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by esr (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 22 Feb 2015 05:02:43 PM UTCesrOpen/ClosedOpen=>Closed
    Thu 05 Feb 2015 10:50:07 AM UTCesrStatusNone=>Fixed
      Assigned toNone=>esr

    Back to the top


    Powered by Savane 3.1-cleanup1