[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wireshark-dev
Subject:    Re: [Wireshark-dev] TCP Graphs and thousands separators ...
From:       Richard Sharpe <realrichardsharpe () gmail ! com>
Date:       2012-06-21 14:19:30
Message-ID: CACyXjPxrGoSu2YORjrp9SPrRxcmwkrf6+pUHDdnjfWL2HXv2ug () mail ! gmail ! com
[Download RAW message or body]

On Thu, Jun 21, 2012 at 7:02 AM, Jeff Morriss <jeff.morriss.ws@gmail.com> wrote:
> Richard Sharpe wrote:
>> On Wed, Jun 20, 2012 at 9:22 PM, Richard Sharpe
>> <realrichardsharpe@gmail.com> wrote:
>>> Hi folks,
>>>
>>> I have noticed some complaining about the lack of thousands separators
>>> on the ticks, especially on the vertical axis. Certainly, I find it a
>>> pain.
>>>
>>> The following patch might fix the problem. I don't currently have a
>>> capture that I can check this with. Perhaps tomorrow I will remember
>>> to bring one how that shows more than three digits ...
>>>
>>> [rsharpe@localhost wireshark]$ svn diff ui/gtk/tcp_graph.c
>>> Index: ui/gtk/tcp_graph.c
>>> ===================================================================
>>> --- ui/gtk/tcp_graph.c  (revision 43186)
>>> +++ ui/gtk/tcp_graph.c  (working copy)
>>> @@ -2767,7 +2767,7 @@
>>>                        break;
>>>                y = y - floor (y);
>>>        }
>>> -       g_snprintf (str, sizeof(str), "%.*f", rdigits, label);
>>> +       g_snprintf (str, sizeof(str), "%'*f", rdigits, label);
>>>        switch (dir) {
>>>        case AXIS_HORIZONTAL:
>>>                 layout = gtk_widget_create_pango_layout(axis->g->drawing_area,
>>>
>>
>> Nope. I was wrong. This does it. Can someone commit it? Do I have to
>> create a bug?:
>>
>> Index: ui/gtk/io_stat.c
>> ===================================================================
>> --- ui/gtk/io_stat.c  (revision 43186)
>> +++ ui/gtk/io_stat.c  (working copy)
>> @@ -962,14 +962,14 @@
>>                               if(draw_y_as_time){
>>                                       print_time_scale_string(label_string, 15, value, value, TRUE);
>>                               } else {
>> -                                     g_snprintf(label_string, 15, "%d", value);
>> +                                     g_snprintf(label_string, 15, "%'d", value);
>>                               }
>>                       } else {
>>                               value = (max_y/10)*i;
>>                               if(draw_y_as_time){
>>                                       print_time_scale_string(label_string, 15, value, max_y, FALSE);
>>                               } else {
>> -                                     g_snprintf(label_string, 15, "%d", value);
>> +                                     g_snprintf(label_string, 15, "%'d", value);
>>                               }
>>                       }
>
> Bugs are always better, and I see you opened bug 7389 for this.
>
> But: a quick search for "printf apostrophe portable" brought me here:
>
> http://www.velocityreviews.com/forums/t442370-portability-issues-with-flag-in-printf.html
>
> which indicates that using the apostrophe isn't really portable.

Yes, I had noticed the portability issues, but I think they can be
solved. The utility of the separators is high enough, it seems to me,
that some additional #ifdefs to deal with this issue is worth it.

-- 
Regards,
Richard Sharpe
(¦ó¥H¸Ñ¼~¡H°ß¦³§ù±d¡C--±ä¾Þ)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@wireshark.org?subject=unsubscribe
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic