Commit 1f0916fb authored by Carsten Schlote's avatar Carsten Schlote
Browse files

Fix linter warnings

parent e4263d07
Pipeline #1064 passed with stages
in 4 minutes and 32 seconds
/** lmdb bining test executable
* @file
*/
/* lmdb bining test executable */
import core.stdc.string;
import std.bitmanip;
......@@ -183,7 +181,7 @@ free_mdb_env:
void lmdb_toy2(const string[] args)
{
int rc;
bool verbose = args.length >= 2 && args[1] == "-v" ? true : false;
const bool verbose = args.length >= 2 && args[1] == "-v" ? true : false;
/* Note: Most error checking omitted for simplicity */
......@@ -235,20 +233,21 @@ void lmdb_toy2(const string[] args)
/* ------------------------------------------------------------------------- */
struct myDataTable {
uint field0;
uint field1;
uint field2;
uint field3;
char[10] field4;
float field5;
/** Some data structure */
struct MyDataTable {
uint field0; ///< Some filed...
uint field1; ///<
uint field2; ///<
uint field3; ///<
char[10] field4; ///<
float field5; ///<
}
/** Some test code */
void lmdb_toy3(const string[] args)
{
int rc;
bool verbose = args.length >= 2 && args[1] == "-v" ? true : false;
const bool verbose = args.length >= 2 && args[1] == "-v" ? true : false;
/* Note: Most error checking omitted for simplicity */
......@@ -263,7 +262,7 @@ void lmdb_toy3(const string[] args)
foreach (uint i; 0 .. 5)
{
ubyte[4] kval ; kval[0..4].write!uint(i, 0);
myDataTable table = { 42, 23, 17, i, };
MyDataTable table = { 42, 23, 17, i, };
table.field4[].sformat("Idx=%d\0", table.field3);
table.field5 = 3.14 * i;
key = new MdbVal(cast(void*)kval, kval.length);
......@@ -328,12 +327,14 @@ void lmdb_toy2_iterate_readwrite(MdbEnv env, MdbTxn txn, MdbDbi dbi, MdbCursor c
}
/** Iterate through all nodes in RO mode, execute a delegate for each node.
* @param env Reference to MdbEnv class
* @param tcn Reference to MdbTxn class
* @param cursor Reference to MdbCursor class
* @param fkt Delegate with reference to an MdbVal object. Returns bool=false to bereak loop.
* Params:
* env = Reference to MdbEnv class
* tcn = Reference to MdbTxn class
* cursor = Reference to MdbCursor class
* fkt = Delegate with reference to an MdbVal object. Returns bool=false to bereak loop.
*/
void lmdb_iterate_readonly_job(MdbEnv env, MdbTxn txn, MdbDbi dbi, MdbCursor cursor, bool delegate (MdbVal) fkt, bool verbose = true)
void lmdb_iterate_readonly_job(MdbEnv env, MdbTxn txn, MdbDbi dbi, MdbCursor cursor,
bool delegate (MdbVal) fkt, bool verbose = true)
{
int itemcount; bool fkt_rc;
MdbVal key = new MdbVal(), data = new MdbVal();
......
......@@ -257,13 +257,13 @@ struct MDB_val {
/** Constructor to setup structure from a string. */
this(const string data) nothrow {
import std.string;
import std.string : toStringz;
this(toStringz(data), data.length+1);
}
/** Constructor to setup structure from a C string. */
this(const char* data) nothrow {
import core.stdc.string;
import core.stdc.string : strlen;
this(data, strlen(data)+1);
}
......@@ -302,19 +302,19 @@ struct MDB_val {
}
/** Returns a typed pointer to the embedded struct */
T* data(T)() nothrow {
T* data(T)() const nothrow {
return cast(T*)(mv_data);
}
/** Assigns new structure values from a const string. */
ref MDB_val assign(const ref string data) nothrow {
import std.string;
import std.string : toStringz;
return assign(toStringz(data), data.sizeof);
}
/** Assigns new structure values from a const C-string. */
ref MDB_val assign(const char* data) nothrow {
import core.stdc.string;
import core.stdc.string : strlen;
return assign(data, strlen(data)+1);
}
......
......@@ -739,8 +739,8 @@ public:
}
/** Print it some useful way... */
override string toString() {
import std.format;
override string toString() const {
import std.format : format;
return format("%x @ %d %s", _val.data!(ubyte*)(), _val.size(), _val.data!ubyte()[0.._val.size()]);
}
}
......@@ -1053,14 +1053,16 @@ public:
mdb_dbi_open(txn, name, flags, &handle);
return new MdbDbi(handle);
}
/** Close a database handle
* Param:
* env = an MdbEnv
*/
void close(MdbEnv env) {
mdb_dbi_close(env.handle(), _handle);
}
/**
* Constructor.
*
* @param handle a valid `MDB_dbi` handle
/** Constructor.
* Param: handle = a valid `MDB_dbi` handle
*/
this(const MDB_dbi handle) nothrow {
_handle = handle;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment