Advertisement
Guest User

Untitled

a guest
May 30th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. Index: HashManager.cpp
  2. ===================================================================
  3. --- HashManager.cpp (revision 1165)
  4. +++ HashManager.cpp (working copy)
  5. @@ -97,8 +97,13 @@
  6. void HashManager::HashStore::addFile(const string& aFileName, uint32_t aTimeStamp, const TigerTree& tth, bool aUsed) {
  7. addTree(tth);
  8.  
  9. +#ifdef _WIN32
  10. string fname = Text::toLower(Util::getFileName(aFileName));
  11. string fpath = Text::toLower(Util::getFilePath(aFileName));
  12. +#else
  13. + string fname = Util::getFileName(aFileName);
  14. + string fpath = Util::getFilePath(aFileName);
  15. +#endif
  16.  
  17. FileInfoList& fileList = fileIndex[fpath];
  18.  
  19. @@ -186,8 +191,13 @@
  20. }
  21.  
  22. bool HashManager::HashStore::checkTTH(const string& aFileName, int64_t aSize, uint32_t aTimeStamp) {
  23. +#ifdef _WIN32
  24. string fname = Text::toLower(Util::getFileName(aFileName));
  25. string fpath = Text::toLower(Util::getFilePath(aFileName));
  26. +#else
  27. + string fname = Util::getFileName(aFileName);
  28. + string fpath = Util::getFilePath(aFileName);
  29. +#endif
  30. DirIter i = fileIndex.find(fpath);
  31. if (i != fileIndex.end()) {
  32. FileInfoIter j = find(i->second.begin(), i->second.end(), fname);
  33. @@ -206,9 +216,13 @@
  34. }
  35.  
  36. const TTHValue* HashManager::HashStore::getTTH(const string& aFileName) {
  37. +#ifdef _WIN32
  38. string fname = Text::toLower(Util::getFileName(aFileName));
  39. string fpath = Text::toLower(Util::getFilePath(aFileName));
  40. -
  41. +#else
  42. + string fname = Util::getFileName(aFileName);
  43. + string fpath = Util::getFilePath(aFileName);
  44. +#endif
  45. DirIter i = fileIndex.find(fpath);
  46. if (i != fileIndex.end()) {
  47. FileInfoIter j = find(i->second.begin(), i->second.end(), fname);
  48. @@ -225,6 +239,7 @@
  49. DirMap newFileIndex;
  50. TreeMap newTreeIndex;
  51.  
  52. +
  53. for (DirIter i = fileIndex.begin(); i != fileIndex.end(); ++i) {
  54. for (FileInfoIter j = i->second.begin(); j != i->second.end(); ++j) {
  55. if (!j->getUsed())
  56. @@ -412,9 +427,13 @@
  57. const string& root = getAttrib(attribs, sRoot, 2);
  58.  
  59. if (!file.empty() && size >= 0 && timeStamp > 0 && !root.empty()) {
  60. +#ifdef _WIN32
  61. string fname = Text::toLower(Util::getFileName(file));
  62. string fpath = Text::toLower(Util::getFilePath(file));
  63. -
  64. +#else
  65. + string fname = Util::getFileName(file);
  66. + string fpath = Util::getFilePath(file);
  67. +#endif
  68. store.fileIndex[fpath].push_back(HashManager::HashStore::FileInfo(fname, TTHValue(root), timeStamp,
  69. false));
  70. }
  71. Index: ShareManager.cpp
  72. ===================================================================
  73. --- ShareManager.cpp (revision 1165)
  74. +++ ShareManager.cpp (working copy)
  75. @@ -811,8 +811,11 @@
  76. //}
  77.  
  78. void ShareManager::updateIndices(Directory& dir) {
  79. +#ifdef _WIN32
  80. bloom.add(Text::toLower(dir.getName()));
  81. -
  82. +#else
  83. + bloom.add(dir.getName());
  84. +#endif
  85. for(Directory::MapIter i = dir.directories.begin(); i != dir.directories.end(); ++i) {
  86. updateIndices(*i->second);
  87. }
  88. @@ -854,7 +857,11 @@
  89. dir.addType(getType(f.getName()));
  90.  
  91. tthIndex.insert(make_pair(f.getTTH(), i));
  92. +#ifdef _WIN32
  93. bloom.add(Text::toLower(f.getName()));
  94. +#else
  95. + bloom.add(f.getName());
  96. +#endif
  97. }
  98.  
  99. void ShareManager::refresh(bool dirs /* = false */, bool aUpdate /* = true */, bool block /* = false */) throw() {
  100. @@ -1308,7 +1315,11 @@
  101. }
  102. return;
  103. }
  104. +//#ifdef _WIN32
  105. StringTokenizer<string> t(Text::toLower(aString), '$');
  106. +//#else
  107. +// StringTokenizer<string> t(aString, '$');
  108. +//#endif
  109. StringList& sl = t.getTokens();
  110. if(!bloom.match(sl))
  111. return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement