Changeset 51fdc45
- Timestamp:
- 2006-09-17T15:56:16Z (18 years ago)
- Branches:
- master
- Children:
- 8f243ad, 9544acb
- Parents:
- 8320a7a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/misc.c
r8320a7a r51fdc45 54 54 } 55 55 56 char *add_cr(char *text)57 {58 char *ret = NULL;59 int count = 0, j;60 unsigned int i;61 62 if (text[0] == '\n')63 count++;64 for (i = 1; i < strlen(text); i++)65 if (text[i] == '\n' && text[i - 1] != '\r')66 count++;67 68 if (count == 0)69 return g_strdup(text);70 71 ret = g_malloc0(strlen(text) + count + 1);72 73 i = 0; j = 0;74 if (text[i] == '\n')75 ret[j++] = '\r';76 ret[j++] = text[i++];77 for (; i < strlen(text); i++) {78 if (text[i] == '\n' && text[i - 1] != '\r')79 ret[j++] = '\r';80 ret[j++] = text[i];81 }82 83 return ret;84 }85 86 56 char *normalize(const char *s) 87 57 { … … 124 94 typedef struct htmlentity 125 95 { 126 char code[ 8];127 char is[ 4];96 char code[7]; 97 char is[3]; 128 98 } htmlentity_t; 129 130 /* FIXME: This is ISO8859-1(5) centric, so might cause problems with other charsets. */131 99 132 100 static const htmlentity_t ent[] =
Note: See TracChangeset
for help on using the changeset viewer.