Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
Fix compiler warnings when building microservices. RITDEV-277
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulVanSchayck committed Feb 28, 2019
1 parent 16c3f5e commit 8d971fd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 25 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ add_compile_options(-std=c++14
-Wuninitialized
-Wconversion
-Wno-missing-field-initializers
-Wno-unused-parameter)
-Wno-unused-parameter
-Wno-gnu-zero-variadic-macro-arguments)

# Use shared libraries in this project
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
Expand Down
12 changes: 4 additions & 8 deletions msi_http_send_file/msi_http_send_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ class irodsCurl {
dataObjInp_t file;
openedDataObjInp_t openedFile;
bytesBuf_t bytesBuf;

size_t bytesRead;
int bytesRead;

// Make sure we have something to read from
if (!readData) {
Expand Down Expand Up @@ -140,16 +139,15 @@ class irodsCurl {
openedFile.l1descInx = readData->desc;
openedFile.len = bytesBuf.len;

// bytesRead = 0;
//TODO: At Paul: during compilation warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long')
// Read iRODS object
bytesRead = rsDataObjRead(readData->rsComm, &openedFile, &bytesBuf);
//TODO: At Paul: during compilation warning: comparison of unsigned expression < 0 is always false

if (bytesRead < 0) {
rodsLog(LOG_ERROR, "irods_http_send_file: Problem reading iRODS object. Status = %d", bytesRead);
return CURL_READFUNC_ABORT;
}

return (bytesRead);
return (size_t) bytesRead;
}

}; // class irodsCurl
Expand All @@ -161,8 +159,6 @@ extern "C" {
// 1. Write a standard issue microservice
int irods_http_send_file( msParam_t* url, msParam_t* src_obj, ruleExecInfo_t* rei ) {
dataObjInp_t dataObjInp, *myDataObjInp;
//TODO: At Paul: during compilation "warning: unused variable 'myUrl'"
char *myUrl;

// Sanity checks
if ( !rei || !rei->rsComm ) {
Expand Down
10 changes: 5 additions & 5 deletions msi_json_arrayops/libmsi_json_arrayops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern "C" {
const char *inJsonStr = parseMspForStr( json_str );
const char *inVal = parseMspForStr( val );
const char *inOps = parseMspForStr( ops );
const int inIdx = parseMspForPosInt( sizeOrIndex );
int inIdx = parseMspForPosInt( sizeOrIndex );

if( ! inJsonStr ) {
cout << "msi_json_arrayops - invalid inJsonStr" << endl;
Expand Down Expand Up @@ -69,9 +69,9 @@ extern "C" {
}

// find if jval is already presented in array
size_t i_match = outSizeOrIndex;
int i_match = outSizeOrIndex;
for( int i=0; i < outSizeOrIndex; i++ ) {
json_t *ov = json_array_get(root, i);
json_t *ov = json_array_get(root, (size_t) i);
if ( json_equal(ov, jval) ) { i_match = i; break; }
}

Expand All @@ -85,7 +85,7 @@ extern "C" {

if ( i_match < outSizeOrIndex ) {
if ( strOps == "rm" ) {
json_array_remove(root, i_match);
json_array_remove(root, (size_t) i_match);
outSizeOrIndex = (int) json_array_size(root);
} else {
outSizeOrIndex = i_match;
Expand All @@ -96,7 +96,7 @@ extern "C" {
} else if ( strOps == "size" ) {
outSizeOrIndex = (int) json_array_size(root);
} else if ( strOps == "get" ) {
json_t *elem = json_array_get(root, inIdx);
json_t *elem = json_array_get(root, (size_t) inIdx);

// Updated our rule with added functionality from Utrecht University
/* output a string directly, but encode other json types using json_dumps with JSON_ENCODE_ANY set */
Expand Down
2 changes: 1 addition & 1 deletion msi_json_objops/libmsi_json_objops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ extern "C" {
if ( data ) {
if ( json_is_array( data ) ) {
size_t i_match = json_array_size(data);
for( int i=0; i<json_array_size(data); i++ ) {
for( size_t i=0; i<json_array_size(data); i++ ) {
json_t *ov = json_array_get(data, i);
if ( json_equal(ov, jval) ) { i_match = i; break; }
}
Expand Down
12 changes: 2 additions & 10 deletions msiput_dataobj_or_coll/libmsiput_dataobj_or_coll.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
// 2018-08-07 Ported this microservice to iRODS 4.2.3
// Based my changes here on a diff between these two versions on irods/contrib:
// 4.1 https://github.com/irods/contrib/blob/4-1-stable/microservices/landing_zone_microservices/msiput_dataobj_or_coll/libmsiput_dataobj_or_coll.cpp
// 4.2 https://github.com/irods/contrib/blob/e31f055dee5e3e8ca76b2ccd6011f684dc2f130c/microservices/landing_zone_microservices/msiput_dataobj_or_coll/libmsiput_dataobj_or_coll.cpp

//#include "reFuncDefs.h"
#include "irods_ms_plugin.hpp"
#include "objInfo.h"
#include "reDataObjOpr.hpp"
#include "collCreate.h"
#include "dataObjPut.h"
#include "collection.hpp"
Expand All @@ -25,7 +18,6 @@ void strip_trailing_slash(
std::string& _path ) {
if( *_path.rbegin() == '/' )
_path = _path.substr( 0, _path.size()-1 );

}


Expand Down Expand Up @@ -215,7 +207,7 @@ irods::error put_all_the_files(

// =-=-=-=-=-=-=-
// 1. Write a standard issue microservice
int msiput_dataobj_or_coll(
long long msiput_dataobj_or_coll(
msParam_t* _path,
msParam_t* _resc,
msParam_t* _opts,
Expand Down Expand Up @@ -310,7 +302,7 @@ int msiput_dataobj_or_coll(
if (!ret.ok()) {
addRErrorMsg(
&rei->rsComm->rError,
ret.code(),
(int) ret.code(),
ret.result().c_str());
}

Expand Down

0 comments on commit 8d971fd

Please sign in to comment.