Skip to content

Commit

Permalink
Merge pull request #41 from andre2007/deprecations
Browse files Browse the repository at this point in the history
Fix deprecations and warnings
  • Loading branch information
PetarKirov committed Dec 16, 2020
2 parents 5cb6be6 + 7367770 commit 56cddfc
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
52 changes: 26 additions & 26 deletions src/undead/bitarray.d
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ struct BitArray
/***************************************
* Support for unary operator ~ for bit arrays.
*/
BitArray opCom()
BitArray opUnary(string op : "~")()
{
auto dim = this.dim();

Expand All @@ -489,7 +489,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opCom unittest\n");
debug(bitarray) printf("BitArray.opUnary unittest\n");

static bool[] ba = [1,0,1,0,1];

Expand All @@ -507,7 +507,7 @@ struct BitArray
/***************************************
* Support for binary operator & for bit arrays.
*/
BitArray opAnd(BitArray e2)
BitArray opBinary(string op : "&")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -526,7 +526,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opAnd unittest\n");
debug(bitarray) printf("BitArray.opBinary unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -547,7 +547,7 @@ struct BitArray
/***************************************
* Support for binary operator | for bit arrays.
*/
BitArray opOr(BitArray e2)
BitArray opBinary(string op : "|")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -566,7 +566,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opOr unittest\n");
debug(bitarray) printf("BitArray.opBinary unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -587,7 +587,7 @@ struct BitArray
/***************************************
* Support for binary operator ^ for bit arrays.
*/
BitArray opXor(BitArray e2)
BitArray opBinary(string op : "^")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -606,7 +606,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opXor unittest\n");
debug(bitarray) printf("BitArray.opBinary unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -629,7 +629,7 @@ struct BitArray
*
* $(I a - b) for BitArrays means the same thing as $(I a & ~b).
*/
BitArray opSub(BitArray e2)
BitArray opBinary(string op : "-")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -648,7 +648,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opSub unittest\n");
debug(bitarray) printf("BitArray.opBinary unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -669,7 +669,7 @@ struct BitArray
/***************************************
* Support for operator &= bit arrays.
*/
BitArray opAndAssign(BitArray e2)
BitArray opOpAssign(string op : "&")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -685,7 +685,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opAndAssign unittest\n");
debug(bitarray) printf("BitArray.opOpAssign unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -705,7 +705,7 @@ struct BitArray
/***************************************
* Support for operator |= for bit arrays.
*/
BitArray opOrAssign(BitArray e2)
BitArray opOpAssign(string op : "|")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -721,7 +721,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opOrAssign unittest\n");
debug(bitarray) printf("BitArray.opOpAssign unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -740,7 +740,7 @@ struct BitArray
/***************************************
* Support for operator ^= for bit arrays.
*/
BitArray opXorAssign(BitArray e2)
BitArray opOpAssign(string op : "^")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -756,7 +756,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opXorAssign unittest\n");
debug(bitarray) printf("BitArray.opOpAssign unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -777,7 +777,7 @@ struct BitArray
*
* $(I a -= b) for BitArrays means the same thing as $(I a &= ~b).
*/
BitArray opSubAssign(BitArray e2)
BitArray opOpAssign(string op : "-")(BitArray e2)
in
{
assert(len == e2.length);
Expand All @@ -793,7 +793,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opSubAssign unittest\n");
debug(bitarray) printf("BitArray.opOpAssign unittest\n");

static bool[] ba = [1,0,1,0,1];
static bool[] bb = [1,0,1,1,0];
Expand All @@ -813,7 +813,7 @@ struct BitArray
* Support for operator ~= for bit arrays.
*/

BitArray opCatAssign(bool b)
BitArray opOpAssign(string op : "~")(bool b)
{
length = len + 1;
(this)[len - 1] = b;
Expand All @@ -822,7 +822,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opCatAssign unittest\n");
debug(bitarray) printf("BitArray.opOpAssign unittest\n");

static bool[] ba = [1,0,1,0,1];

Expand All @@ -844,7 +844,7 @@ struct BitArray
* ditto
*/

BitArray opCatAssign(BitArray b)
BitArray opOpAssign(string op : "~")(BitArray b)
{
auto istart = len;
length = len + b.length;
Expand All @@ -855,7 +855,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opCatAssign unittest\n");
debug(bitarray) printf("BitArray.opOpAssign unittest\n");

static bool[] ba = [1,0];
static bool[] bb = [0,1,0];
Expand All @@ -878,7 +878,7 @@ struct BitArray
/***************************************
* Support for binary operator ~ for bit arrays.
*/
BitArray opCat(bool b)
BitArray opBinary(string op : "~")(bool b)
{
auto r = this.dup;
r.length = len + 1;
Expand All @@ -887,7 +887,7 @@ struct BitArray
}

/** ditto */
BitArray opCat_r(bool b)
BitArray opBinaryRight(string op : "~")(bool b)
{
BitArray r;

Expand All @@ -899,7 +899,7 @@ struct BitArray
}

/** ditto */
BitArray opCat(BitArray b)
BitArray opBinary(string op : "~")(BitArray b)
{
BitArray r;

Expand All @@ -910,7 +910,7 @@ struct BitArray

unittest
{
debug(bitarray) printf("BitArray.opCat unittest\n");
debug(bitarray) printf("BitArray.opBinary unittest\n");

static bool[] ba = [1,0];
static bool[] bb = [0,1,0];
Expand Down
8 changes: 4 additions & 4 deletions src/undead/cstream.d
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ class CFile : Stream {
file.writeLine("That was blank");
file.position = 0;
char[][] lines;
foreach(char[] line; file) {
lines ~= line.dup;
foreach(char[] fileLine; file) {
lines ~= fileLine.dup;
}
assert( lines.length == 5 );
assert( lines[0] == "Testing stream.d:");
Expand All @@ -213,8 +213,8 @@ class CFile : Stream {
assert( lines[3] == "That was blank");
file.position = 0;
lines = new char[][5];
foreach(ulong n, char[] line; file) {
lines[cast(size_t)(n-1)] = line.dup;
foreach(ulong n, char[] fileLine; file) {
lines[cast(size_t)(n-1)] = fileLine.dup;
}
assert( lines[0] == "Testing stream.d:");
assert( lines[1] == "Another line");
Expand Down
4 changes: 2 additions & 2 deletions src/undead/date.d
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ string UTCtoString(d_time time)
dateFromTime(t),
hourFromTime(t), minFromTime(t), secFromTime(t),
sign, hr, mn,
cast(long)yearFromTime(t));
cast(int)yearFromTime(t));

// Ensure no buggy buffer overflows
//printf("len = %d, buffer.length = %d\n", len, buffer.length);
Expand Down Expand Up @@ -748,7 +748,7 @@ string toDateString(d_time time)
&daystr[weekDay(t) * 3],
&monstr[monthFromTime(t) * 3],
dateFromTime(t),
cast(long)yearFromTime(t));
cast(int)yearFromTime(t));

// Ensure no buggy buffer overflows
assert(len < buffer.length);
Expand Down
8 changes: 4 additions & 4 deletions src/undead/stream.d
Original file line number Diff line number Diff line change
Expand Up @@ -2189,8 +2189,8 @@ class File: Stream {
file.writeLine("That was blank");
file.position = 0;
char[][] lines;
foreach(char[] line; file) {
lines ~= line.dup;
foreach(char[] fileLine; file) {
lines ~= fileLine.dup;
}
assert( lines.length == 4 );
assert( lines[0] == "Testing stream.d:");
Expand All @@ -2199,8 +2199,8 @@ class File: Stream {
assert( lines[3] == "That was blank");
file.position = 0;
lines = new char[][4];
foreach(ulong n, char[] line; file) {
lines[cast(size_t)(n-1)] = line.dup;
foreach(ulong n, char[] fileLine; file) {
lines[cast(size_t)(n-1)] = fileLine.dup;
}
assert( lines[0] == "Testing stream.d:");
assert( lines[1] == "Another line");
Expand Down

0 comments on commit 56cddfc

Please sign in to comment.