/[winpt]/trunk/Src/wptKeyserver.cpp
ViewVC logotype

Diff of /trunk/Src/wptKeyserver.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 328 by twoaday, Fri Sep 25 16:07:38 2009 UTC revision 340 by twoaday, Sun Nov 27 13:15:07 2011 UTC
# Line 60  WORD default_keyserver_port = 0; Line 60  WORD default_keyserver_port = 0;
60  static size_t default_socket_timeout = 6;  static size_t default_socket_timeout = 6;
61    
62    
63    /* Remove %AB sequences from the input buffer @in
64       and store the raw data in @out. */
65    void
66    unhexify_buffer (const char *in, char **r_out)
67    {
68        char temp[3], *out;
69        size_t len, pos, i=0;
70    
71        len = strlen (in);
72        out = new char[len+1];
73        if (!out)
74            BUG (0);
75        memset (out, 0, len+1);
76        for (pos = 0; pos < len; pos++) {
77            if (in[pos] == '%' && in[pos+1] == '%')
78                out[i++] = '%';
79            else if (in[pos] == '%') {
80                temp[0] = in[++pos];
81                temp[1] = in[++pos];
82                temp[2] = 0;
83                out[i++] = (char)strtoul (temp, NULL, 16);
84            }
85            else
86                out[i++] = in[pos];
87        }
88        out[i] = 0;
89        *r_out = out;
90    }
91    
92    
93  /* Wrapper for safe memory allocation. */  /* Wrapper for safe memory allocation. */
94  static char*  static char*
95  safe_alloc (DWORD n)  safe_alloc (DWORD n)

Legend:
Removed from v.328  
changed lines
  Added in v.340

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26