| 217 | } |
| 218 | |
| 219 | int 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 | |
| 255 | int CAclTrans::ScanPath(CString *psPath) |
| 256 | { |
nothing calls this directly
no test coverage detected