Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=145f8a319db829d7c33b1daef333e8fb71d5470c

commit 145f8a319db829d7c33b1daef333e8fb71d5470c
Author: Marius Cirsta <[email protected]>
Date:   Sun Dec 1 02:55:33 2013 +0200

* make file sizes 64bit values
* move type declarations to fix warnings

diff --git a/lib/libpacman/pacman.c b/lib/libpacman/pacman.c
index e3c5e59..114f1b0 100644
--- a/lib/libpacman/pacman.c
+++ b/lib/libpacman/pacman.c
@@ -493,7 +493,7 @@ int pacman_download_rate(const pmdownload_t *download, 
double *rate)
* @param offset pointer to the value to be written.
* @return return 0 in case of success, !0 otherwise.
*/
-int pacman_download_resume(const pmdownload_t *download, off_t *offset)
+int pacman_download_resume(const pmdownload_t *download, off64_t *offset)
{
ASSERT(download != NULL, return -1);
ASSERT(offset != NULL, return -1);
@@ -507,7 +507,7 @@ int pacman_download_resume(const pmdownload_t *download, 
off_t *offset)
* @param offset pointer to the value to be written.
* @return return 0 in case of success, !0 otherwise.
*/
-int pacman_download_size(const pmdownload_t *download, off_t *offset)
+int pacman_download_size(const pmdownload_t *download, off64_t *offset)
{
ASSERT(download != NULL, return -1);
ASSERT(offset != NULL, return -1);
@@ -521,7 +521,7 @@ int pacman_download_size(const pmdownload_t *download, 
off_t *offset)
* @param offset pointer to the value to be written.
* @return return 0 in case of success, !0 otherwise.
*/
-int pacman_download_tell(const pmdownload_t *download, off_t *offset)
+int pacman_download_tell(const pmdownload_t *download, off64_t *offset)
{
ASSERT(download != NULL, return -1);
ASSERT(offset != NULL, return -1);
@@ -535,7 +535,7 @@ int pacman_download_tell(const pmdownload_t *download, 
off_t *offset)
* @param offset pointer to the value to be written.
* @return return 0 in case of success, !0 otherwise.
*/
-int pacman_download_xfered(const pmdownload_t *download, off_t *offset)
+int pacman_download_xfered(const pmdownload_t *download, off64_t *offset)
{
ASSERT(download != NULL, return -1);
ASSERT(offset != NULL, return -1);
diff --git a/lib/libpacman/pacman.h b/lib/libpacman/pacman.h
index 833bb23..f61f061 100644
--- a/lib/libpacman/pacman.h
+++ b/lib/libpacman/pacman.h
@@ -171,10 +171,10 @@ int pacman_download_begin(const pmdownload_t *download, 
struct timeval *timeval)
int pacman_download_end(const pmdownload_t *download, struct timeval *timeval);
int pacman_download_eta(const pmdownload_t *download, double *eta);
int pacman_download_rate(const pmdownload_t *download, double *rate);
-int pacman_download_resume(const pmdownload_t *download, off_t *offset);
-int pacman_download_size(const pmdownload_t *download, off_t *offset);
-int pacman_download_tell(const pmdownload_t *download, off_t *offset);
-int pacman_download_xfered(const pmdownload_t *download, off_t *offset);
+int pacman_download_resume(const pmdownload_t *download, off64_t *offset);
+int pacman_download_size(const pmdownload_t *download, off64_t *offset);
+int pacman_download_tell(const pmdownload_t *download, off64_t *offset);
+int pacman_download_xfered(const pmdownload_t *download, off64_t *offset);

/*
* Packages
diff --git a/lib/libpacman/server.c b/lib/libpacman/server.c
index 31ea9f4..bfc4794 100644
--- a/lib/libpacman/server.c
+++ b/lib/libpacman/server.c
@@ -122,10 +122,6 @@ void _pacman_server_free(void *data)
free(server);
}

-typedef struct __pmcurldownloader_t pmcurldownloader_t;
-typedef enum __pmdownloadsuccess_t pmdownloadsuccess_t;
-typedef enum __pmfiletype_t pmfiletype_t;
-
struct __pmcurldownloader_t {
CURL *curl;
struct timeval previous_update;
@@ -145,6 +141,10 @@ enum __pmfiletype_t {
PM_FILE_PKG = 1,
};

+typedef struct __pmcurldownloader_t pmcurldownloader_t;
+typedef enum __pmdownloadsuccess_t pmdownloadsuccess_t;
+typedef enum __pmfiletype_t pmfiletype_t;
+
/*
* Progress callback used by libcurl, we then pass our own progress function
*/
diff --git a/lib/libpacman/server.h b/lib/libpacman/server.h
index b5f94ca..b206873 100644
--- a/lib/libpacman/server.h
+++ b/lib/libpacman/server.h
@@ -49,9 +49,9 @@ struct __pmdownload_t {
double dst_avg;
double dst_eta;
double dst_rate;
-       int dst_resume;
-       int dst_size;
-       int dst_tell;
+       off64_t dst_resume;
+       off64_t dst_size;
+       off64_t dst_tell;
};

pmserver_t *_pacman_server_new(char *url);
diff --git a/src/pacman-g2/download.c b/src/pacman-g2/download.c
index 44b505f..2eb40a3 100644
--- a/src/pacman-g2/download.c
+++ b/src/pacman-g2/download.c
@@ -51,7 +51,7 @@ extern unsigned int maxcols;
/* FIXME: log10() want float */
int log_progress(const pmdownload_t *download)
{
-       off_t offset, fsz, tell;
+       off64_t offset, fsz, tell;
int pct;
static int lastpct=0;
unsigned int i, cur;
@@ -148,9 +148,9 @@ int log_progress(const pmdownload_t *download)
}
}
if(rate > 1000) {
-               printf("] %3d%%  %6dK  %6.0fK/s  %02d:%02d:%02d\r", pct, (tell 
/ 1024), rate, eta_h, eta_m, eta_s);
+               printf("] %3d%%  %6lldK  %6.0fK/s  %02d:%02d:%02d\r", pct, 
(long long)(tell / 1024), rate, eta_h, eta_m, eta_s);
} else {
-               printf("] %3d%%  %6dK  %6.1fK/s  %02d:%02d:%02d\r", pct, (tell 
/ 1024), rate, eta_h, eta_m, eta_s);
+               printf("] %3d%%  %6lldK  %6.1fK/s  %02d:%02d:%02d\r", pct, 
(long long)(tell / 1024), rate, eta_h, eta_m, eta_s);
}
if(lastpct != 100 && pct == 100) {
printf("\n");
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to