Changes in zephyr.c [50e29e3:6201646]
Legend:
- Unmodified
- Added
- Removed
-
zephyr.c
r50e29e3 r6201646 354 354 return(owl_strdup("")); 355 355 } 356 357 char *owl_zephyr_get_field_as_utf8(ZNotice_t *n, int j) 358 { 359 int i, count, save; 360 361 /* If there's no message here, just run along now */ 362 if (n->z_message_len == 0) 363 return(owl_strdup("")); 364 365 count=save=0; 366 for (i = 0; i < n->z_message_len; i++) { 367 if (n->z_message[i]=='\0') { 368 count++; 369 if (count == j) { 370 /* just found the end of the field we're looking for */ 371 return(owl_validate_or_convert(n->z_message + save)); 372 } else { 373 save = i + 1; 374 } 375 } 376 } 377 /* catch the last field, which might not be null terminated */ 378 if (count == j - 1) { 379 char *tmp, *out; 380 tmp = owl_malloc(n->z_message_len-save+5); 381 memcpy(tmp, n->z_message+save, n->z_message_len-save); 382 tmp[n->z_message_len-save]='\0'; 383 out = owl_validate_or_convert(tmp); 384 owl_free(tmp); 385 return out; 386 } 387 388 return(owl_strdup("")); 389 } 356 390 #else 357 391 char *owl_zephyr_get_field(void *n, int j) 358 392 { 359 393 return(owl_strdup("")); 394 } 395 char *owl_zephyr_get_field_as_utf8(ZNotice_t *n, int j) 396 { 397 return owl_zephyr_get_field(n, j); 360 398 } 361 399 #endif
Note: See TracChangeset
for help on using the changeset viewer.