Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnModel.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7 by maloninc, Wed Aug 10 05:49:11 2005 UTC revision 1.8 by maloninc, Wed Aug 10 06:06:16 2005 UTC
# Line 4  Line 4 
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 ************************/
# Line 48  WikiList* mnModel::search(const char* se Line 48  WikiList* mnModel::search(const char* se
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);
# Line 75  WikiList* mnModel::search(const char* se Line 76  WikiList* mnModel::search(const char* se
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);
# Line 375  void WikiData::save() Line 380  void WikiData::save()
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];

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26