| 94 |
decodeFileName = decode(fileName->mb_str()); |
decodeFileName = decode(fileName->mb_str()); |
| 95 |
snprintf(decodeFileNameBuf, MAX_BUF_SIZE, "%s", decodeFileName); |
snprintf(decodeFileNameBuf, MAX_BUF_SIZE, "%s", decodeFileName); |
| 96 |
toLower(buf); |
toLower(buf); |
|
toLower(outbuf); |
|
| 97 |
toLower(decodeFileNameBuf); |
toLower(decodeFileNameBuf); |
| 98 |
found = TRUE; |
found = TRUE; |
| 99 |
for(i = 0; tokenList[i] != NULL; i++){ |
for(i = 0; tokenList[i] != NULL; i++){ |
| 100 |
|
toLower(tokenList[i]); |
| 101 |
if(strstr((const char*)buf, (const char*)tokenList[i]) || |
if(strstr((const char*)buf, (const char*)tokenList[i]) || |
| 102 |
strstr((const char*)decodeFileName, (const char*)tokenList[i])) { |
strstr((const char*)decodeFileName, (const char*)tokenList[i])) { |
| 103 |
found = TRUE; |
found = TRUE; |
| 287 |
sprintf(newFullPath, "%s/%s", (const char*)dataDirName->mb_str(), (const char*)fileName->mb_str()); |
sprintf(newFullPath, "%s/%s", (const char*)dataDirName->mb_str(), (const char*)fileName->mb_str()); |
| 288 |
|
|
| 289 |
if((fp = fopen(newFullPath, "r")) == NULL) { |
if((fp = fopen(newFullPath, "r")) == NULL) { |
| 290 |
rename(oldFullPath, newFullPath); |
if(rename(oldFullPath, newFullPath) < 0) wxLogMessage(wxT("rename error: errno=[%d]"), errno); |
| 291 |
} |
} |
| 292 |
else if(strcmp(oldFullPath, newFullPath)){ |
else if(strcmp(oldFullPath, newFullPath)){ |
| 293 |
wxLogMessage(wxT("File has already exist. [%s]"), fileName->c_str()); |
wxLogMessage(wxT("File has already exist. [%s]"), fileName->c_str()); |
| 294 |
fclose(fp); |
fclose(fp); |
| 295 |
} |
} |
| 296 |
|
else { |
| 297 |
|
fclose(fp); |
| 298 |
|
} |
| 299 |
|
|
| 300 |
delete oldSubject; |
delete oldSubject; |
| 301 |
delete oldFileName; |
delete oldFileName; |
| 312 |
FILE* fp; |
FILE* fp; |
| 313 |
char buf[MAX_BUF_SIZE]; |
char buf[MAX_BUF_SIZE]; |
| 314 |
char fullPath[MAX_BUF_SIZE]; |
char fullPath[MAX_BUF_SIZE]; |
| 315 |
|
iconv_t codeSet; |
| 316 |
|
char outbuf[MAX_BUF_SIZE]; |
| 317 |
|
char* inbufPtr; |
| 318 |
|
char* outbufPtr; |
| 319 |
|
int inbufSize; |
| 320 |
|
int outbufSize; |
| 321 |
wxCSConv conv(wxT(CODE_SET_SYSTEM)); |
wxCSConv conv(wxT(CODE_SET_SYSTEM)); |
|
wxCSConv eucConv(wxT(CODE_SET_EUC_JP)); |
|
| 322 |
wxString* tmpStr; |
wxString* tmpStr; |
| 323 |
|
|
| 324 |
|
codeSet = iconv_open(CODE_SET_SYSTEM, CODE_SET_EUC_JP); |
| 325 |
|
if(codeSet == (iconv_t)-1) { |
| 326 |
|
MN_FATAL_ERROR(wxT("failed iconv_open")); |
| 327 |
|
} |
| 328 |
|
|
| 329 |
if(text) { |
if(text) { |
| 330 |
|
iconv_close(codeSet); |
| 331 |
return text; |
return text; |
| 332 |
} |
} |
| 333 |
|
|
| 339 |
} |
} |
| 340 |
|
|
| 341 |
while(fgets(buf, MAX_BUF_SIZE, fp)) { |
while(fgets(buf, MAX_BUF_SIZE, fp)) { |
| 342 |
tmpStr = new wxString(buf, eucConv); |
#ifdef __WXMAC__ |
| 343 |
|
for(int i = 0; buf[i] != 0; i++) if(buf[i] == (char)MAC_BACKSLASH) buf[i] = '\\'; |
| 344 |
|
#endif |
| 345 |
|
inbufPtr = buf; |
| 346 |
|
inbufSize = sizeof(buf); |
| 347 |
|
outbufPtr = outbuf; |
| 348 |
|
outbufSize = sizeof(outbuf); |
| 349 |
|
memset(outbuf, 0, outbufSize); |
| 350 |
|
iconv(codeSet, (ICONV_CONST char**)&inbufPtr, (size_t*)&inbufSize, &outbufPtr, (size_t*)&outbufSize); |
| 351 |
|
tmpStr = new wxString((char*)outbuf, conv); |
| 352 |
*text += *tmpStr; |
*text += *tmpStr; |
| 353 |
delete tmpStr; |
delete tmpStr; |
| 354 |
} |
} |
| 355 |
|
iconv_close(codeSet); |
| 356 |
fclose(fp); |
fclose(fp); |
| 357 |
|
|
| 358 |
return text; |
return text; |
| 359 |
} |
} |
| 360 |
|
|
| 402 |
|
|
| 403 |
memset(inbuf, 0, sizeof(inbuf)); |
memset(inbuf, 0, sizeof(inbuf)); |
| 404 |
strcpy(inbuf,(const char*)text->mb_str()); |
strcpy(inbuf,(const char*)text->mb_str()); |
| 405 |
|
|
| 406 |
|
#ifdef __WXMAC__ |
| 407 |
|
for(int i = 0; inbuf[i] != 0; i++) if(inbuf[i] == (char)MAC_BACKSLASH) inbuf[i] = '\\'; |
| 408 |
|
#endif |
| 409 |
|
|
| 410 |
inbufPtr = inbuf; |
inbufPtr = inbuf; |
| 411 |
inbufSize = strlen(inbufPtr); |
inbufSize = strlen(inbufPtr); |
| 412 |
outbufPtr = outbuf; |
outbufPtr = outbuf; |