| 4 |
#include <wx/regex.h> |
#include <wx/regex.h> |
| 5 |
#include <iconv.h> |
#include <iconv.h> |
| 6 |
|
|
| 7 |
/* プロトタイプ */ |
static void toLower(char* string); |
| 8 |
static char* decode(const char* string); |
static char* decode(const char* string); |
| 9 |
static char* encode(const char* string); |
static char* encode(const char* string); |
| 10 |
static int compWikiData(const void* wiki1, const void* wiki2); |
static int compWikiData(const void* wiki1, const void* wiki2); |
| 11 |
|
|
| 12 |
|
|
| 13 |
/******* WikiList ************************/ |
/******* WikiList ************************/ |
| 48 |
int inbufSize = strlen(searchStr); |
int inbufSize = strlen(searchStr); |
| 49 |
int outbufSize = sizeof(outbuf); |
int outbufSize = sizeof(outbuf); |
| 50 |
const char* decodeFileName; |
const char* decodeFileName; |
| 51 |
|
char decodeFileNameBuf[MAX_BUF_SIZE]; |
| 52 |
|
|
| 53 |
memset(outbuf, 0, outbufSize); |
memset(outbuf, 0, outbufSize); |
| 54 |
codeSet = iconv_open(CODE_SET_EUC_JP, CODE_SET_SYSTEM); |
codeSet = iconv_open(CODE_SET_EUC_JP, CODE_SET_SYSTEM); |
| 76 |
fread(buf, MAX_BUF_SIZE-1, 1, fp); |
fread(buf, MAX_BUF_SIZE-1, 1, fp); |
| 77 |
if(buf[0] == 0) break; |
if(buf[0] == 0) break; |
| 78 |
decodeFileName = decode(fileName->mb_str()); |
decodeFileName = decode(fileName->mb_str()); |
| 79 |
|
snprintf(decodeFileNameBuf, MAX_BUF_SIZE, "%s", decodeFileName); |
| 80 |
|
toLower(buf); |
| 81 |
|
toLower(outbuf); |
| 82 |
|
toLower(decodeFileNameBuf); |
| 83 |
if(strstr((const char*)buf, (const char*)outbuf) || |
if(strstr((const char*)buf, (const char*)outbuf) || |
| 84 |
strstr((const char*)decodeFileName, (const char*)outbuf)) { |
strstr((const char*)decodeFileName, (const char*)outbuf)) { |
| 85 |
wikiData = new WikiData(wikiDataDir, (const char*)fileName->mb_str(), fp); |
wikiData = new WikiData(wikiDataDir, (const char*)fileName->mb_str(), fp); |
| 380 |
|
|
| 381 |
/******* Tools ************************/ |
/******* Tools ************************/ |
| 382 |
|
|
| 383 |
|
static void toLower(char* string) |
| 384 |
|
{ |
| 385 |
|
int i; |
| 386 |
|
|
| 387 |
|
for(i = 0; string[i] != 0; i++) { |
| 388 |
|
string[i] = tolower(string[i]); |
| 389 |
|
} |
| 390 |
|
} |
| 391 |
|
|
| 392 |
|
|
| 393 |
static char* decode(const char* string) |
static char* decode(const char* string) |
| 394 |
{ |
{ |
| 395 |
static char buf[MAX_BUF_SIZE]; |
static char buf[MAX_BUF_SIZE]; |