You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2010/03/01 11:02:05 UTC

[jira] Created: (HARMONY-6459) [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code

[classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code
---------------------------------------------------------------------------

                 Key: HARMONY-6459
                 URL: https://issues.apache.org/jira/browse/HARMONY-6459
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 6.0M1, 5.0M13
            Reporter: Mark Hindess
            Assignee: Mark Hindess
             Fix For: 6.0M2, 5.0M14


hysock_sockaddr_init6 has code like:

  memset (handle, 0, sizeof (struct hysockaddr_struct));
  if (...) {
    ...
  } else { # IPv6
    sockaddr_6 = (OSSOCKADDR_IN6 *) & handle->addr;
    ...
    sockaddr_6->sin6_len = sizeof (struct sockaddr_in6);
    if (((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len != 0) {
      sockaddr_6->sin6_len = ((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len;
    }

The content of the last if looks bogus because "sockaddr_6" is equivalent to "((OSSOCKADDR_IN6 *) & handle->addr)" (by virtue of the first line of the else) so the left-hand side and right-hand side are the same field.  Also, because of the same equivalence of the two structures, the sin6_len if is always executed since sin6_len field is assigned a non-zero value on the preceding line.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6459) [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison updated HARMONY-6459:
---------------------------------

    Fix Version/s:     (was: 5.0M15)
                       (was: 6.0M3)

> [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code
> ---------------------------------------------------------------------------
>
>                 Key: HARMONY-6459
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M1, 5.0M13
>            Reporter: Mark Hindess
>            Assignee: Mark Hindess
>
> hysock_sockaddr_init6 has code like:
>   memset (handle, 0, sizeof (struct hysockaddr_struct));
>   if (...) {
>     ...
>   } else { # IPv6
>     sockaddr_6 = (OSSOCKADDR_IN6 *) & handle->addr;
>     ...
>     sockaddr_6->sin6_len = sizeof (struct sockaddr_in6);
>     if (((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len != 0) {
>       sockaddr_6->sin6_len = ((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len;
>     }
> The content of the last if looks bogus because "sockaddr_6" is equivalent to "((OSSOCKADDR_IN6 *) & handle->addr)" (by virtue of the first line of the else) so the left-hand side and right-hand side are the same field.  Also, because of the same equivalence of the two structures, the sin6_len if is always executed since sin6_len field is assigned a non-zero value on the preceding line.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-6459) [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess updated HARMONY-6459:
----------------------------------

    Fix Version/s: 6.0M3
                   5.0M15
                       (was: 5.0M14)
                       (was: 6.0M2)

This isn't urgent so I'm deferring fixing it until 5.0M15 and 6.0M3.


> [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code
> ---------------------------------------------------------------------------
>
>                 Key: HARMONY-6459
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M1, 5.0M13
>            Reporter: Mark Hindess
>            Assignee: Mark Hindess
>             Fix For: 6.0M3, 5.0M15
>
>
> hysock_sockaddr_init6 has code like:
>   memset (handle, 0, sizeof (struct hysockaddr_struct));
>   if (...) {
>     ...
>   } else { # IPv6
>     sockaddr_6 = (OSSOCKADDR_IN6 *) & handle->addr;
>     ...
>     sockaddr_6->sin6_len = sizeof (struct sockaddr_in6);
>     if (((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len != 0) {
>       sockaddr_6->sin6_len = ((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len;
>     }
> The content of the last if looks bogus because "sockaddr_6" is equivalent to "((OSSOCKADDR_IN6 *) & handle->addr)" (by virtue of the first line of the else) so the left-hand side and right-hand side are the same field.  Also, because of the same equivalence of the two structures, the sin6_len if is always executed since sin6_len field is assigned a non-zero value on the preceding line.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-6459) [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839628#action_12839628 ] 

Mark Hindess commented on HARMONY-6459:
---------------------------------------

Also, the use of "struct sockaddr_in6" is odd in this context since (most of) the rest of the code uses the "OSSOCKADDR_IN6" define for this structure.  For consistency, it probably makes sense to replace "struct sockaddr_in6" with "OSSOCKADDR_IN6" throughout this file.  Similarly for the non-IPv6 "struct sockaddr_in"/"OSSOCKADDR_IN".


> [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code
> ---------------------------------------------------------------------------
>
>                 Key: HARMONY-6459
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M1, 5.0M13
>            Reporter: Mark Hindess
>            Assignee: Mark Hindess
>             Fix For: 6.0M2, 5.0M14
>
>
> hysock_sockaddr_init6 has code like:
>   memset (handle, 0, sizeof (struct hysockaddr_struct));
>   if (...) {
>     ...
>   } else { # IPv6
>     sockaddr_6 = (OSSOCKADDR_IN6 *) & handle->addr;
>     ...
>     sockaddr_6->sin6_len = sizeof (struct sockaddr_in6);
>     if (((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len != 0) {
>       sockaddr_6->sin6_len = ((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len;
>     }
> The content of the last if looks bogus because "sockaddr_6" is equivalent to "((OSSOCKADDR_IN6 *) & handle->addr)" (by virtue of the first line of the else) so the left-hand side and right-hand side are the same field.  Also, because of the same equivalence of the two structures, the sin6_len if is always executed since sin6_len field is assigned a non-zero value on the preceding line.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.