Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes from SCA #157

Merged
merged 18 commits into from
May 30, 2018
Merged

Various fixes from SCA #157

merged 18 commits into from
May 30, 2018

Conversation

dalgaaf
Copy link
Collaborator

@dalgaaf dalgaaf commented May 30, 2018

  • size() vs empty()
  • init in ctor init list
  • signed/unsigned checks
  • unused vars
  • fix compiler warnings
  • update gitignore

dalgaaf added 15 commits May 29, 2018 17:52
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rmb.cpp:296:8: warning: unused variable ‘debug’ [-Wunused-variable]

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Do not use unsigned uid parameter to transport extra information
by assigning -1 to it. Use a separate bool paramter for that.

Fix for:

rbox-sync-rebuild.cpp: In function ‘int rbox_sync_add_object(index_rebuild_context*, const string&, librmb::RadosMailObject*, bool, uint32_t)’:
rbox-sync-rebuild.cpp:47:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (uid == -1) {
       ~~~~^~~~~

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rbox-sync-rebuild.cpp:84:17: warning: declaration of ‘oid’ shadows a previous local [-Wshadow]
     std::string oid = mail_obj->get_oid();
                 ^~~
rbox-sync-rebuild.cpp:60:14: note: shadowed declaration is here
   guid_128_t oid;
              ^~~

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rbox-sync-rebuild.cpp:87:71: warning: comparison of constant ‘0’ with boolean expression is always false [-Wbool-compare]
     if (r_storage->ms->get_storage()->update_metadata(oid, to_update) < 0) {
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rbox-sync-rebuild.cpp: In function ‘int rbox_sync_rebuild_entry(index_rebuild_context*, librados::NObjectIterator&, bool, bool)’:
rbox-sync-rebuild.cpp:96:5: warning: no previous declaration for ‘int rbox_sync_rebuild_entry(index_rebuild_context*, librados::NObjectIterator&, bool, bool)’ [-Wmissing-declarations]
 int rbox_sync_rebuild_entry(struct index_rebuild_context *ctx, librados::NObjectIterator &iter, bool alt_storage,
     ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rbox-storage.cpp: In function ‘int read_plugin_configuration(mailbox*)’:
rbox-storage.cpp:356:110: warning: too many arguments for format [-Wformat-extra-args]
       i_warning("unable to open the rados save log file ", storage->config->get_rados_save_log_file().c_str());

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
rbox-copy.cpp: In function ‘int rbox_mail_storage_try_copy(mail_save_context**, mail*, bool)’:
rbox-copy.cpp:228:43: warning: format ‘%s’ expects argument of type ‘char*’, but argument 7 has type ‘std::__cxx11::string* {aka std::__cxx11::basic_string<char>*}’ [-Wformat=]
             rados_storage->get_pool_name());

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
@dalgaaf
Copy link
Collaborator Author

dalgaaf commented May 30, 2018

Travis CI: some docker commands failed

@jrse
Copy link
Contributor

jrse commented May 30, 2018

travis ci had some network issues (connection timeout). I restarted the builds.

rbox-save.cpp:104:24: warning: unused variable ‘r_storage’ [-Wunused-variable]
   struct rbox_storage *r_storage = (struct rbox_storage *)&r_ctx->mbox->storage->storage;
                        ^~~~~~~~~

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
librmb/test_librmb_utils.cpp: In function ‘void* write_to_save_file(void*)’:
librmb/test_librmb_utils.cpp:189:7: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn]
 void *write_to_save_file(void *threadid) {
       ^~~~~~~~~~~~~~~~~~

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
librmb/test_librmb_utils.cpp: In member function ‘virtual void librmb_append_to_existing_file_multi_threading_Test::TestBody()’:
librmb/test_librmb_utils.cpp:212:72: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     rc = pthread_create(&threads[i], NULL, write_to_save_file, (void *)i);
                                                                        ^

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
@jrse jrse merged commit ec1d5f4 into master May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants