This commit is contained in:
Adam D. Ruppe 2022-06-13 20:38:21 -04:00
parent dc68816960
commit 7b2e819357
3 changed files with 10 additions and 3 deletions

4
cgi.d
View File

@ -10799,7 +10799,7 @@ auto serveStaticFile(string urlPrefix, string filename = null, string contentTyp
// man 2 sendfile
assert(urlPrefix[0] == '/');
if(filename is null)
filename = urlPrefix[1 .. $];
filename = decodeComponent(urlPrefix[1 .. $]); // FIXME is this actually correct?
if(contentType is null) {
contentType = contentTypeFromFileExtension(filename);
}
@ -10881,7 +10881,7 @@ auto serveStaticFileDirectory(string urlPrefix, string directory = null) {
assert(directory[$-1] == '/');
static bool internalHandler(string urlPrefix, Cgi cgi, Object presenter, DispatcherDetails details) {
auto file = cgi.pathInfo[urlPrefix.length .. $];
auto file = decodeComponent(cgi.pathInfo[urlPrefix.length .. $]); // FIXME: is this actually correct
if(file.indexOf("/") != -1 || file.indexOf("\\") != -1)
return false;

View File

@ -199,7 +199,9 @@ version(linux) {
break;
else assert(0); // , to!string(fd) ~ " " ~ to!string(errno));
}
assert(r == event.sizeof);
if(r != event.sizeof)
throw new Exception("Read something weird off the joystick event fd");
//import std.stdio; writeln(event);
ptrdiff_t player = -1;
foreach(i, f; joystickFds)
@ -230,6 +232,7 @@ version(linux) {
}
if(event.type & JS_EVENT_BUTTON) {
joystickState[player].buttons[event.number] = event.value ? 255 : 0;
//writeln(player, " ", event.number, " ", event.value, " ", joystickState[player].buttons[event.number]);//, " != ", event.value ? 255 : 0);
}
}
}

View File

@ -109,6 +109,10 @@ struct RC(T) {
object = null;
}
bool opCast(T:bool)() nothrow {
return inner !is null;
}
void opAssign(T obj) {
obj.AddRef();
if(object)