ibc / libsdptransform

Session Description Protocol C++ parser/writer based on the sdp-transform JavaScript library
MIT License
134 stars 56 forks source link

Determine data type #9

Closed wolfhan closed 5 years ago

wolfhan commented 5 years ago

When I called parseImageAttributes([x=800,y=640,sar=1.1,q=0.6]), I got the result [{"x":800,"y":640,"q":0,"sar":0}]. After reading the source code, I found something wrong with data type, so I did some changes.

ibc commented 5 years ago

Is this PR converting into int a json string with this exact value: "123"? I mean, just because it looks like a number, is this PR forcing the parsed value to be an integer?

I know that sdp-transform (the JS library) does it. But it comes with several issues such as when parsing values like a=mid. By spec they are strings, however browsers usually use a=mid:0 and a=mid:1. Those 0 and 1 must be strings rather than integers in the parsed Object.

BTW: have you run the tests? I won't accept any PR that does not pass the test units (or modifies them according to the changes in the PR if the expected results make sense): https://travis-ci.org/ibc/libsdptransform/jobs/468348603

ibc commented 5 years ago

Humm, I'm considering accepting this change. It should be carefully documented so the app does not assume that certain params are always integers, or floats or strings.

ibc commented 5 years ago

Let's do it.

ibc commented 5 years ago

This has been improved (specially the documentation) in 1.2.0