Sfoglia il codice sorgente

Remove the unusued csync_file_locked_or_open test in csync_reconcile

It is unused. Also remove the corresponding error code
Olivier Goffart 8 anni fa
parent
commit
1c11778693

+ 0 - 1
src/csync/csync.h

@@ -108,7 +108,6 @@ enum csync_status_codes_e {
     CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS,
     CSYNC_STATUS_INDIVIDUAL_TRAILING_SPACE,
     CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME,
-    CYSNC_STATUS_FILE_LOCKED_OR_OPEN,
     CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN,
     CSYNC_STATUS_INVALID_CHARACTERS,
     CSYNC_STATUS_INDIVIDUAL_STAT_FAILED,

+ 0 - 10
src/csync/csync_reconcile.cpp

@@ -283,16 +283,6 @@ static int _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx) {
         /* file on current replica is changed or new */
         case CSYNC_INSTRUCTION_EVAL:
         case CSYNC_INSTRUCTION_NEW:
-            // This operation is usually a no-op and will by default return false
-            if (csync_file_locked_or_open(ctx->local.uri, cur->path)) {
-                qCDebug(lcReconcile, "[Reconciler] IGNORING file %s/%s since it is locked / open", ctx->local.uri, cur->path.constData());
-                cur->instruction = CSYNC_INSTRUCTION_ERROR;
-                if (cur->error_status == CSYNC_STATUS_OK) // don't overwrite error
-                    cur->error_status = CYSNC_STATUS_FILE_LOCKED_OR_OPEN;
-                break;
-            } else {
-                //qCDebug(lcReconcile, "[Reconciler] not ignoring file %s/%s", ctx->local.uri, cur->path);
-            }
             switch (other->instruction) {
             /* file on other replica is changed or new */
             case CSYNC_INSTRUCTION_NEW:

+ 0 - 20
src/csync/csync_util.cpp

@@ -106,26 +106,6 @@ void csync_memstat_check(void) {
       m.size * 4, m.resident * 4, m.shared * 4);
 }
 
-bool (*csync_file_locked_or_open_ext) (const char*) = 0; // filled in by library user
-void set_csync_file_locked_or_open_ext(bool (*f) (const char*));
-void set_csync_file_locked_or_open_ext(bool (*f) (const char*)) {
-    csync_file_locked_or_open_ext = f;
-}
-
-bool csync_file_locked_or_open( const char *dir, const char *fname) {
-    char *tmp_uri = NULL;
-    bool ret;
-    if (!csync_file_locked_or_open_ext) {
-        return false;
-    }
-    if (asprintf(&tmp_uri, "%s/%s", dir, fname) < 0) {
-        return -1;
-    }
-    ret = csync_file_locked_or_open_ext(tmp_uri);
-    SAFE_FREE(tmp_uri);
-    return ret;
-}
-
 #ifndef HAVE_TIMEGM
 #ifdef _WIN32
 static int is_leap(unsigned y) {

+ 0 - 2
src/csync/csync_util.h

@@ -30,8 +30,6 @@ const char OCSYNC_EXPORT *csync_instruction_str(enum csync_instructions_e instr)
 
 void OCSYNC_EXPORT csync_memstat_check(void);
 
-bool OCSYNC_EXPORT csync_file_locked_or_open( const char *dir, const char *fname);
-
 /* Returns true if we're reasonably certain that hash equality
  * for the header means content equality.
  *

+ 0 - 3
src/libsync/syncengine.cpp

@@ -534,9 +534,6 @@ int SyncEngine::treewalkFile(csync_file_stat_t *file, csync_file_stat_t *other,
             item->_errorString = tr("Conflict: Server version downloaded, local copy renamed and not uploaded.");
         }
         break;
-    case CYSNC_STATUS_FILE_LOCKED_OR_OPEN:
-        item->_errorString = QLatin1String("File locked"); // don't translate, internal use!
-        break;
     case CSYNC_STATUS_INDIVIDUAL_STAT_FAILED:
         item->_errorString = tr("Stat failed.");
         break;