bloody silly deprecations

This commit is contained in:
Adam D. Ruppe 2019-09-30 19:45:35 -04:00
parent 5782378865
commit 6e20f19cf6
3 changed files with 43 additions and 42 deletions

1
cgi.d
View File

@ -5781,6 +5781,7 @@ class ScheduledJobServerConnection : ScheduledJobServer {
} }
final class ScheduledJobServerImplementation : ScheduledJobServer, EventIoServer { final class ScheduledJobServerImplementation : ScheduledJobServer, EventIoServer {
// FIXME: we need to handle SIGCHLD in this somehow
// whenIs is 0 for relative, 1 for absolute // whenIs is 0 for relative, 1 for absolute
protected int scheduleJob(int whenIs, int when, string executable, string func, string[] args) { protected int scheduleJob(int whenIs, int when, string executable, string func, string[] args) {
auto nj = nextJobId; auto nj = nextJobId;

18
oauth.d
View File

@ -752,19 +752,19 @@ Variant jsonValueToVariant(JSONValue v) {
Variant ret; Variant ret;
final switch(v.type) { final switch(v.type) {
case JSON_TYPE.STRING: case JSONType.string:
ret = v.str; ret = v.str;
break; break;
case JSON_TYPE.UINTEGER: case JSONType.uinteger:
ret = v.uinteger; ret = v.uinteger;
break; break;
case JSON_TYPE.INTEGER: case JSONType.integer:
ret = v.integer; ret = v.integer;
break; break;
case JSON_TYPE.FLOAT: case JSONType.float_:
ret = v.floating; ret = v.floating;
break; break;
case JSON_TYPE.OBJECT: case JSONType.object:
Variant[string] obj; Variant[string] obj;
foreach(k, val; v.object) { foreach(k, val; v.object) {
obj[k] = jsonValueToVariant(val); obj[k] = jsonValueToVariant(val);
@ -772,7 +772,7 @@ Variant jsonValueToVariant(JSONValue v) {
ret = obj; ret = obj;
break; break;
case JSON_TYPE.ARRAY: case JSONType.array:
Variant[] arr; Variant[] arr;
foreach(i; v.array) { foreach(i; v.array) {
arr ~= jsonValueToVariant(i); arr ~= jsonValueToVariant(i);
@ -780,13 +780,13 @@ Variant jsonValueToVariant(JSONValue v) {
ret = arr; ret = arr;
break; break;
case JSON_TYPE.TRUE: case JSONType.true_:
ret = true; ret = true;
break; break;
case JSON_TYPE.FALSE: case JSONType.false_:
ret = false; ret = false;
break; break;
case JSON_TYPE.NULL: case JSONType.null_:
ret = null; ret = null;
break; break;
} }

66
web.d
View File

@ -1555,7 +1555,7 @@ void run(Provider)(Cgi cgi, Provider instantiation, size_t pathInfoStartingPoint
cgi.setResponseContentType("text/csv"); cgi.setResponseContentType("text/csv");
cgi.header("Content-Disposition: attachment; filename=\"export.csv\""); cgi.header("Content-Disposition: attachment; filename=\"export.csv\"");
if(result.result.type == JSON_TYPE.STRING) { if(result.result.type == JSONType.string) {
cgi.write(result.result.str, true); cgi.write(result.result.str, true);
} else assert(0); } else assert(0);
break; break;
@ -1566,7 +1566,7 @@ void run(Provider)(Cgi cgi, Provider instantiation, size_t pathInfoStartingPoint
cgi.setResponseContentType("text/plain"); cgi.setResponseContentType("text/plain");
if(result.success) { if(result.success) {
if(result.result.type == JSON_TYPE.STRING) { if(result.result.type == JSONType.string) {
cgi.write(result.result.str, true); cgi.write(result.result.str, true);
} else { } else {
cgi.write(toJSON(result.result), true); cgi.write(toJSON(result.result), true);
@ -1580,7 +1580,7 @@ void run(Provider)(Cgi cgi, Provider instantiation, size_t pathInfoStartingPoint
default: default:
cgi.setResponseContentType("text/html; charset=utf-8"); cgi.setResponseContentType("text/html; charset=utf-8");
if(result.result.type == JSON_TYPE.STRING) { if(result.result.type == JSONType.string) {
auto returned = result.result.str; auto returned = result.result.str;
if(envelopeFormat != "html") { if(envelopeFormat != "html") {
@ -2156,7 +2156,7 @@ JSONValue toJsonValue(T, R = ApiProvider)(T a, string formatToStringAs = null, R
static if(is(T == typeof(null)) || is(T == void*)) { static if(is(T == typeof(null)) || is(T == void*)) {
/* void* goes here too because we don't know how to make it work... */ /* void* goes here too because we don't know how to make it work... */
val.object = null; val.object = null;
//val.type = JSON_TYPE.NULL; //val.type = JSONType.null_;
} else static if(is(T == JSONValue)) { } else static if(is(T == JSONValue)) {
val = a; val = a;
} else static if(__traits(compiles, val = a.makeJsonValue())) { } else static if(__traits(compiles, val = a.makeJsonValue())) {
@ -2165,57 +2165,57 @@ JSONValue toJsonValue(T, R = ApiProvider)(T a, string formatToStringAs = null, R
// FIXME: should we special case something like struct Html? // FIXME: should we special case something like struct Html?
} else static if(is(T : DateTime)) { } else static if(is(T : DateTime)) {
//val.type = JSON_TYPE.STRING; //val.type = JSONType.string;
val.str = a.toISOExtString(); val.str = a.toISOExtString();
} else static if(is(T : Element)) { } else static if(is(T : Element)) {
if(a is null) { if(a is null) {
//val.type = JSON_TYPE.NULL; //val.type = JSONType.null_;
val = null; val = null;
} else { } else {
//val.type = JSON_TYPE.STRING; //val.type = JSONType.string;
val.str = a.toString(); val.str = a.toString();
} }
} else static if(is(T == long)) { } else static if(is(T == long)) {
// FIXME: let's get a better range... I think it goes up to like 1 << 50 on positive and negative // FIXME: let's get a better range... I think it goes up to like 1 << 50 on positive and negative
// but this works for now // but this works for now
if(a < int.max && a > int.min) { if(a < int.max && a > int.min) {
//val.type = JSON_TYPE.INTEGER; //val.type = JSONType.integer;
val.integer = to!long(a); val.integer = to!long(a);
} else { } else {
// WHY? because javascript can't actually store all 64 bit numbers correctly // WHY? because javascript can't actually store all 64 bit numbers correctly
//val.type = JSON_TYPE.STRING; //val.type = JSONType.string;
val.str = to!string(a); val.str = to!string(a);
} }
} else static if(isIntegral!(T)) { } else static if(isIntegral!(T)) {
//val.type = JSON_TYPE.INTEGER; //val.type = JSONType.integer;
val.integer = to!long(a); val.integer = to!long(a);
} else static if(isFloatingPoint!(T)) { } else static if(isFloatingPoint!(T)) {
//val.type = JSON_TYPE.FLOAT; //val.type = JSONType.float_;
val.floating = to!real(a); val.floating = to!real(a);
} else static if(isPointer!(T)) { } else static if(isPointer!(T)) {
if(a is null) { if(a is null) {
//val.type = JSON_TYPE.NULL; //val.type = JSONType.null_;
val = null; val = null;
} else { } else {
val = toJsonValue!(typeof(*a), R)(*a, formatToStringAs, api); val = toJsonValue!(typeof(*a), R)(*a, formatToStringAs, api);
} }
} else static if(is(T == bool)) { } else static if(is(T == bool)) {
if(a == true) if(a == true)
val = true; // .type = JSON_TYPE.TRUE; val = true; // .type = JSONType.true_;
if(a == false) if(a == false)
val = false; // .type = JSON_TYPE.FALSE; val = false; // .type = JSONType.false_;
} else static if(isSomeString!(T)) { } else static if(isSomeString!(T)) {
//val.type = JSON_TYPE.STRING; //val.type = JSONType.string;
val.str = to!string(a); val.str = to!string(a);
} else static if(isAssociativeArray!(T)) { } else static if(isAssociativeArray!(T)) {
//val.type = JSON_TYPE.OBJECT; //val.type = JSONType.object;
JSONValue[string] valo; JSONValue[string] valo;
foreach(k, v; a) { foreach(k, v; a) {
valo[to!string(k)] = toJsonValue!(typeof(v), R)(v, formatToStringAs, api); valo[to!string(k)] = toJsonValue!(typeof(v), R)(v, formatToStringAs, api);
} }
val = valo; val = valo;
} else static if(isArray!(T)) { } else static if(isArray!(T)) {
//val.type = JSON_TYPE.ARRAY; //val.type = JSONType.array;
JSONValue[] arr; JSONValue[] arr;
arr.length = a.length; arr.length = a.length;
foreach(i, v; a) { foreach(i, v; a) {
@ -2224,7 +2224,7 @@ JSONValue toJsonValue(T, R = ApiProvider)(T a, string formatToStringAs = null, R
val.array = arr; val.array = arr;
} else static if(is(T == struct)) { // also can do all members of a struct... } else static if(is(T == struct)) { // also can do all members of a struct...
//val.type = JSON_TYPE.OBJECT; //val.type = JSONType.object;
JSONValue[string] valo; JSONValue[string] valo;
@ -2237,20 +2237,20 @@ JSONValue toJsonValue(T, R = ApiProvider)(T a, string formatToStringAs = null, R
//static if(__traits(compiles, __traits(getMember, a, member))) //static if(__traits(compiles, __traits(getMember, a, member)))
val = valo; val = valo;
} else { /* our catch all is to just do strings */ } else { /* our catch all is to just do strings */
//val.type = JSON_TYPE.STRING; //val.type = JSONType.string;
val.str = to!string(a); val.str = to!string(a);
// FIXME: handle enums // FIXME: handle enums
} }
// don't want json because it could recurse // don't want json because it could recurse
if(val.type == JSON_TYPE.OBJECT && formatToStringAs !is null && formatToStringAs != "json") { if(val.type == JSONType.object && formatToStringAs !is null && formatToStringAs != "json") {
JSONValue formatted; JSONValue formatted;
//formatted.type = JSON_TYPE.STRING; //formatted.type = JSONType.string;
formatted.str = ""; formatted.str = "";
formatAs!(T, R)(a, formatToStringAs, api, &formatted, null /* only doing one level of special formatting */); formatAs!(T, R)(a, formatToStringAs, api, &formatted, null /* only doing one level of special formatting */);
assert(formatted.type == JSON_TYPE.STRING); assert(formatted.type == JSONType.string);
val.object["formattedSecondarily"] = formatted; val.object["formattedSecondarily"] = formatted;
} }
@ -2621,7 +2621,7 @@ WrapperFunction generateWrapper(alias ObjectType, string funName, alias f, R)(Re
JSONValue returnValue; JSONValue returnValue;
returnValue.str = ""; returnValue.str = "";
//returnValue.type = JSON_TYPE.STRING; //returnValue.type = JSONType.string;
auto instantiation = getMemberDelegate!(ObjectType, funName)(cast(ObjectType) object); auto instantiation = getMemberDelegate!(ObjectType, funName)(cast(ObjectType) object);
@ -3378,33 +3378,33 @@ class Session {
private static string[string] loadDataFromJson(string json) { private static string[string] loadDataFromJson(string json) {
string[string] data = null; string[string] data = null;
auto obj = parseJSON(json); auto obj = parseJSON(json);
enforce(obj.type == JSON_TYPE.OBJECT); enforce(obj.type == JSONType.object);
foreach(k, v; obj.object) { foreach(k, v; obj.object) {
string ret; string ret;
final switch(v.type) { final switch(v.type) {
case JSON_TYPE.STRING: case JSONType.string:
ret = v.str; ret = v.str;
break; break;
case JSON_TYPE.UINTEGER: case JSONType.uinteger:
ret = to!string(v.integer); ret = to!string(v.integer);
break; break;
case JSON_TYPE.INTEGER: case JSONType.integer:
ret = to!string(v.integer); ret = to!string(v.integer);
break; break;
case JSON_TYPE.FLOAT: case JSONType.float_:
ret = to!string(v.floating); ret = to!string(v.floating);
break; break;
case JSON_TYPE.OBJECT: case JSONType.object:
case JSON_TYPE.ARRAY: case JSONType.array:
enforce(0, "invalid session data"); enforce(0, "invalid session data");
break; break;
case JSON_TYPE.TRUE: case JSONType.true_:
ret = "true"; ret = "true";
break; break;
case JSON_TYPE.FALSE: case JSONType.false_:
ret = "false"; ret = "false";
break; break;
case JSON_TYPE.NULL: case JSONType.null_:
ret = null; ret = null;
break; break;
} }