Diff for /libaitsync/src/dir.c between versions 1.3.2.3 and 1.4.6.1

version 1.3.2.3, 2012/11/13 13:53:14 version 1.4.6.1, 2014/02/04 16:39:00
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012Copyright 2004 - 2014
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 65  find_tag(int const * __restrict tags, struct tagDirNam Line 65  find_tag(int const * __restrict tags, struct tagDirNam
                         if (l[tags[t] + i].hash == hash) {                          if (l[tags[t] + i].hash == hash) {
                                 /* finded & marked for delete! */                                  /* finded & marked for delete! */
                                 find = (struct tagDirName*) &l[tags[t] + i];                                  find = (struct tagDirName*) &l[tags[t] + i];
                                find->ch = '*';                                find->ch = DIFF_D0;
                                 break;                                  break;
                         }                          }
         }          }
Line 141  create_diridx(const char *csDir, int lm, int *tags, st Line 141  create_diridx(const char *csDir, int lm, int *tags, st
                 } else                  } else
                         memset(&l[n + 1], 0, sizeof(struct tagDirName));                          memset(&l[n + 1], 0, sizeof(struct tagDirName));
   
                l[n].ch = '<';                l[n].ch = DIFF_D1;
                 l[n].tag = crcFletcher16((u_short*) d.d_name,                   l[n].tag = crcFletcher16((u_short*) d.d_name, 
                                 d.d_namlen / 2 + d.d_namlen % 2);                                  d.d_namlen / 2 + d.d_namlen % 2);
                 l[n].hash = crcAdler((u_char*) d.d_name, d.d_namlen);                  l[n].hash = crcAdler((u_char*) d.d_name, d.d_namlen);
Line 324  sync_dircmpList(const char *csDir1, const char *csDir2 Line 324  sync_dircmpList(const char *csDir1, const char *csDir2
   
         if (lstat(csDir2, &sb) == -1) {          if (lstat(csDir2, &sb) == -1) {
                 LOGERR;                  LOGERR;
                   free(tags);
                 free(l);                  free(l);
                 return -1;                  return -1;
         }          }
Line 333  sync_dircmpList(const char *csDir1, const char *csDir2 Line 334  sync_dircmpList(const char *csDir1, const char *csDir2
                         LOGERR;                          LOGERR;
                         chdir(old);                          chdir(old);
                         free(old);                          free(old);
                           free(tags);
                         free(l);                          free(l);
                         return -1;                          return -1;
                 }                  }
Line 341  sync_dircmpList(const char *csDir1, const char *csDir2 Line 343  sync_dircmpList(const char *csDir1, const char *csDir2
                         LOGERR;                          LOGERR;
                         chdir(old);                          chdir(old);
                         free(old);                          free(old);
                           free(tags);
                         free(l);                          free(l);
                         return -1;                          return -1;
                 }                  }
Line 361  sync_dircmpList(const char *csDir1, const char *csDir2 Line 364  sync_dircmpList(const char *csDir1, const char *csDir2
                                         chdir(old);                                          chdir(old);
                                         free(old);                                          free(old);
                                         closedir(dir);                                          closedir(dir);
                                           free(tags);
                                         return -1;                                          return -1;
                                 } else                                  } else
                                         memset(&l[n + 1], 0, sizeof(struct tagDirName));                                          memset(&l[n + 1], 0, sizeof(struct tagDirName));
   
                                l[n].ch = '>';                                l[n].ch = DIFF_D2;
                                 l[n].tag = t;                                  l[n].tag = t;
                                 l[n].hash = hash;                                  l[n].hash = hash;
                                 strlcpy(l[n].name, d.d_name, sizeof l[n].name);                                  strlcpy(l[n].name, d.d_name, sizeof l[n].name);
Line 432  sync_dircmpList(const char *csDir1, const char *csDir2 Line 436  sync_dircmpList(const char *csDir1, const char *csDir2
                         f = fopen(csDir2, "r");                          f = fopen(csDir2, "r");
                         if (!f) {                          if (!f) {
                                 LOGERR;                                  LOGERR;
                                   free(tags);
                                 free(l);                                  free(l);
                                 return -1;                                  return -1;
                         }                          }
Line 460  sync_dircmpList(const char *csDir1, const char *csDir2 Line 465  sync_dircmpList(const char *csDir1, const char *csDir2
                                         LOGERR;                                          LOGERR;
                                         if (strcmp(csDir2, "-"))                                          if (strcmp(csDir2, "-"))
                                                 fclose(f);                                                  fclose(f);
                                           free(tags);
                                         return -1;                                          return -1;
                                 } else                                  } else
                                         memset(&l[n + 1], 0, sizeof(struct tagDirName));                                          memset(&l[n + 1], 0, sizeof(struct tagDirName));
   
                                l[n].ch = '>';                                l[n].ch = DIFF_D2;
                                 l[n].tag = t;                                  l[n].tag = t;
                                 l[n].hash = hash;                                  l[n].hash = hash;
                                 strlcpy(l[n].name, str, sizeof l[n].name);                                  strlcpy(l[n].name, str, sizeof l[n].name);
Line 480  sync_dircmpList(const char *csDir1, const char *csDir2 Line 486  sync_dircmpList(const char *csDir1, const char *csDir2
   
         /* delete equal elemets !!! */          /* delete equal elemets !!! */
         for (i = cx = 0; i < n; i++)          for (i = cx = 0; i < n; i++)
                if (l[i].ch == '*') {                if (l[i].ch == DIFF_D0) {
                         memmove(&l[i], &l[i + 1], (n - i + 1) * sizeof(struct tagDirName));                          memmove(&l[i], &l[i + 1], (n - i + 1) * sizeof(struct tagDirName));
                         cx++;                          cx++;
                         i--;                          i--;
                 }                  }
         n -= cx;          n -= cx;
   
           free(tags);
         *list = l;          *list = l;
         return n;          return n;
 }  }

Removed from v.1.3.2.3  
changed lines
  Added in v.1.4.6.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>