----------------------------------------------------------------*/
| 122 | } |
| 123 | /*----------------------------------------------------------------*/ |
| 124 | static TCHAR * |
| 125 | nh_append(TCHAR *s, int *size, const char *ap) |
| 126 | { |
| 127 | int tlen, tnewlen; |
| 128 | |
| 129 | if (!(ap && *ap)) |
| 130 | return s; |
| 131 | |
| 132 | /* append the calculated line to the text buffer */ |
| 133 | tlen = s ? _tcslen(s) : 0; |
| 134 | tnewlen = tlen + strlen(ap); |
| 135 | if (tnewlen >= *size) { |
| 136 | *size = max(tnewlen, *size + BUFSZ); |
| 137 | s = (TCHAR *) realloc(s, *size * sizeof(TCHAR)); |
| 138 | if (!s) |
| 139 | panic("Out of memory"); |
| 140 | ZeroMemory(s + tlen, (*size - tlen) * sizeof(TCHAR)); |
| 141 | } |
| 142 | if (strcmp(ap, "\r\n") == 0) { |
| 143 | _tcscat(s, TEXT("\r\n")); |
| 144 | } else { |
| 145 | NH_A2W(ap, s + tlen, strlen(ap)); |
| 146 | s[tnewlen] = 0; |
| 147 | } |
| 148 | return s; |
| 149 | } |
| 150 | /*----------------------------------------------------------------*/ |
| 151 | void |
| 152 | mswin_render_text(PNHTextBuffer pb, HWND edit_control) |
no test coverage detected