Changeset 4787a45 in tol


Ignore:
Timestamp:
Oct 21, 2009, 2:30:51 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
6576368
Parents:
40de24b
Message:

Now CZipArchive::FindFile returns ZIP_FILE_INDEX_NOT_FOUND instead of -1 when the files is not found

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1544 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol/OIS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tol/OIS/oisstream_zip.cpp

    r40de24b r4787a45  
    131131  entries_ = 0;
    132132  isOk_ = true;
    133   BText action = I2("'INVALID ACTION'", "'ACCIÓN INVÁLIDA'");
     133  BText action = I2("'INVALID ACTION'", "'ACCIN INVLIDA'");
    134134  try
    135135  {
    … …  
    137137    {
    138138      action = I2("reading","lectura");
    139       if(index<0)
     139      if((index<0) || (index==ZIP_FILE_INDEX_NOT_FOUND))
    140140      {
    141141        index = sh_.zip_.FindFile(name_);
    142142      }
    143       isOk_ = index>=0;
     143      isOk_ = ((index>=0) && (index!=ZIP_FILE_INDEX_NOT_FOUND));
    144144      if(isOk_)
    145145      {
    … …  
    153153    {
    154154      action = I2("writing","escritura");
    155     //int index = sh_.zip_.FindFile(name_);
    156     //if(index>=0) { sh_.zip_.DeleteFile(index); }
    157     //isOk_ = index<0;
    158155    }
    159156  }
    … …  
    230227    {
    231228      sh_.zip_.AddNewFile(mf_, name_.String(), cmprsLvl_);
    232                         //VBR: No sé porqué en linux no se cumple esta condición pero
     229                        //VBR: No s porqu en linux no se cumple esta condicin pero
    233230                        //luego todo parece funcionar bien.
    234231      //assert(index_>=0);
    … …  
    424421//Std(BText("\nOpening ZIP ")+connection_);
    425422  openMode_ = openMode;
    426   BText action = I2("'INVALID ACTION'", "'ACCIÓN INVÁLIDA'");
     423  BText action = I2("'INVALID ACTION'", "'ACCIN INVLIDA'");
    427424  try
    428425  {
    … …  
    532529    index = -1;
    533530  }
    534   return(index>=0);
     531  return((index>=0) && (index!=ZIP_FILE_INDEX_NOT_FOUND));
    535532}
    536533
  • tol/OIS/tol_oisstream_zip.h

    r40de24b r4787a45  
    4141  void Disconnect();
    4242  BMedia Media() { return(BSHM_zip); }
    43   BStream* Open(const char* title, const char* name, int index=-1);
     43  BStream* Open(const char* title, const char* name, int index=ZIP_FILE_INDEX_NOT_FOUND);
    4444  bool HasFile(const char* fileName) const;
    4545  bool RemoveFiles(const BArray<BText>& files);
Note: See TracChangeset for help on using the changeset viewer.