Ticket #7269: stricmp-define.patch

File stricmp-define.patch, 4.0 KB (added by kevin_lo@…, 19 years ago)

New patch file

  • commandline.cpp

    old new  
    2727#endif
    2828#endif
    2929
     30#define stricmp(s1,s2) strcasecmp(s1,s2)
     31
    3032CommandLine::ExtraFile::ExtraFile(void)
    3133: filename()
    3234, filesize(0)
  • par2repairer.cpp

    old new  
    2727#endif
    2828#endif
    2929
     30#define stricmp(s1,s2) strcasecmp(s1,s2)
     31
    3032Par2Repairer::Par2Repairer(void)
    3133{
    3234  firstpacket = true;
  • .cpp

    old new  
    5151  }
    5252}
    5353
    54 bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
     54template <> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
    5555{
    5656  inputcount = (u32)present.size();
    5757
     
    8080  return true;
    8181}
    8282
    83 bool ReedSolomon<Galois8>::SetInput(u32 count)
     83template <> bool ReedSolomon<Galois8>::SetInput(u32 count)
    8484{
    8585  inputcount = count;
    8686
     
    101101  return true;
    102102}
    103103
    104 bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
     104template <> bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
    105105{
    106106  // Look up the appropriate element in the RS matrix
    107107  Galois8 factor = leftmatrix[outputindex * (datapresent + datamissing) + inputindex];
     
    189189
    190190// Set which of the source files are present and which are missing
    191191// and compute the base values to use for the vandermonde matrix.
    192 bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
     192template <> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
    193193{
    194194  inputcount = (u32)present.size();
    195195
     
    233233
    234234// Record that the specified number of source files are all present
    235235// and compute the base values to use for the vandermonde matrix.
    236 bool ReedSolomon<Galois16>::SetInput(u32 count)
     236template <> bool ReedSolomon<Galois16>::SetInput(u32 count)
    237237{
    238238  inputcount = count;
    239239
     
    267267  return true;
    268268}
    269269
    270 bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
     270template <> bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
    271271{
    272272  // Look up the appropriate element in the RS matrix
    273273
  • diskfile.cpp

     
    618618  return result;
    619619}
    620620
     621bool is_regular_file(const string &p)
     622{
     623  struct stat st;
     624  return (stat(p.c_str(), &st) == 0 && S_ISREG(st.st_mode));
     625}
     626
    621627list<string>* DiskFile::FindFiles(string path, string wildcard)
    622628{
    623629  list<string> *matches = new list<string>;
     
    648654              name.substr(0, where) == front &&
    649655              name.substr(name.size()-back.size()) == back)
    650656          {
    651             matches->push_back(path + name);
     657            if (is_regular_file(path + name))
     658            {
     659              matches->push_back(path + name);
     660            }
     661            else
     662            {
     663              cerr << "Warning: '" << (path + name)
     664                   << "' ignored; not a regular file" << endl;
     665            }
    652666          }
    653667        }
    654668        else
     
    667681
    668682            if (pw == wildcard.end())
    669683            {
    670               matches->push_back(path + name);
     684              if (is_regular_file(path + name))
     685              {
     686                matches->push_back(path + name);
     687              }
     688              else
     689              {
     690                cerr << "Warning: '" << (path + name)
     691                     << "' ignored; not a regular file" << endl;
     692              }
    671693            }
    672694          }
    673695        }
     
    678700  }
    679701  else
    680702  {
    681     struct stat st;
    682     string fn = path + wildcard;
    683     if (stat(fn.c_str(), &st) == 0)
     703    if (is_regular_file(path + wildcard))
    684704    {
    685705      matches->push_back(path + wildcard);
    686706    }
     707    else
     708    {
     709      cerr << "Warning: '" << (path + wildcard)
     710           << "' ignored; not a regular file" << endl;
     711    }
    687712  }
    688713
    689714  return matches;