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.11 by maloninc, Fri Aug 12 07:59:51 2005 UTC revision 1.18 by maloninc, Tue Sep 13 04:22:15 2005 UTC
# Line 64  WikiList* mnModel::search(const char* se Line 64  WikiList* mnModel::search(const char* se
64    
65          /* searchStr to Tokens */          /* searchStr to Tokens */
66          token = strtok(outbuf, " ");          token = strtok(outbuf, " ");
67            if(token == NULL) return list;
68          tokenList[0] = (char*)malloc(strlen(token)+1);          tokenList[0] = (char*)malloc(strlen(token)+1);
69          snprintf(tokenList[0], strlen(token)+1, "%s", token);          snprintf(tokenList[0], strlen(token)+1, "%s", token);
70          i = 1;          i = 1;
# Line 94  WikiList* mnModel::search(const char* se Line 95  WikiList* mnModel::search(const char* se
95                          decodeFileName = decode(fileName->mb_str());                          decodeFileName = decode(fileName->mb_str());
96                          snprintf(decodeFileNameBuf, MAX_BUF_SIZE, "%s", decodeFileName);                          snprintf(decodeFileNameBuf, MAX_BUF_SIZE, "%s", decodeFileName);
97                          toLower(buf);                          toLower(buf);
                         toLower(outbuf);  
98                          toLower(decodeFileNameBuf);                          toLower(decodeFileNameBuf);
99                          found = TRUE;                          found = TRUE;
100                          for(i = 0; tokenList[i] != NULL; i++){                          for(i = 0; tokenList[i] != NULL; i++){
101                                    toLower(tokenList[i]);
102                                  if(strstr((const char*)buf, (const char*)tokenList[i]) ||                                  if(strstr((const char*)buf, (const char*)tokenList[i]) ||
103                                          strstr((const char*)decodeFileName, (const char*)tokenList[i])) {                                          strstr((const char*)decodeFileNameBuf, (const char*)tokenList[i]) ||
104                                            strcmp((const char*)tokenList[i], (const char*)ALLMEMO_TAG) == 0) {
105                                          found = TRUE;                                          found = TRUE;
106                                  }                                  }
107                                  else {                                  else {
# Line 132  void mnModel::addSearchStr(wxString* sea Line 134  void mnModel::addSearchStr(wxString* sea
134    
135          if(searchStrList->Index(searchStr->c_str()) == wxNOT_FOUND){          if(searchStrList->Index(searchStr->c_str()) == wxNOT_FOUND){
136                  string = new wxString(searchStr->c_str());                  string = new wxString(searchStr->c_str());
137                  searchStrList->Add(*string, 1);                  //searchStrList->Add(*string, 1);
138                    searchStrList->Insert(*string, 0);
139          }          }
140  }  }
141    
# Line 287  void WikiData::modSubject(wxString* newS Line 290  void WikiData::modSubject(wxString* newS
290          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());
291    
292          if((fp = fopen(newFullPath, "r")) == NULL) {          if((fp = fopen(newFullPath, "r")) == NULL) {
293                  rename(oldFullPath, newFullPath);                  if(rename(oldFullPath, newFullPath) < 0) wxLogMessage(wxT("rename error: errno=[%d]"), errno);
294          }          }
295          else if(strcmp(oldFullPath, newFullPath)){          else if(strcmp(oldFullPath, newFullPath)){
296                  wxLogMessage(wxT("File has already exist. [%s]"), fileName->c_str());                  wxLogMessage(wxT("File has already exist. [%s]"), fileName->c_str());
297                  fclose(fp);                  fclose(fp);
298          }          }
299            else {
300                    fclose(fp);
301            }
302    
303          delete oldSubject;          delete oldSubject;
304          delete oldFileName;          delete oldFileName;
# Line 336  const wxString* WikiData::getText() Line 342  const wxString* WikiData::getText()
342          }          }
343    
344          while(fgets(buf, MAX_BUF_SIZE, fp)) {          while(fgets(buf, MAX_BUF_SIZE, fp)) {
345    #ifdef __WXMAC__
346                    for(int i = 0; buf[i] != 0; i++) if(buf[i] == (char)MAC_BACKSLASH) buf[i] = '\\';
347    #endif
348                  inbufPtr = buf;                  inbufPtr = buf;
349                  inbufSize = sizeof(buf);                  inbufSize = sizeof(buf);
350                  outbufPtr = outbuf;                  outbufPtr = outbuf;
# Line 396  void WikiData::save() Line 405  void WikiData::save()
405    
406          memset(inbuf, 0, sizeof(inbuf));          memset(inbuf, 0, sizeof(inbuf));
407          strcpy(inbuf,(const char*)text->mb_str());          strcpy(inbuf,(const char*)text->mb_str());
408    
409    #ifdef __WXMAC__
410            for(int i = 0; inbuf[i] != 0; i++) if(inbuf[i] == (char)MAC_BACKSLASH) inbuf[i] = '\\';
411    #endif
412    
413          inbufPtr = inbuf;          inbufPtr = inbuf;
414          inbufSize = strlen(inbufPtr);          inbufSize = strlen(inbufPtr);
415          outbufPtr = outbuf;          outbufPtr = outbuf;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.18

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