Re: [Wireshark-dev] [Wireshark-commits] master e16500e: Fix check for NUL at the end of a string.

2015-05-13 Thread Graham Bloice
On 13 May 2015 at 07:28, Bálint Réczey bal...@balintreczey.hu wrote:

 2015-05-13 0:26 GMT+02:00 Guy Harris g...@alum.mit.edu:
 
  On May 12, 2015, at 3:13 PM, Evan Huus eapa...@gmail.com wrote:
 
  Argh, one of these days I will learn to just put parentheses in rather
  than taking guesses at C operator precedence :(
 
  Yeah, the rule I've found works best for me is if you aren't certain,
 throw parentheses at it.
 Yes, in this case parentheses are a must.
 I also llike putting them when the reader may not guess the precedence
 correctly easily. This reader can be myself later ;-).


I have a colleague who for reasons only known to himself is violently
against unnecessary parentheses, so I always put in even more just for
him.

My rule is to parenthesise wherever multiple operators appear in an
expression.  Even more important where the team is working in multiple
programming languages with different precedence rules.


-- 
Graham Bloice
___
Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org
Archives:https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
 mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Re: [Wireshark-dev] [Wireshark-commits] master e16500e: Fix check for NUL at the end of a string.

2015-05-13 Thread Bálint Réczey
2015-05-13 0:26 GMT+02:00 Guy Harris g...@alum.mit.edu:

 On May 12, 2015, at 3:13 PM, Evan Huus eapa...@gmail.com wrote:

 Argh, one of these days I will learn to just put parentheses in rather
 than taking guesses at C operator precedence :(

 Yeah, the rule I've found works best for me is if you aren't certain, throw 
 parentheses at it.
Yes, in this case parentheses are a must.
I also llike putting them when the reader may not guess the precedence
correctly easily. This reader can be myself later ;-).

Cheers,
Balint
___
Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org
Archives:https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
 mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe


Re: [Wireshark-dev] [Wireshark-commits] master e16500e: Fix check for NUL at the end of a string.

2015-05-12 Thread Guy Harris

On May 12, 2015, at 3:13 PM, Evan Huus eapa...@gmail.com wrote:

 Argh, one of these days I will learn to just put parentheses in rather
 than taking guesses at C operator precedence :(

Yeah, the rule I've found works best for me is if you aren't certain, throw 
parentheses at it.
___
Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org
Archives:https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
 mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe


Re: [Wireshark-dev] [Wireshark-commits] master e16500e: Fix check for NUL at the end of a string.

2015-05-12 Thread Evan Huus
Argh, one of these days I will learn to just put parentheses in rather
than taking guesses at C operator precedence :(

On Tue, May 12, 2015 at 6:10 PM, Wireshark code review
code-review-do-not-re...@wireshark.org wrote:
 URL: 
 https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=e16500e80f85641b28971498c3fc580eab800055
 Submitter: Guy Harris (g...@alum.mit.edu)
 Changed: branch: master
 Repository: wireshark

 Commits:

 e16500e by Guy Harris (g...@alum.mit.edu):

 Fix check for NUL at the end of a string.

 *seq[slength - 1] means *(seq[slength - 1]), where seq points to a
 const gchar *, so it fetches the pointer at an offset of slength - 1
 from the pointer to which seq points, and dereferences that pointer.
 What's wanted is (*seq)[slength - 1], i.e. fetch the pointer to which
 seq points, and fetch the byte at an offset of slength - 1 from the byte
 to which said pointer points.

 Change-Id: I7246f5e6093d035bad59be530893f3fc54dad97e
 Reviewed-on: https://code.wireshark.org/review/8441
 Reviewed-by: Guy Harris g...@alum.mit.edu


 Actions performed:

 from  99ca421   Qt: Display filter completion fixes.
 adds  e16500e   Fix check for NUL at the end of a string.


 Summary of changes:
  epan/dissectors/packet-giop.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 ___
 Sent via:Wireshark-commits mailing list wireshark-comm...@wireshark.org
 Archives:https://www.wireshark.org/lists/wireshark-commits
 Unsubscribe: https://wireshark.org/mailman/options/wireshark-commits
  
 mailto:wireshark-commits-requ...@wireshark.org?subject=unsubscribe
___
Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org
Archives:https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
 mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe