Diff for /libaitsync/src/dir.c between versions 1.5 and 1.5.4.1

version 1.5, 2014/02/04 16:58:17 version 1.5.4.1, 2016/08/18 09:53:02
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 - 2014Copyright 2004 - 2016
         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 142  create_diridx(const char *csDir, int lm, int *tags, st Line 142  create_diridx(const char *csDir, int lm, int *tags, st
                         memset(&l[n + 1], 0, sizeof(struct tagDirName));                          memset(&l[n + 1], 0, sizeof(struct tagDirName));
   
                 l[n].ch = DIFF_D1;                  l[n].ch = DIFF_D1;
   #ifndef __linux__
                 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);
   #else
                   l[n].tag = crcFletcher16((u_short*) d.d_name, 
                                   strlen(d.d_name) / 2 + strlen(d.d_name) % 2);
                   l[n].hash = crcAdler((u_char*) d.d_name, strlen(d.d_name));
   #endif
                 strlcpy(l[n].name, d.d_name, sizeof l[n].name);                  strlcpy(l[n].name, d.d_name, sizeof l[n].name);
                 if (lm & 1) {                  if (lm & 1) {
                         if (lstat(d.d_name, &sb) != -1) {                          if (lstat(d.d_name, &sb) != -1) {
Line 190  create_diridx(const char *csDir, int lm, int *tags, st Line 196  create_diridx(const char *csDir, int lm, int *tags, st
                                                 break;                                                  break;
                                 }                                  }
                                 snprintf(l[n].extra, sizeof l[n].extra,                                   snprintf(l[n].extra, sizeof l[n].extra, 
                                                "%s links=%d inode=%ld %d:%d perm=0%o size=%ld %s",                                                 "%s links=%ld inode=%ld %d:%d perm=0%o size=%ld %s", 
                                                szType, sb.st_nlink, (long) sb.st_ino,                                                 szType, (long) sb.st_nlink, (long) sb.st_ino, 
                                                 sb.st_uid, sb.st_gid, sb.st_mode & 0x1fff,                                                   sb.st_uid, sb.st_gid, sb.st_mode & 0x1fff, 
                                                 (long) sb.st_size, szStr);                                                  (long) sb.st_size, szStr);
                         }                          }
Line 247  sync_dirChkSum(const char *csDir, u_char **md) Line 253  sync_dirChkSum(const char *csDir, u_char **md)
         while (!readdir_r(dir, &d, &pd) && pd) {          while (!readdir_r(dir, &d, &pd) && pd) {
                 if (d.d_type == DT_DIR && (!strcmp(d.d_name, ".") || !strcmp(d.d_name, "..")))                  if (d.d_type == DT_DIR && (!strcmp(d.d_name, ".") || !strcmp(d.d_name, "..")))
                         continue;                          continue;
   #ifndef __linux__
                 MD5_Update(&ctx, d.d_name, d.d_namlen);                  MD5_Update(&ctx, d.d_name, d.d_namlen);
   #else
                   MD5_Update(&ctx, d.d_name, strlen(d.d_name));
   #endif
                 ret++;                  ret++;
         }          }
         MD5_Final(*md, &ctx);          MD5_Final(*md, &ctx);
Line 351  sync_dircmpList(const char *csDir1, const char *csDir2 Line 361  sync_dircmpList(const char *csDir1, const char *csDir2
                         if (d.d_type == DT_DIR && (!strcmp(d.d_name, ".") || !strcmp(d.d_name, "..")))                          if (d.d_type == DT_DIR && (!strcmp(d.d_name, ".") || !strcmp(d.d_name, "..")))
                                 continue;                                  continue;
                         else {                          else {
   #ifndef __linux__
                                 t = crcFletcher16((u_short*) d.d_name, d.d_namlen / 2 + d.d_namlen % 2);                                  t = crcFletcher16((u_short*) d.d_name, d.d_namlen / 2 + d.d_namlen % 2);
                                 hash = crcAdler((u_char*) d.d_name, d.d_namlen);                                  hash = crcAdler((u_char*) d.d_name, d.d_namlen);
   #else
                                   t = crcFletcher16((u_short*) d.d_name, strlen(d.d_name) / 2 + strlen(d.d_name) % 2);
                                   hash = crcAdler((u_char*) d.d_name, strlen(d.d_name));
   #endif
                         }                          }
   
                         find = find_tag(tags, l, t, hash);                          find = find_tag(tags, l, t, hash);
Line 417  sync_dircmpList(const char *csDir1, const char *csDir2 Line 432  sync_dircmpList(const char *csDir1, const char *csDir2
                                                                 break;                                                                  break;
                                                 }                                                  }
                                                 snprintf(l[n].extra, sizeof l[n].extra,                                                   snprintf(l[n].extra, sizeof l[n].extra, 
                                                                "%s links=%d inode=%ld %d:%d perm=0%o "                                                                "%s links=%ld inode=%ld %d:%d perm=0%o "
                                                                "size=%ld %s", szType, sb.st_nlink,                                                                 "size=%ld %s", szType, (long) sb.st_nlink, 
                                                                 (long) sb.st_ino, sb.st_uid, sb.st_gid,                                                                   (long) sb.st_ino, sb.st_uid, sb.st_gid, 
                                                                 sb.st_mode & 0x1fff, (long) sb.st_size,                                                                   sb.st_mode & 0x1fff, (long) sb.st_size, 
                                                                 szStr);                                                                  szStr);

Removed from v.1.5  
changed lines
  Added in v.1.5.4.1


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