~ubuntu-branches/ubuntu/intrepid/curl/intrepid

« back to all changes in this revision

Viewing changes to lib/inet_ntop.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-10-30 10:56:48 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061030105648-uo8q8w9xklb40b4k
Tags: 7.15.5-1ubuntu1
* Merge from debian unstable. Remaining Ubuntu changes:
  - debian/control: Drop libdb4.2 build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
   * Keep this in mind if you think this function should have been coded
107
107
   * to use pointer overlays.  All the world's not a VAX.
108
108
   */
109
 
  char  tmp [sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
 
109
  char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
110
110
  char *tp;
111
111
  struct {
112
112
    long base;
113
113
    long len;
114
114
  } best, cur;
115
 
  u_long words [IN6ADDRSZ / INT16SZ];
116
 
  int    i;
 
115
  unsigned long words[IN6ADDRSZ / INT16SZ];
 
116
  int i;
117
117
 
118
118
  /* Preprocess:
119
119
   *  Copy the input (bytewise) array into a wordwise array.
120
120
   *  Find the longest run of 0x00's in src[] for :: shorthanding.
121
121
   */
122
 
  memset(words, 0, sizeof(words));
 
122
  memset(words, '\0', sizeof(words));
123
123
  for (i = 0; i < IN6ADDRSZ; i++)
124
124
      words[i/2] |= (src[i] << ((1 - (i % 2)) << 3));
125
125
 
126
126
  best.base = -1;
127
127
  cur.base  = -1;
 
128
  best.len = 0;
 
129
  cur.len = 0;
 
130
 
128
131
  for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
129
132
  {
130
133
    if (words[i] == 0)