MCPcopy Create free account
hub / github.com/acl-dev/acl / TransFile

Method TransFile

app/jencode/AclTrans.cpp:219–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219int CAclTrans::TransFile(const char *psPath)
220{
221 char *sBuf = NULL;
222 size_t iLen;
223
224#undef RETURN
225#define RETURN(_x_) do \
226{ \
227 if (sBuf) \
228 acl_myfree(sBuf); \
229 return(_x_); \
230} while(0);
231
232 sBuf = acl_vstream_loadfile(psPath);
233 if (sBuf == NULL || *sBuf == 0)
234 RETURN (-1);
235
236 iLen = strlen(sBuf);
237 if (m_bTrans)
238 Trans(sBuf); // ��ʼת��
239 else if (strstr(psPath, ".html") != NULL)
240 Restore(sBuf);
241 else
242 RETURN (0);
243
244 ACL_VSTREAM *fp;
245 int ret;
246
247 fp = acl_vstream_fopen(psPath, O_RDWR | O_TRUNC | O_BINARY | O_APPEND, 0600, 1024);
248 if (fp == NULL)
249 RETURN (-1);
250 ret = acl_vstream_writen(fp, sBuf, iLen);
251 acl_vstream_close(fp);
252 RETURN (ret == ACL_VSTREAM_EOF ? -1 : 0);
253}
254
255int CAclTrans::ScanPath(CString *psPath)
256{

Callers

nothing calls this directly

Calls 4

acl_vstream_loadfileFunction · 0.85
acl_vstream_fopenFunction · 0.85
acl_vstream_writenFunction · 0.85
acl_vstream_closeFunction · 0.85

Tested by

no test coverage detected