Remove now unneede csync_instruction_str
authorHannah von Reth <hannah.vonreth@owncloud.com>
Wed, 22 Apr 2020 13:22:03 +0000 (15:22 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:10 +0000 (10:59 +0100)
src/csync/csync_util.cpp
src/csync/csync_util.h
src/libsync/discovery.cpp
src/libsync/owncloudpropagator.h
src/libsync/propagatedownloadencrypted.cpp

index fd946bd891018976450cf446338a3b91ad73edc2..93bf1b36e14f35d58c90f9c6fbacc999b6afbe9c 100644 (file)
@@ -43,24 +43,6 @@ struct _instr_code_struct {
   enum csync_instructions_e instr_code;
 };
 
-static const _instr_code_struct _instr[] =
-{
-  { "INSTRUCTION_NONE", CSYNC_INSTRUCTION_NONE },
-  { "INSTRUCTION_EVAL", CSYNC_INSTRUCTION_EVAL },
-  { "INSTRUCTION_REMOVE", CSYNC_INSTRUCTION_REMOVE },
-  { "INSTRUCTION_RENAME", CSYNC_INSTRUCTION_RENAME },
-  { "INSTRUCTION_EVAL_RENAME", CSYNC_INSTRUCTION_EVAL_RENAME },
-  { "INSTRUCTION_NEW", CSYNC_INSTRUCTION_NEW },
-  { "INSTRUCTION_CONFLICT", CSYNC_INSTRUCTION_CONFLICT },
-  { "INSTRUCTION_IGNORE", CSYNC_INSTRUCTION_IGNORE },
-  { "INSTRUCTION_SYNC", CSYNC_INSTRUCTION_SYNC },
-  { "INSTRUCTION_STAT_ERR", CSYNC_INSTRUCTION_STAT_ERROR },
-  { "INSTRUCTION_ERROR", CSYNC_INSTRUCTION_ERROR },
-  { "INSTRUCTION_TYPE_CHANGE", CSYNC_INSTRUCTION_TYPE_CHANGE },
-  { "INSTRUCTION_UPDATE_METADATA", CSYNC_INSTRUCTION_UPDATE_METADATA },
-  { nullptr, CSYNC_INSTRUCTION_ERROR }
-};
-
 struct csync_memstat_s {
   int size;
   int resident;
@@ -71,21 +53,6 @@ struct csync_memstat_s {
   int dt;
 };
 
-const char *csync_instruction_str(enum csync_instructions_e instr)
-{
-  int idx = 0;
-
-  while (_instr[idx].instr_str) {
-    if (_instr[idx].instr_code == instr) {
-      return _instr[idx].instr_str;
-    }
-    idx++;
-  }
-
-  return "ERROR!";
-}
-
-
 void csync_memstat_check() {
   int s = 0;
   struct csync_memstat_s m;
index 0114ed2b4cede75b5cf16c0291287a33750ed7cd..c71f7c999b2ffca9314415ab4dba391f44f68bd7 100644 (file)
@@ -26,8 +26,6 @@
 
 #include "csync.h"
 
-const char OCSYNC_EXPORT *csync_instruction_str(enum csync_instructions_e instr);
-
 void OCSYNC_EXPORT csync_memstat_check();
 
 /* Returns true if we're reasonably certain that hash equality
index 7b403015f95e42396d9ef12e7935de2fa42f44db..8bedc656abff0efecdf82af6c50be93358a02843 100644 (file)
@@ -1127,7 +1127,7 @@ void ProcessDirectoryJob::processFileFinalize(
         item->_direction = _dirItem->_direction;
     }
 
-    qCInfo(lcDisco) << "Discovered" << item->_file << csync_instruction_str(item->_instruction) << item->_direction << item->_type;
+    qCInfo(lcDisco) << "Discovered" << item->_file << item->_instruction << item->_direction << item->_type;
 
     if (item->isDirectory() && item->_instruction == CSYNC_INSTRUCTION_SYNC)
         item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
index 4524e893c83dba2f24ab8a525dd797df65393d10..d9b0065ee473aad9c60881e8921e68a4f117e08c 100644 (file)
@@ -190,8 +190,7 @@ public:
         if (_state != NotYetStarted) {
             return false;
         }
-        const char *instruction_str = csync_instruction_str(_item->_instruction);
-        qCInfo(lcPropagator) << "Starting" << instruction_str << "propagation of" << _item->destination() << "by" << this;
+        qCInfo(lcPropagator) << "Starting" << _item->_instruction << "propagation of" << _item->destination() << "by" << this;
 
         _state = Running;
         QMetaObject::invokeMethod(this, "start"); // We could be in a different thread (neon jobs)
index d91a7d35107f91f4ecd362dd4a806a057474f3f3..ffef0dec6dddf6a3662a550d44c9568e8005e8f7 100644 (file)
@@ -89,8 +89,8 @@ void PropagateDownloadEncrypted::checkFolderId(const QStringList &list)
 
 void PropagateDownloadEncrypted::checkFolderEncryptedMetadata(const QJsonDocument &json)
 {
-  qCDebug(lcPropagateDownloadEncrypted) << "Metadata Received reading" <<
-                                           csync_instruction_str(_item->_instruction) << _item->_file << _item->_encryptedFileName;
+  qCDebug(lcPropagateDownloadEncrypted) << "Metadata Received reading"
+                                        << _item->_instruction << _item->_file << _item->_encryptedFileName;
   const QString filename = _info.fileName();
   auto meta = new FolderMetadata(_propagator->account(), json.toJson(QJsonDocument::Compact));
   const QVector<EncryptedFile> files = meta->files();