Switch to unified view

a/src/utils/pathut.cpp b/src/utils/pathut.cpp
...
...
57
#include "pathut.h"
57
#include "pathut.h"
58
#include "transcode.h"
58
#include "transcode.h"
59
#include "wipedir.h"
59
#include "wipedir.h"
60
#include "md5ut.h"
60
#include "md5ut.h"
61
61
62
bool fsocc(const string &path, int *pc, long *blocks)
62
bool fsocc(const string &path, int *pc, long long *blocks)
63
{
63
{
64
#ifdef sun
64
#ifdef sun
65
    struct statvfs buf;
65
    struct statvfs buf;
66
    if (statvfs(path.c_str(), &buf) != 0) {
66
    if (statvfs(path.c_str(), &buf) != 0) {
67
    return false;
67
    return false;
...
...
86
#define FSOCC_MB (1024*1024)
86
#define FSOCC_MB (1024*1024)
87
    if (buf.f_bsize > 0) {
87
    if (buf.f_bsize > 0) {
88
        int ratio = buf.f_bsize > FSOCC_MB ? buf.f_bsize / FSOCC_MB :
88
        int ratio = buf.f_bsize > FSOCC_MB ? buf.f_bsize / FSOCC_MB :
89
        FSOCC_MB / buf.f_bsize;
89
        FSOCC_MB / buf.f_bsize;
90
90
91
      *blocks = buf.f_bsize > FSOCC_MB ? long(buf.f_bavail) * ratio :
91
      *blocks = buf.f_bsize > FSOCC_MB ? 
92
                ((long long)buf.f_bavail) * ratio :
92
        long(buf.f_bavail) / ratio;
93
        ((long long)buf.f_bavail) / ratio;
93
    }
94
    }
94
    }
95
    }
95
    return true;
96
    return true;
96
}
97
}
97
98
...
...
888
    exit(1);
889
    exit(1);
889
    }
890
    }
890
  string path = *argv++;argc--;
891
  string path = *argv++;argc--;
891
892
892
  int pc;
893
  int pc;
893
  long blocks;
894
  long long blocks;
894
  if (!fsocc(path, &pc, &blocks)) {
895
  if (!fsocc(path, &pc, &blocks)) {
895
      fprintf(stderr, "fsocc failed\n");
896
      fprintf(stderr, "fsocc failed\n");
896
      return 1;
897
      return 1;
897
  }
898
  }
898
  printf("pc %d, megabytes %ld\n", pc, blocks);
899
  printf("pc %d, megabytes %ld\n", pc, blocks);