comparison libpurple/protocols/zephyr/ZParseNot.c @ 31086:a8cc50c2279f

Remove trailing whitespace
author Richard Laager <rlaager@wiktel.com>
date Tue, 04 Jan 2011 06:55:30 +0000
parents 5fe8042783c1
children
comparison
equal deleted inserted replaced
31085:44f53d3fc54f 31086:a8cc50c2279f
3 * 3 *
4 * Created by: Robert French 4 * Created by: Robert French
5 * 5 *
6 * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. 6 * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology.
7 * For copying and distribution information, see the file 7 * For copying and distribution information, see the file
8 * "mit-copyright.h". 8 * "mit-copyright.h".
9 */ 9 */
10 10
11 #include "internal.h" 11 #include "internal.h"
12 12
13 /* Assume that strlen is efficient on this machine... */ 13 /* Assume that strlen is efficient on this machine... */
82 #else 82 #else
83 #define BAD_PACKET goto badpkt 83 #define BAD_PACKET goto badpkt
84 #endif 84 #endif
85 85
86 (void) memset((char *)notice, 0, sizeof(ZNotice_t)); 86 (void) memset((char *)notice, 0, sizeof(ZNotice_t));
87 87
88 ptr = buffer; 88 ptr = buffer;
89 end = buffer+len; 89 end = buffer+len;
90 90
91 notice->z_packet = buffer; 91 notice->z_packet = buffer;
92 92
93 notice->z_version = ptr; 93 notice->z_version = ptr;
94 if (strncmp(ptr, ZVERSIONHDR, sizeof(ZVERSIONHDR) - 1)) 94 if (strncmp(ptr, ZVERSIONHDR, sizeof(ZVERSIONHDR) - 1))
95 return (ZERR_VERS); 95 return (ZERR_VERS);
96 ptr += sizeof(ZVERSIONHDR) - 1; 96 ptr += sizeof(ZVERSIONHDR) - 1;
97 if (!*ptr) { 97 if (!*ptr) {
139 numfields--; 139 numfields--;
140 next_field (ptr); 140 next_field (ptr);
141 } 141 }
142 else 142 else
143 BAD_PACKET; 143 BAD_PACKET;
144 144
145 if (numfields) { 145 if (numfields) {
146 if (ZReadAscii(ptr, end-ptr, (unsigned char *)&notice->z_uid, 146 if (ZReadAscii(ptr, end-ptr, (unsigned char *)&notice->z_uid,
147 sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) 147 sizeof(ZUnique_Id_t)) == ZERR_BADFIELD)
148 BAD_PACKET; 148 BAD_PACKET;
149 notice->z_time.tv_sec = ntohl((unsigned long) notice->z_uid.tv.tv_sec); 149 notice->z_time.tv_sec = ntohl((unsigned long) notice->z_uid.tv.tv_sec);
151 numfields--; 151 numfields--;
152 next_field (ptr); 152 next_field (ptr);
153 } 153 }
154 else 154 else
155 BAD_PACKET; 155 BAD_PACKET;
156 156
157 if (numfields) { 157 if (numfields) {
158 if (ZReadAscii16(ptr, end-ptr, &notice->z_port) == ZERR_BADFIELD) 158 if (ZReadAscii16(ptr, end-ptr, &notice->z_port) == ZERR_BADFIELD)
159 BAD_PACKET; 159 BAD_PACKET;
160 notice->z_port = htons(notice->z_port); 160 notice->z_port = htons(notice->z_port);
161 numfields--; 161 numfields--;
172 next_field (ptr); 172 next_field (ptr);
173 } 173 }
174 else 174 else
175 BAD_PACKET; 175 BAD_PACKET;
176 notice->z_checked_auth = ZAUTH_UNSET; 176 notice->z_checked_auth = ZAUTH_UNSET;
177 177
178 if (numfields) { 178 if (numfields) {
179 if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) 179 if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
180 BAD_PACKET; 180 BAD_PACKET;
181 notice->z_authent_len = temp; 181 notice->z_authent_len = temp;
182 numfields--; 182 numfields--;
198 numfields--; 198 numfields--;
199 next_field (ptr); 199 next_field (ptr);
200 } 200 }
201 else 201 else
202 notice->z_class = ""; 202 notice->z_class = "";
203 203
204 if (numfields) { 204 if (numfields) {
205 notice->z_class_inst = ptr; 205 notice->z_class_inst = ptr;
206 numfields--; 206 numfields--;
207 next_field (ptr); 207 next_field (ptr);
208 } 208 }
238 numfields--; 238 numfields--;
239 next_field (ptr); 239 next_field (ptr);
240 } 240 }
241 else 241 else
242 notice->z_default_format = ""; 242 notice->z_default_format = "";
243 243
244 /*XXX*/ 244 /*XXX*/
245 if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) 245 if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD)
246 BAD_PACKET; 246 BAD_PACKET;
247 notice->z_checksum = temp; 247 notice->z_checksum = temp;
248 numfields--; 248 numfields--;
271 for (i=0;i<Z_MAXOTHERFIELDS && numfields;i++,numfields--) { 271 for (i=0;i<Z_MAXOTHERFIELDS && numfields;i++,numfields--) {
272 notice->z_other_fields[i] = ptr; 272 notice->z_other_fields[i] = ptr;
273 next_field (ptr); 273 next_field (ptr);
274 } 274 }
275 notice->z_num_other_fields = i; 275 notice->z_num_other_fields = i;
276 276
277 for (i=0;i<numfields;i++) 277 for (i=0;i<numfields;i++)
278 next_field (ptr); 278 next_field (ptr);
279 279
280 notice->z_message = (void *)ptr; 280 notice->z_message = (void *)ptr;
281 notice->z_message_len = len-(ptr-buffer); 281 notice->z_message_len = len-(ptr-buffer);
282 282
283 return (ZERR_NONE); 283 return (ZERR_NONE);
284 } 284 }