mirror of https://github.com/adamdruppe/arsd.git
sundry minor fixes
This commit is contained in:
parent
472236b9fa
commit
6734ac6cf3
2
apng.d
2
apng.d
|
@ -59,7 +59,7 @@ class ApngFrame {
|
||||||
auto bytesPerLine = bytesPerLineOfPng(parent.header.depth, parent.header.type, width);
|
auto bytesPerLine = bytesPerLineOfPng(parent.header.depth, parent.header.type, width);
|
||||||
bytesPerLine--; // removing filter byte from this calculation since we handle separtely
|
bytesPerLine--; // removing filter byte from this calculation since we handle separtely
|
||||||
|
|
||||||
int idataIdx;
|
size_t idataIdx;
|
||||||
ubyte[] idata;
|
ubyte[] idata;
|
||||||
|
|
||||||
idata.length = width * height * (parent.header.type == 3 ? 1 : 4);
|
idata.length = width * height * (parent.header.type == 3 ? 1 : 4);
|
||||||
|
|
2
argon2.d
2
argon2.d
|
@ -5,6 +5,8 @@
|
||||||
+/
|
+/
|
||||||
module arsd.argon2;
|
module arsd.argon2;
|
||||||
|
|
||||||
|
// a password length limitation might legit make sense here cuz of the hashing function can get slow
|
||||||
|
|
||||||
// it is conceivably useful to hash the password with a secret key before passing to this function,
|
// it is conceivably useful to hash the password with a secret key before passing to this function,
|
||||||
// but I'm not going to do that automatically here just to keep this thin and simple.
|
// but I'm not going to do that automatically here just to keep this thin and simple.
|
||||||
|
|
||||||
|
|
1
cgi.d
1
cgi.d
|
@ -1711,6 +1711,7 @@ class Cgi {
|
||||||
if(name != "host" || host is null)
|
if(name != "host" || host is null)
|
||||||
host = value;
|
host = value;
|
||||||
}
|
}
|
||||||
|
// FIXME: https://tools.ietf.org/html/rfc7239
|
||||||
else if (name == "accept-encoding") {
|
else if (name == "accept-encoding") {
|
||||||
if(value.indexOf("gzip") != -1)
|
if(value.indexOf("gzip") != -1)
|
||||||
acceptsGzip = true;
|
acceptsGzip = true;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
///
|
///
|
||||||
module arsd.database;
|
module arsd.database;
|
||||||
|
|
||||||
|
// I should do a prepared statement as a template string arg
|
||||||
|
|
||||||
public import std.variant;
|
public import std.variant;
|
||||||
import std.string;
|
import std.string;
|
||||||
public import std.datetime;
|
public import std.datetime;
|
||||||
|
|
|
@ -123,7 +123,6 @@ class GameHelperBase {
|
||||||
this() {
|
this() {
|
||||||
if(wantAudio) {
|
if(wantAudio) {
|
||||||
audio = new AudioPcmOutThread();
|
audio = new AudioPcmOutThread();
|
||||||
audio.start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +192,18 @@ struct VirtualController {
|
||||||
void runGame(T : GameHelperBase)(T game, int maxUpdateRate = 20, int maxRedrawRate = 0) {
|
void runGame(T : GameHelperBase)(T game, int maxUpdateRate = 20, int maxRedrawRate = 0) {
|
||||||
// this is a template btw because then it can statically dispatch
|
// this is a template btw because then it can statically dispatch
|
||||||
// the members instead of going through the virtual interface.
|
// the members instead of going through the virtual interface.
|
||||||
|
if(game.audio !is null) {
|
||||||
|
game.audio.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
scope(exit)
|
||||||
|
if(game.audio !is null) {
|
||||||
|
import std.stdio;
|
||||||
|
game.audio.stop();
|
||||||
|
game.audio.join();
|
||||||
|
game.audio = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int joystickPlayers = enableJoystickInput();
|
int joystickPlayers = enableJoystickInput();
|
||||||
scope(exit) closeJoysticks();
|
scope(exit) closeJoysticks();
|
||||||
|
@ -297,12 +308,6 @@ void runGame(T : GameHelperBase)(T game, int maxUpdateRate = 20, int maxRedrawRa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// FIXME: what if an exception is thrown above?
|
|
||||||
if(game.audio !is null) {
|
|
||||||
game.audio.stop();
|
|
||||||
game.audio.join();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/++
|
/++
|
||||||
|
|
8
http2.d
8
http2.d
|
@ -747,6 +747,7 @@ class HttpRequest {
|
||||||
debug(arsd_http2) writeln("remote disconnect");
|
debug(arsd_http2) writeln("remote disconnect");
|
||||||
request.state = State.aborted;
|
request.state = State.aborted;
|
||||||
inactive[inactiveCount++] = sock;
|
inactive[inactiveCount++] = sock;
|
||||||
|
sock.close();
|
||||||
loseSocket(request.requestParameters.host, request.requestParameters.port, request.requestParameters.ssl, sock);
|
loseSocket(request.requestParameters.host, request.requestParameters.port, request.requestParameters.ssl, sock);
|
||||||
} else {
|
} else {
|
||||||
// data available
|
// data available
|
||||||
|
@ -1496,6 +1497,7 @@ version(use_openssl) {
|
||||||
int SSL_connect(SSL*);
|
int SSL_connect(SSL*);
|
||||||
int SSL_write(SSL*, const void*, int);
|
int SSL_write(SSL*, const void*, int);
|
||||||
int SSL_read(SSL*, void*, int);
|
int SSL_read(SSL*, void*, int);
|
||||||
|
@trusted nothrow @nogc int SSL_shutdown(SSL*);
|
||||||
void SSL_free(SSL*);
|
void SSL_free(SSL*);
|
||||||
void SSL_CTX_free(SSL_CTX*);
|
void SSL_CTX_free(SSL_CTX*);
|
||||||
|
|
||||||
|
@ -1589,6 +1591,11 @@ version(use_openssl) {
|
||||||
initSsl(verifyPeer);
|
initSsl(verifyPeer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void close() {
|
||||||
|
if(ssl) SSL_shutdown(ssl);
|
||||||
|
super.close();
|
||||||
|
}
|
||||||
|
|
||||||
this(socket_t sock, AddressFamily af) {
|
this(socket_t sock, AddressFamily af) {
|
||||||
super(sock, af);
|
super(sock, af);
|
||||||
initSsl(true);
|
initSsl(true);
|
||||||
|
@ -1597,6 +1604,7 @@ version(use_openssl) {
|
||||||
~this() {
|
~this() {
|
||||||
SSL_free(ssl);
|
SSL_free(ssl);
|
||||||
SSL_CTX_free(ctx);
|
SSL_CTX_free(ctx);
|
||||||
|
ssl = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,6 +198,7 @@ import core.thread;
|
||||||
final class AudioPcmOutThread : Thread {
|
final class AudioPcmOutThread : Thread {
|
||||||
///
|
///
|
||||||
this() {
|
this() {
|
||||||
|
this.isDaemon = true;
|
||||||
version(linux) {
|
version(linux) {
|
||||||
// this thread has no business intercepting signals from the main thread,
|
// this thread has no business intercepting signals from the main thread,
|
||||||
// so gonna block a couple of them
|
// so gonna block a couple of them
|
||||||
|
@ -292,7 +293,9 @@ final class AudioPcmOutThread : Thread {
|
||||||
|
|
||||||
addChannel(
|
addChannel(
|
||||||
delegate bool(short[] buffer) {
|
delegate bool(short[] buffer) {
|
||||||
auto got = v.getSamplesShortInterleaved(2, buffer.ptr, buffer.length);
|
if(cast(int) buffer.length != buffer.length)
|
||||||
|
throw new Exception("eeeek");
|
||||||
|
auto got = v.getSamplesShortInterleaved(2, buffer.ptr, cast(int) buffer.length);
|
||||||
if(got == 0) {
|
if(got == 0) {
|
||||||
if(loop) {
|
if(loop) {
|
||||||
v.seekStart();
|
v.seekStart();
|
||||||
|
@ -1406,6 +1409,7 @@ extern(C):
|
||||||
alias snd_lib_error_handler_t = void function (const(char)* file, int line, const(char)* function_, int err, const(char)* fmt, ...);
|
alias snd_lib_error_handler_t = void function (const(char)* file, int line, const(char)* function_, int err, const(char)* fmt, ...);
|
||||||
int snd_lib_error_set_handler (snd_lib_error_handler_t handler);
|
int snd_lib_error_set_handler (snd_lib_error_handler_t handler);
|
||||||
|
|
||||||
|
import core.stdc.stdarg;
|
||||||
private void alsa_message_silencer (const(char)* file, int line, const(char)* function_, int err, const(char)* fmt, ...) {}
|
private void alsa_message_silencer (const(char)* file, int line, const(char)* function_, int err, const(char)* fmt, ...) {}
|
||||||
//k8: ALSAlib loves to trash stderr; shut it up
|
//k8: ALSAlib loves to trash stderr; shut it up
|
||||||
void silence_alsa_messages () { snd_lib_error_set_handler(&alsa_message_silencer); }
|
void silence_alsa_messages () { snd_lib_error_set_handler(&alsa_message_silencer); }
|
||||||
|
|
Loading…
Reference in New Issue