[Pkg-owncloud-commits] [owncloud-client] 38/70: csync file util: Remove compare file function, not needed anymore.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Jul 1 10:21:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 407b3bebfeb8f9f0493382c9f9cd2216e134107e
Author: Klaas Freitag <freitag at owncloud.com>
Date: Fri Jun 20 11:38:24 2014 +0200
csync file util: Remove compare file function, not needed anymore.
This also fixes Coverity CID 12890 and CID 12898
---
csync/src/std/c_file.c | 84 --------------------------------------------------
csync/src/std/c_file.h | 10 ------
2 files changed, 94 deletions(-)
diff --git a/csync/src/std/c_file.c b/csync/src/std/c_file.c
index 61984b3..7745a34 100644
--- a/csync/src/std/c_file.c
+++ b/csync/src/std/c_file.c
@@ -260,87 +260,3 @@ int c_rename( const char *src, const char *dst ) {
return rc;
}
-
-int c_compare_file( const char *f1, const char *f2 ) {
- mbchar_t *wf1, *wf2;
- int fd1 = -1, fd2 = -1;
- size_t size1, size2;
- char buffer1[BUFFER_SIZE];
- char buffer2[BUFFER_SIZE];
- csync_stat_t stat1;
- csync_stat_t stat2;
-
- int rc = -1;
-
- if(f1 == NULL || f2 == NULL) return -1;
-
- wf1 = c_utf8_to_locale(f1);
- if(wf1 == NULL) {
- return -1;
- }
-
- wf2 = c_utf8_to_locale(f2);
- if(wf2 == NULL) {
- c_free_locale_string(wf1);
- return -1;
- }
-
-#ifdef _WIN32
- _fmode = _O_BINARY;
-#endif
-
- fd1 = _topen(wf1, O_RDONLY);
- if(fd1 < 0) {
- rc = -1;
- goto out;
- }
-
- fd2 = _topen(wf2, O_RDONLY);
- if(fd2 < 0) {
- rc = -1;
- goto out;
- }
-
- /* compare size first. */
- rc = _tfstat(fd1, &stat1);
- if (rc < 0) {
- goto out;
- }
-
- rc = _tfstat(fd2, &stat2);
- if (rc < 0) {
- goto out;
- }
-
- /* if sizes are different, the files can not be equal. */
- if (stat1.st_size != stat2.st_size) {
- rc = 0;
- goto out;
- }
-
- while( (size1 = read(fd1, buffer1, BUFFER_SIZE)) > 0 ) {
- size2 = read( fd2, buffer2, BUFFER_SIZE );
-
- if( size1 != size2 ) {
- rc = 0;
- goto out;
- }
- if(memcmp(buffer1, buffer2, size1) != 0) {
- /* buffers are different */
- rc = 0;
- goto out;
- }
- }
-
- rc = 1;
-
-out:
-
- if(fd1 > -1) close(fd1);
- if(fd2 > -1) close(fd2);
-
- c_free_locale_string( wf1 );
- c_free_locale_string( wf2 );
- return rc;
-
-}
diff --git a/csync/src/std/c_file.h b/csync/src/std/c_file.h
index d952b39..1a32249 100644
--- a/csync/src/std/c_file.h
+++ b/csync/src/std/c_file.h
@@ -76,16 +76,6 @@ int c_isfile(const char *path);
int c_copy(const char *src, const char *dst, mode_t mode);
/**
- * @brief Compare the content of two files byte by byte.
- * @param f1 Path of file 1
- * @param f2 Path of file 2
- *
- * @return 0 if the files differ, 1 if the files are equal or -1 on
- * error with errno set.
- */
-int c_compare_file( const char *f1, const char *f2 );
-
-/**
* @brief move a file from source to destination.
*
* @param src Path to the source file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list