comparison src/util.c @ 1946:4e93ea84f7dd

[gaim-migrate @ 1956] whoops. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 01 Jun 2001 23:25:26 +0000
parents ee1adc242b11
children 3397860c22e9
comparison
equal deleted inserted replaced
1945:ee1adc242b11 1946:4e93ea84f7dd
553 char *woo; 553 char *woo;
554 int cnt = 0; 554 int cnt = 0;
555 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */ 555 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
556 if (strlen(msg) > BUF_LEN) { 556 if (strlen(msg) > BUF_LEN) {
557 fprintf(stderr, "Warning: truncating message to 2048 bytes\n"); 557 fprintf(stderr, "Warning: truncating message to 2048 bytes\n");
558 msg[2047] = '\0';
559 } 558 }
560 559
561 woo = malloc(strlen(msg) * 4 + 1); 560 woo = malloc(strlen(msg) * 4 + 1);
562 cpy = g_strdup(msg); 561 cpy = g_strndup(msg, 2048);
563 c = cpy; 562 c = cpy;
564 while (*c) { 563 while (*c) {
565 switch (*c) { 564 switch (*c) {
566 case '\n': 565 case '\n':
567 woo[cnt++] = '<'; 566 woo[cnt++] = '<';