MCPcopy Create free account
hub / github.com/aldostools/webMAN-MOD / htmlenc

Function htmlenc

include/init/html.h:198–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198static size_t htmlenc(char *dst, char *src, u8 cpy2src)
199{
200 if(!src || !dst) return 0;
201
202 size_t j = 0;
203 char tmp[10]; u8 t, c;
204 for(size_t i = 0; src[i]; i++)
205 {
206 if((unsigned char)src[i] >= 0x7F || (unsigned char)src[i] < 0x20)
207 {
208 t = sprintf(tmp, "&#x%X;", (unsigned char)src[i]); c = 0;
209 while(t--) {dst[j++] = tmp[c++];}
210 }
211 else dst[j++] = src[i];
212 }
213
214 j = MIN(j, MAX_LINE_LEN);
215 dst[j] = '\0';
216
217 if(cpy2src) strcpy(src, dst);
218 return j;
219}
220
221static size_t utf8enc(char *dst, char *src, u8 cpy2src)
222{

Callers 6

add_list_entryFunction · 0.85
add_breadcrumb_trailFunction · 0.85
www_page.hFile · 0.85
mount.hFile · 0.85
remap_unmap.hFile · 0.85
add_net_gameFunction · 0.85

Calls 2

sprintfFunction · 0.50
strcpyFunction · 0.50

Tested by

no test coverage detected