[jira] [Created] (PROTON-662) decoder.c pn_decoder_decode_value has a test that won't correctly execute.

2014-09-06 Thread Fraser Adams (JIRA)
Fraser Adams created PROTON-662:
---

 Summary: decoder.c pn_decoder_decode_value has a test that won't 
correctly execute.
 Key: PROTON-662
 URL: https://issues.apache.org/jira/browse/PROTON-662
 Project: Qpid Proton
  Issue Type: Bug
  Components: proton-c
Reporter: Fraser Adams
Priority: Minor


In decoder.c pn_decoder_decode_value there is a block of code:

pn_type_t type = pn_code2type(acode);
if (type  0) return type;

The test will not execute correctly because pn_type_t is an unsigned 
enumeration. The reason for the test seems to be to trap the case where 
pn_code2type does:
return (pn_type_t) PN_ARG_ERR;

rather than returning the type.

Compiling with Clang rather than gcc flags this warning (which prevents using 
warnings as errors with Clang):

 warning: 
  comparison of unsigned enum expression  0 is always false
  [-Wtautological-compare]
if (type  0) return type;
 ^ ~

Trivial fix is to use correct casting:

if ((int)type  0) return (int)type;








--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PROTON-662) decoder.c pn_decoder_decode_value has a test that won't correctly execute.

2014-09-06 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/PROTON-662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14124528#comment-14124528
 ] 

ASF subversion and git services commented on PROTON-662:


Commit 1622873 from [~fadams] in branch 'proton/trunk'
[ https://svn.apache.org/r1622873 ]

PROTON-662: decoder.c pn_decoder_decode_value has a test that won't correctly 
execute.

 decoder.c pn_decoder_decode_value has a test that won't correctly execute.
 --

 Key: PROTON-662
 URL: https://issues.apache.org/jira/browse/PROTON-662
 Project: Qpid Proton
  Issue Type: Bug
  Components: proton-c
Reporter: Fraser Adams
Priority: Minor

 In decoder.c pn_decoder_decode_value there is a block of code:
 pn_type_t type = pn_code2type(acode);
 if (type  0) return type;
 The test will not execute correctly because pn_type_t is an unsigned 
 enumeration. The reason for the test seems to be to trap the case where 
 pn_code2type does:
 return (pn_type_t) PN_ARG_ERR;
 rather than returning the type.
 Compiling with Clang rather than gcc flags this warning (which prevents using 
 warnings as errors with Clang):
  warning: 
   comparison of unsigned enum expression  0 is always false
   [-Wtautological-compare]
 if (type  0) return type;
  ^ ~
 Trivial fix is to use correct casting:
 if ((int)type  0) return (int)type;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (PROTON-662) decoder.c pn_decoder_decode_value has a test that won't correctly execute.

2014-09-06 Thread Fraser Adams (JIRA)

 [ 
https://issues.apache.org/jira/browse/PROTON-662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Fraser Adams resolved PROTON-662.
-
Resolution: Fixed

Added the correct casting.

Now compiles cleanly on both gcc and Clang.

 decoder.c pn_decoder_decode_value has a test that won't correctly execute.
 --

 Key: PROTON-662
 URL: https://issues.apache.org/jira/browse/PROTON-662
 Project: Qpid Proton
  Issue Type: Bug
  Components: proton-c
Reporter: Fraser Adams
Priority: Minor

 In decoder.c pn_decoder_decode_value there is a block of code:
 pn_type_t type = pn_code2type(acode);
 if (type  0) return type;
 The test will not execute correctly because pn_type_t is an unsigned 
 enumeration. The reason for the test seems to be to trap the case where 
 pn_code2type does:
 return (pn_type_t) PN_ARG_ERR;
 rather than returning the type.
 Compiling with Clang rather than gcc flags this warning (which prevents using 
 warnings as errors with Clang):
  warning: 
   comparison of unsigned enum expression  0 is always false
   [-Wtautological-compare]
 if (type  0) return type;
  ^ ~
 Trivial fix is to use correct casting:
 if ((int)type  0) return (int)type;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (PROTON-663) codec.c pni_inspect_atom uses the wrong format for case PN_CHAR

2014-09-06 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/PROTON-663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14124530#comment-14124530
 ] 

ASF subversion and git services commented on PROTON-663:


Commit 1622875 from [~fadams] in branch 'proton/trunk'
[ https://svn.apache.org/r1622875 ]

PROTON-663: codec.c pni_inspect_atom uses the wrong format for case PN_CHAR

 codec.c pni_inspect_atom uses the wrong format for case PN_CHAR
 ---

 Key: PROTON-663
 URL: https://issues.apache.org/jira/browse/PROTON-663
 Project: Qpid Proton
  Issue Type: Bug
Reporter: Fraser Adams

 In codec.c pni_inspect_atom
 case PN_CHAR
 Clang reports the following
 warning: 
   format specifies type 'wint_t' (aka 'int') but the argument has type
   'pn_char_t' (aka 'unsigned int') [-Wformat]
 return pn_string_addf(str, %lc,  atom-u.as_char);
 ~~~^~~
 %c
 The line should read 
   case PN_CHAR:
 return pn_string_addf(str, %c,  atom-u.as_char);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)