mirror of https://github.com/adamdruppe/arsd.git
trailing whitespace
This commit is contained in:
parent
08c07cda3a
commit
3f1de5a834
2
apng.d
2
apng.d
|
@ -790,7 +790,7 @@ void writeApngToData(ApngAnimation apng, scope void delegate(in ubyte[] data) si
|
||||||
bytesPerLine = cast(size_t) frame.frameControlChunk.width * 4 * apng.header.depth / 8;
|
bytesPerLine = cast(size_t) frame.frameControlChunk.width * 4 * apng.header.depth / 8;
|
||||||
break;
|
break;
|
||||||
default: assert(0);
|
default: assert(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Chunk dat;
|
Chunk dat;
|
||||||
|
|
2
com.d
2
com.d
|
@ -227,7 +227,7 @@ struct ComClient(DVersion, ComVersion = IDispatch) {
|
||||||
import std.conv;
|
import std.conv;
|
||||||
wchar*[1] names = [(to!wstring(memberName) ~ "\0"w).dup.ptr];
|
wchar*[1] names = [(to!wstring(memberName) ~ "\0"w).dup.ptr];
|
||||||
ComCheck(innerComObject_.GetIDsOfNames(&GUID_NULL, names.ptr, 1, LOCALE_SYSTEM_DEFAULT, &dispid), "Look up name");
|
ComCheck(innerComObject_.GetIDsOfNames(&GUID_NULL, names.ptr, 1, LOCALE_SYSTEM_DEFAULT, &dispid), "Look up name");
|
||||||
|
|
||||||
DISPPARAMS disp_params;
|
DISPPARAMS disp_params;
|
||||||
|
|
||||||
static if(args.length) {
|
static if(args.length) {
|
||||||
|
|
|
@ -393,7 +393,7 @@ class SelectBuilder : SqlBuilder {
|
||||||
sql ~= o;
|
sql ~= o;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(orderBys.length) {
|
if(orderBys.length) {
|
||||||
bool outputted = false;
|
bool outputted = false;
|
||||||
sql ~= " ORDER BY ";
|
sql ~= " ORDER BY ";
|
||||||
|
|
6
engine.d
6
engine.d
|
@ -682,7 +682,7 @@ class Engine{
|
||||||
return buttonsDown[button][which];
|
return buttonsDown[button][which];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool keyWasPressed(int button){
|
bool keyWasPressed(int button){
|
||||||
if(button < 400 && button >= 0)
|
if(button < 400 && button >= 0)
|
||||||
if(!keysChecked[button] && keysDown[button]){
|
if(!keysChecked[button] && keysDown[button]){
|
||||||
|
@ -1152,7 +1152,7 @@ class Engine{
|
||||||
mouseY = event.motion.y;
|
mouseY = event.motion.y;
|
||||||
mousedx += event.motion.xrel;
|
mousedx += event.motion.xrel;
|
||||||
mousedy += event.motion.yrel;
|
mousedy += event.motion.yrel;
|
||||||
|
|
||||||
mouseEvent(
|
mouseEvent(
|
||||||
MOTION,
|
MOTION,
|
||||||
event.motion.x,
|
event.motion.x,
|
||||||
|
@ -1246,7 +1246,7 @@ version(linux) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// else, use kbhit.o from the C file
|
// else, use kbhit.o from the C file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ template enforceBase(ExceptionBaseClass, string failureCondition = "ret is null"
|
||||||
sink(" call failed");
|
sink(" call failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto exception = new C(args);
|
auto exception = new C(args);
|
||||||
exception.file = file;
|
exception.file = file;
|
||||||
exception.line = line;
|
exception.line = line;
|
||||||
|
@ -188,7 +188,7 @@ void raise(ExceptionBaseClass, T...)(string file = __FILE__, size_t line = __LIN
|
||||||
sink(__traits(identifier, ExceptionBaseClass));
|
sink(__traits(identifier, ExceptionBaseClass));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto exception = new C();
|
auto exception = new C();
|
||||||
exception.file = file;
|
exception.file = file;
|
||||||
exception.line = line;
|
exception.line = line;
|
||||||
|
|
4
game.d
4
game.d
|
@ -1399,10 +1399,10 @@ final class OpenGlTexture {
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
glTexImage2D(
|
glTexImage2D(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
|
|
4
html.d
4
html.d
|
@ -827,7 +827,7 @@ mixin template opDispatches(R) {
|
||||||
Translates into javascript:
|
Translates into javascript:
|
||||||
alert("hello");
|
alert("hello");
|
||||||
alert("asds", somevar);
|
alert("asds", somevar);
|
||||||
|
|
||||||
|
|
||||||
The passed code is evaluated lazily.
|
The passed code is evaluated lazily.
|
||||||
*/
|
*/
|
||||||
|
@ -2228,7 +2228,7 @@ Color readCssColor(string cssColor) {
|
||||||
~ cssColor[1] ~ cssColor[1]
|
~ cssColor[1] ~ cssColor[1]
|
||||||
~ cssColor[2] ~ cssColor[2];
|
~ cssColor[2] ~ cssColor[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cssColor.length == 6)
|
if(cssColor.length == 6)
|
||||||
cssColor ~= "ff";
|
cssColor ~= "ff";
|
||||||
|
|
||||||
|
|
|
@ -492,7 +492,7 @@ bool layout(Element element, int containerWidth, int containerHeight, int cx, in
|
||||||
|
|
||||||
if(l.doNotRender)
|
if(l.doNotRender)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(element.nodeType == 3 && element.nodeValue.strip.length == 0) {
|
if(element.nodeType == 3 && element.nodeValue.strip.length == 0) {
|
||||||
l.doNotRender = true;
|
l.doNotRender = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -559,7 +559,7 @@ bool layout(Element element, int containerWidth, int containerHeight, int cx, in
|
||||||
}
|
}
|
||||||
|
|
||||||
auto childLayout = LayoutData.get(child);
|
auto childLayout = LayoutData.get(child);
|
||||||
|
|
||||||
if(!childLayout.outsideNormalFlow && !childLayout.renderInline && hasContentLeft) {
|
if(!childLayout.outsideNormalFlow && !childLayout.renderInline && hasContentLeft) {
|
||||||
cx = initialX;
|
cx = initialX;
|
||||||
cy += biggestHeight;
|
cy += biggestHeight;
|
||||||
|
|
2
http.d
2
http.d
|
@ -149,7 +149,7 @@ HttpResponse httpRequest(string method, string uri, const(ubyte)[] content = nul
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
OpenSSL_add_all_algorithms();
|
OpenSSL_add_all_algorithms();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
|
|
||||||
ctx = SSL_CTX_new(SSLv3_client_method());
|
ctx = SSL_CTX_new(SSLv3_client_method());
|
||||||
sslAssert(!(ctx is null));
|
sslAssert(!(ctx is null));
|
||||||
|
|
||||||
|
|
16
http2.d
16
http2.d
|
@ -7,15 +7,15 @@
|
||||||
|
|
||||||
/++
|
/++
|
||||||
This is version 2 of my http/1.1 client implementation.
|
This is version 2 of my http/1.1 client implementation.
|
||||||
|
|
||||||
|
|
||||||
It has no dependencies for basic operation, but does require OpenSSL
|
It has no dependencies for basic operation, but does require OpenSSL
|
||||||
libraries (or compatible) to be support HTTPS. This dynamically loaded
|
libraries (or compatible) to be support HTTPS. This dynamically loaded
|
||||||
on-demand (meaning it won't be loaded if you don't use it, but if you do
|
on-demand (meaning it won't be loaded if you don't use it, but if you do
|
||||||
use it, the openssl dynamic libraries must be found in the system search path).
|
use it, the openssl dynamic libraries must be found in the system search path).
|
||||||
|
|
||||||
You can compile with `-version=without_openssl` to entirely disable ssl support.
|
You can compile with `-version=without_openssl` to entirely disable ssl support.
|
||||||
|
|
||||||
http2.d, despite its name, does NOT implement HTTP/2.0, but this
|
http2.d, despite its name, does NOT implement HTTP/2.0, but this
|
||||||
shouldn't matter for 99.9% of usage, since all servers will continue
|
shouldn't matter for 99.9% of usage, since all servers will continue
|
||||||
to support HTTP/1.1 for a very long time.
|
to support HTTP/1.1 for a very long time.
|
||||||
|
@ -778,7 +778,7 @@ struct Uri {
|
||||||
|
|
||||||
path_loop:
|
path_loop:
|
||||||
auto path_start = idx;
|
auto path_start = idx;
|
||||||
|
|
||||||
foreach(char c; uri[idx .. $]) {
|
foreach(char c; uri[idx .. $]) {
|
||||||
if(c == '?' || c == '#')
|
if(c == '?' || c == '#')
|
||||||
break;
|
break;
|
||||||
|
@ -1009,7 +1009,7 @@ class HttpRequest {
|
||||||
setMaximumNumberOfRedirects();
|
setMaximumNumberOfRedirects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// ditto
|
/// ditto
|
||||||
this(Uri where, HttpVerb method, ICache cache = null, Duration timeout = 10.seconds, string proxy = null) {
|
this(Uri where, HttpVerb method, ICache cache = null, Duration timeout = 10.seconds, string proxy = null) {
|
||||||
this(null, where, method, cache, timeout, proxy);
|
this(null, where, method, cache, timeout, proxy);
|
||||||
|
@ -2971,7 +2971,7 @@ class HttpClient {
|
||||||
Returns true if the given no_proxy rule matches the uri.
|
Returns true if the given no_proxy rule matches the uri.
|
||||||
|
|
||||||
Invalid IP ranges are silently ignored and return false.
|
Invalid IP ranges are silently ignored and return false.
|
||||||
|
|
||||||
See $(LREF proxyIgnore).
|
See $(LREF proxyIgnore).
|
||||||
+/
|
+/
|
||||||
static bool matchProxyIgnore(scope const(char)[] rule, scope const Uri uri) nothrow {
|
static bool matchProxyIgnore(scope const(char)[] rule, scope const Uri uri) nothrow {
|
||||||
|
@ -3916,7 +3916,7 @@ version(use_openssl) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@trusted
|
@trusted
|
||||||
override ptrdiff_t send(scope const(void)[] buf, SocketFlags flags) {
|
override ptrdiff_t send(scope const(void)[] buf, SocketFlags flags) {
|
||||||
//import std.stdio;writeln(cast(string) buf);
|
//import std.stdio;writeln(cast(string) buf);
|
||||||
|
@ -4421,7 +4421,7 @@ private bool bicmp(in ubyte[] item, in char[] search) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
+/
|
+/
|
||||||
class WebSocket {
|
class WebSocket {
|
||||||
private Uri uri;
|
private Uri uri;
|
||||||
|
|
2
jni.d
2
jni.d
|
@ -135,7 +135,7 @@
|
||||||
|
|
||||||
Constructing Java objects works and it will pin it. Just remember
|
Constructing Java objects works and it will pin it. Just remember
|
||||||
that `this` inside a method is still subject to escaping restrictions!
|
that `this` inside a method is still subject to escaping restrictions!
|
||||||
|
|
||||||
+/
|
+/
|
||||||
module arsd.jni;
|
module arsd.jni;
|
||||||
|
|
||||||
|
|
4
jsvar.d
4
jsvar.d
|
@ -3,7 +3,7 @@
|
||||||
overloads can be done as an object representing the overload set
|
overloads can be done as an object representing the overload set
|
||||||
tat opCall does the dispatch. Then other overloads can actually
|
tat opCall does the dispatch. Then other overloads can actually
|
||||||
be added more sanely.
|
be added more sanely.
|
||||||
|
|
||||||
FIXME:
|
FIXME:
|
||||||
instantiate template members when reflection with certain
|
instantiate template members when reflection with certain
|
||||||
arguments if marked right...
|
arguments if marked right...
|
||||||
|
@ -2826,7 +2826,7 @@ class OverloadSet : PrototypeObject {
|
||||||
|
|
||||||
if(bestScore < 0)
|
if(bestScore < 0)
|
||||||
throw new Exception("no matching overload found " ~ to!string(arguments) ~ " " ~ to!string(overloads));
|
throw new Exception("no matching overload found " ~ to!string(arguments) ~ " " ~ to!string(overloads));
|
||||||
|
|
||||||
|
|
||||||
return bestMatch.func.apply(this_, arguments);
|
return bestMatch.func.apply(this_, arguments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8908,7 +8908,7 @@ class TableView : Widget {
|
||||||
|
|
||||||
assert(percentTotal >= 0, "The total percents in your column definitions were negative. They must add up to something between 0 and 100.");
|
assert(percentTotal >= 0, "The total percents in your column definitions were negative. They must add up to something between 0 and 100.");
|
||||||
assert(percentTotal <= 100, "The total percents in your column definitions exceeded 100. They must add up to no more than 100 (can be less though).");
|
assert(percentTotal <= 100, "The total percents in your column definitions exceeded 100. They must add up to no more than 100 (can be less though).");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9101,7 +9101,7 @@ class TableView : Widget {
|
||||||
SendMessage(hwnd, LVM_REDRAWITEMS, 0, SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0));
|
SendMessage(hwnd, LVM_REDRAWITEMS, 0, SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0));
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9911,7 +9911,7 @@ class ToolBar : Widget {
|
||||||
// and eh, with windows visual styles enabled it looks cool anyway soooo gonna
|
// and eh, with windows visual styles enabled it looks cool anyway soooo gonna
|
||||||
// leave it commented
|
// leave it commented
|
||||||
createWin32Window(this, "ToolbarWindow32"w, "", TBSTYLE_LIST|/*TBSTYLE_FLAT|*/TBSTYLE_TOOLTIPS);
|
createWin32Window(this, "ToolbarWindow32"w, "", TBSTYLE_LIST|/*TBSTYLE_FLAT|*/TBSTYLE_TOOLTIPS);
|
||||||
|
|
||||||
SendMessageW(hwnd, TB_SETEXTENDEDSTYLE, 0, 8/*TBSTYLE_EX_MIXEDBUTTONS*/);
|
SendMessageW(hwnd, TB_SETEXTENDEDSTYLE, 0, 8/*TBSTYLE_EX_MIXEDBUTTONS*/);
|
||||||
|
|
||||||
imageList = ImageList_Create(
|
imageList = ImageList_Create(
|
||||||
|
@ -10955,7 +10955,7 @@ class OnOffSwitch : MouseActivatedWidget {
|
||||||
struct ImageLabel {
|
struct ImageLabel {
|
||||||
/++
|
/++
|
||||||
Defines a label+image combo used by some widgets.
|
Defines a label+image combo used by some widgets.
|
||||||
|
|
||||||
If you provide just a text label, that is all the widget will try to
|
If you provide just a text label, that is all the widget will try to
|
||||||
display. Or just an image will display just that. If you provide both,
|
display. Or just an image will display just that. If you provide both,
|
||||||
it may display both text and image side by side or display the image
|
it may display both text and image side by side or display the image
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
History:
|
History:
|
||||||
Written April 2017.
|
Written April 2017.
|
||||||
|
|
||||||
Added to dub on December 9, 2021.
|
Added to dub on December 9, 2021.
|
||||||
+/
|
+/
|
||||||
module arsd.minigui_addons.color_dialog;
|
module arsd.minigui_addons.color_dialog;
|
||||||
|
|
6
mssql.d
6
mssql.d
|
@ -128,7 +128,7 @@ class MsSqlResult : ResultSet {
|
||||||
{
|
{
|
||||||
return 1; //FIX ME
|
return 1; //FIX ME
|
||||||
}
|
}
|
||||||
|
|
||||||
this(SQLHSTMT statement) {
|
this(SQLHSTMT statement) {
|
||||||
this.statement = statement;
|
this.statement = statement;
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class MsSqlResult : ResultSet {
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
if (ret != SQL_SUCCESS)
|
if (ret != SQL_SUCCESS)
|
||||||
throw new DatabaseException("Field mapping error: " ~ getSQLError(SQL_HANDLE_STMT, statement));
|
throw new DatabaseException("Field mapping error: " ~ getSQLError(SQL_HANDLE_STMT, statement));
|
||||||
|
|
||||||
string a = cast(string) buf[0 .. len].idup;
|
string a = cast(string) buf[0 .. len].idup;
|
||||||
|
|
||||||
columnNames ~= a;
|
columnNames ~= a;
|
||||||
|
@ -218,7 +218,7 @@ private string getSQLError(short handletype, SQLHANDLE handle)
|
||||||
char[32] sqlstate;
|
char[32] sqlstate;
|
||||||
char[256] message;
|
char[256] message;
|
||||||
SQLINTEGER nativeerror=0;
|
SQLINTEGER nativeerror=0;
|
||||||
SQLSMALLINT textlen=0;
|
SQLSMALLINT textlen=0;
|
||||||
auto ret = SQLGetDiagRec(handletype, handle, 1,
|
auto ret = SQLGetDiagRec(handletype, handle, 1,
|
||||||
cast(ubyte*)sqlstate.ptr,
|
cast(ubyte*)sqlstate.ptr,
|
||||||
cast(int*)&nativeerror,
|
cast(int*)&nativeerror,
|
||||||
|
|
4
mysql.d
4
mysql.d
|
@ -590,7 +590,7 @@ class MySql : Database {
|
||||||
|
|
||||||
ulong itemsTotal;
|
ulong itemsTotal;
|
||||||
ulong itemsUsed;
|
ulong itemsUsed;
|
||||||
|
|
||||||
alias string[] Row;
|
alias string[] Row;
|
||||||
|
|
||||||
Row row;
|
Row row;
|
||||||
|
@ -853,7 +853,7 @@ extern(System) {
|
||||||
uint charsetnr; /* Character set */
|
uint charsetnr; /* Character set */
|
||||||
uint type; /* Type of field. See mysql_com.h for types */
|
uint type; /* Type of field. See mysql_com.h for types */
|
||||||
// type is actually an enum btw
|
// type is actually an enum btw
|
||||||
|
|
||||||
version(MySQL_51) {
|
version(MySQL_51) {
|
||||||
void* extension;
|
void* extension;
|
||||||
}
|
}
|
||||||
|
|
6
oauth.d
6
oauth.d
|
@ -179,7 +179,7 @@ string fbGraphImpl(string info, string id, bool useCache = false, long maxCacheH
|
||||||
|
|
||||||
if(id[0] != '/')
|
if(id[0] != '/')
|
||||||
id = "/" ~ id;
|
id = "/" ~ id;
|
||||||
|
|
||||||
if(info !is null)
|
if(info !is null)
|
||||||
url = "https://graph.facebook.com" ~ id
|
url = "https://graph.facebook.com" ~ id
|
||||||
~ c ~ "access_token=" ~ info ~ "&format=json";
|
~ c ~ "access_token=" ~ info ~ "&format=json";
|
||||||
|
@ -202,7 +202,7 @@ string fbGraphImpl(string info, string id, bool useCache = false, long maxCacheH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
response = curl(url);
|
response = curl(url);
|
||||||
} catch(CurlException e) {
|
} catch(CurlException e) {
|
||||||
|
@ -848,7 +848,7 @@ ubyte[] mhashSign(string data, string signWith, hashid algorithm) {
|
||||||
ret ~= std.string.format("%.2x", mac[j]);
|
ret ~= std.string.format("%.2x", mac[j]);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
png.d
2
png.d
|
@ -405,7 +405,7 @@ PNG* pngFromImage(IndexedImage i) {
|
||||||
case 4: shift-= 4; break;
|
case 4: shift-= 4; break;
|
||||||
case 8: shift-= 8; break;
|
case 8: shift-= 8; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
justAdvanced = shift < 0;
|
justAdvanced = shift < 0;
|
||||||
if(shift < 0) {
|
if(shift < 0) {
|
||||||
dsp++;
|
dsp++;
|
||||||
|
|
62
qrcode.d
62
qrcode.d
|
@ -154,16 +154,16 @@ enum /*qrcodegen_Mode*/ {
|
||||||
struct qrcodegen_Segment {
|
struct qrcodegen_Segment {
|
||||||
// The mode indicator of this segment.
|
// The mode indicator of this segment.
|
||||||
qrcodegen_Mode mode;
|
qrcodegen_Mode mode;
|
||||||
|
|
||||||
// The length of this segment's unencoded data. Measured in characters for
|
// The length of this segment's unencoded data. Measured in characters for
|
||||||
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
|
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
|
||||||
// Always zero or positive. Not the same as the data's bit length.
|
// Always zero or positive. Not the same as the data's bit length.
|
||||||
int numChars;
|
int numChars;
|
||||||
|
|
||||||
// The data bits of this segment, packed in bitwise big endian.
|
// The data bits of this segment, packed in bitwise big endian.
|
||||||
// Can be null if the bit length is zero.
|
// Can be null if the bit length is zero.
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
|
||||||
// The number of valid data bits used in the buffer. Requires
|
// The number of valid data bits used in the buffer. Requires
|
||||||
// 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
|
// 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
|
||||||
// The character count (numChars) must agree with the mode and the bit buffer length.
|
// The character count (numChars) must agree with the mode and the bit buffer length.
|
||||||
|
@ -323,12 +323,12 @@ static const int PENALTY_N4 = 10;
|
||||||
// Public function - see documentation comment in header file.
|
// Public function - see documentation comment in header file.
|
||||||
bool qrcodegen_encodeText(const char *text, uint8_t* tempBuffer, uint8_t* qrcode,
|
bool qrcodegen_encodeText(const char *text, uint8_t* tempBuffer, uint8_t* qrcode,
|
||||||
qrcodegen_Ecc ecl, int minVersion, int maxVersion, qrcodegen_Mask mask, bool boostEcl) {
|
qrcodegen_Ecc ecl, int minVersion, int maxVersion, qrcodegen_Mask mask, bool boostEcl) {
|
||||||
|
|
||||||
size_t textLen = strlen(text);
|
size_t textLen = strlen(text);
|
||||||
if (textLen == 0)
|
if (textLen == 0)
|
||||||
return qrcodegen_encodeSegmentsAdvanced(null, 0, ecl, minVersion, maxVersion, mask, boostEcl, tempBuffer, qrcode);
|
return qrcodegen_encodeSegmentsAdvanced(null, 0, ecl, minVersion, maxVersion, mask, boostEcl, tempBuffer, qrcode);
|
||||||
size_t bufLen = qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion);
|
size_t bufLen = qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion);
|
||||||
|
|
||||||
qrcodegen_Segment seg;
|
qrcodegen_Segment seg;
|
||||||
if (qrcodegen_isNumeric(text)) {
|
if (qrcodegen_isNumeric(text)) {
|
||||||
if (qrcodegen_calcSegmentBufferSize(qrcodegen_Mode_NUMERIC, textLen) > bufLen)
|
if (qrcodegen_calcSegmentBufferSize(qrcodegen_Mode_NUMERIC, textLen) > bufLen)
|
||||||
|
@ -351,7 +351,7 @@ bool qrcodegen_encodeText(const char *text, uint8_t* tempBuffer, uint8_t* qrcode
|
||||||
seg.data = tempBuffer;
|
seg.data = tempBuffer;
|
||||||
}
|
}
|
||||||
return qrcodegen_encodeSegmentsAdvanced(&seg, 1, ecl, minVersion, maxVersion, mask, boostEcl, tempBuffer, qrcode);
|
return qrcodegen_encodeSegmentsAdvanced(&seg, 1, ecl, minVersion, maxVersion, mask, boostEcl, tempBuffer, qrcode);
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
qrcode[0] = 0; // Set size to invalid value for safety
|
qrcode[0] = 0; // Set size to invalid value for safety
|
||||||
return false;
|
return false;
|
||||||
|
@ -361,7 +361,7 @@ fail:
|
||||||
// Public function - see documentation comment in header file.
|
// Public function - see documentation comment in header file.
|
||||||
bool qrcodegen_encodeBinary(uint8_t* dataAndTemp, size_t dataLen, uint8_t* qrcode,
|
bool qrcodegen_encodeBinary(uint8_t* dataAndTemp, size_t dataLen, uint8_t* qrcode,
|
||||||
qrcodegen_Ecc ecl, int minVersion, int maxVersion, qrcodegen_Mask mask, bool boostEcl) {
|
qrcodegen_Ecc ecl, int minVersion, int maxVersion, qrcodegen_Mask mask, bool boostEcl) {
|
||||||
|
|
||||||
qrcodegen_Segment seg;
|
qrcodegen_Segment seg;
|
||||||
seg.mode = qrcodegen_Mode_BYTE;
|
seg.mode = qrcodegen_Mode_BYTE;
|
||||||
seg.bitLength = calcSegmentBitLength(seg.mode, dataLen);
|
seg.bitLength = calcSegmentBitLength(seg.mode, dataLen);
|
||||||
|
@ -433,7 +433,7 @@ bool qrcodegen_encodeSegmentsAdvanced(const qrcodegen_Segment* segs, size_t len,
|
||||||
assert(segs != null || len == 0);
|
assert(segs != null || len == 0);
|
||||||
assert(qrcodegen_VERSION_MIN <= minVersion && minVersion <= maxVersion && maxVersion <= qrcodegen_VERSION_MAX);
|
assert(qrcodegen_VERSION_MIN <= minVersion && minVersion <= maxVersion && maxVersion <= qrcodegen_VERSION_MAX);
|
||||||
assert(0 <= cast(int)ecl && cast(int)ecl <= 3 && -1 <= cast(int)mask && cast(int)mask <= 7);
|
assert(0 <= cast(int)ecl && cast(int)ecl <= 3 && -1 <= cast(int)mask && cast(int)mask <= 7);
|
||||||
|
|
||||||
// Find the minimal version_ number to use
|
// Find the minimal version_ number to use
|
||||||
int version_, dataUsedBits;
|
int version_, dataUsedBits;
|
||||||
for (version_ = minVersion; ; version_++) {
|
for (version_ = minVersion; ; version_++) {
|
||||||
|
@ -447,13 +447,13 @@ bool qrcodegen_encodeSegmentsAdvanced(const qrcodegen_Segment* segs, size_t len,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(dataUsedBits != -1);
|
assert(dataUsedBits != -1);
|
||||||
|
|
||||||
// Increase the error correction level while the data still fits in the current version_ number
|
// Increase the error correction level while the data still fits in the current version_ number
|
||||||
for (int i = cast(int)qrcodegen_Ecc_MEDIUM; i <= cast(int)qrcodegen_Ecc_HIGH; i++) { // From low to high
|
for (int i = cast(int)qrcodegen_Ecc_MEDIUM; i <= cast(int)qrcodegen_Ecc_HIGH; i++) { // From low to high
|
||||||
if (boostEcl && dataUsedBits <= getNumDataCodewords(version_, cast(qrcodegen_Ecc)i) * 8)
|
if (boostEcl && dataUsedBits <= getNumDataCodewords(version_, cast(qrcodegen_Ecc)i) * 8)
|
||||||
ecl = cast(qrcodegen_Ecc)i;
|
ecl = cast(qrcodegen_Ecc)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concatenate all segments to create the data bit string
|
// Concatenate all segments to create the data bit string
|
||||||
memset(qrcode, 0, cast(size_t)qrcodegen_BUFFER_LEN_FOR_VERSION(version_) * (qrcode[0]).sizeof);
|
memset(qrcode, 0, cast(size_t)qrcodegen_BUFFER_LEN_FOR_VERSION(version_) * (qrcode[0]).sizeof);
|
||||||
int bitLen = 0;
|
int bitLen = 0;
|
||||||
|
@ -467,7 +467,7 @@ bool qrcodegen_encodeSegmentsAdvanced(const qrcodegen_Segment* segs, size_t len,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(bitLen == dataUsedBits);
|
assert(bitLen == dataUsedBits);
|
||||||
|
|
||||||
// Add terminator and pad up to a byte if applicable
|
// Add terminator and pad up to a byte if applicable
|
||||||
int dataCapacityBits = getNumDataCodewords(version_, ecl) * 8;
|
int dataCapacityBits = getNumDataCodewords(version_, ecl) * 8;
|
||||||
assert(bitLen <= dataCapacityBits);
|
assert(bitLen <= dataCapacityBits);
|
||||||
|
@ -477,18 +477,18 @@ bool qrcodegen_encodeSegmentsAdvanced(const qrcodegen_Segment* segs, size_t len,
|
||||||
appendBitsToBuffer(0, terminatorBits, qrcode, &bitLen);
|
appendBitsToBuffer(0, terminatorBits, qrcode, &bitLen);
|
||||||
appendBitsToBuffer(0, (8 - bitLen % 8) % 8, qrcode, &bitLen);
|
appendBitsToBuffer(0, (8 - bitLen % 8) % 8, qrcode, &bitLen);
|
||||||
assert(bitLen % 8 == 0);
|
assert(bitLen % 8 == 0);
|
||||||
|
|
||||||
// Pad with alternating bytes until data capacity is reached
|
// Pad with alternating bytes until data capacity is reached
|
||||||
for (uint8_t padByte = 0xEC; bitLen < dataCapacityBits; padByte ^= 0xEC ^ 0x11)
|
for (uint8_t padByte = 0xEC; bitLen < dataCapacityBits; padByte ^= 0xEC ^ 0x11)
|
||||||
appendBitsToBuffer(padByte, 8, qrcode, &bitLen);
|
appendBitsToBuffer(padByte, 8, qrcode, &bitLen);
|
||||||
|
|
||||||
// Draw function and data codeword modules
|
// Draw function and data codeword modules
|
||||||
addEccAndInterleave(qrcode, version_, ecl, tempBuffer);
|
addEccAndInterleave(qrcode, version_, ecl, tempBuffer);
|
||||||
initializeFunctionModules(version_, qrcode);
|
initializeFunctionModules(version_, qrcode);
|
||||||
drawCodewords(tempBuffer, getNumRawDataModules(version_) / 8, qrcode);
|
drawCodewords(tempBuffer, getNumRawDataModules(version_) / 8, qrcode);
|
||||||
drawWhiteFunctionModules(qrcode, version_);
|
drawWhiteFunctionModules(qrcode, version_);
|
||||||
initializeFunctionModules(version_, tempBuffer);
|
initializeFunctionModules(version_, tempBuffer);
|
||||||
|
|
||||||
// Handle masking
|
// Handle masking
|
||||||
if (mask == qrcodegen_Mask_AUTO) { // Automatically choose best mask
|
if (mask == qrcodegen_Mask_AUTO) { // Automatically choose best mask
|
||||||
long minPenalty = long.max;
|
long minPenalty = long.max;
|
||||||
|
@ -527,7 +527,7 @@ private void addEccAndInterleave(uint8_t* data, int version_, qrcodegen_Ecc ecl,
|
||||||
int dataLen = getNumDataCodewords(version_, ecl);
|
int dataLen = getNumDataCodewords(version_, ecl);
|
||||||
int numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
int numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
||||||
int shortBlockDataLen = rawCodewords / numBlocks - blockEccLen;
|
int shortBlockDataLen = rawCodewords / numBlocks - blockEccLen;
|
||||||
|
|
||||||
// Split data into blocks, calculate ECC, and interleave
|
// Split data into blocks, calculate ECC, and interleave
|
||||||
// (not concatenate) the bytes into a single sequence
|
// (not concatenate) the bytes into a single sequence
|
||||||
uint8_t[qrcodegen_REED_SOLOMON_DEGREE_MAX] rsdiv;
|
uint8_t[qrcodegen_REED_SOLOMON_DEGREE_MAX] rsdiv;
|
||||||
|
@ -588,7 +588,7 @@ private void reedSolomonComputeDivisor(int degree, uint8_t* result) {
|
||||||
// For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.
|
// For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.
|
||||||
memset(result, 0, cast(size_t)degree * (result[0]).sizeof);
|
memset(result, 0, cast(size_t)degree * (result[0]).sizeof);
|
||||||
result[degree - 1] = 1; // Start off with the monomial x^0
|
result[degree - 1] = 1; // Start off with the monomial x^0
|
||||||
|
|
||||||
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
|
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
|
||||||
// drop the highest monomial term which is always 1x^degree.
|
// drop the highest monomial term which is always 1x^degree.
|
||||||
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
|
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
|
||||||
|
@ -644,16 +644,16 @@ private void initializeFunctionModules(int version_, uint8_t* qrcode) {
|
||||||
int qrsize = version_ * 4 + 17;
|
int qrsize = version_ * 4 + 17;
|
||||||
memset(qrcode, 0, cast(size_t)((qrsize * qrsize + 7) / 8 + 1) * (qrcode[0]).sizeof);
|
memset(qrcode, 0, cast(size_t)((qrsize * qrsize + 7) / 8 + 1) * (qrcode[0]).sizeof);
|
||||||
qrcode[0] = cast(uint8_t)qrsize;
|
qrcode[0] = cast(uint8_t)qrsize;
|
||||||
|
|
||||||
// Fill horizontal and vertical timing patterns
|
// Fill horizontal and vertical timing patterns
|
||||||
fillRectangle(6, 0, 1, qrsize, qrcode);
|
fillRectangle(6, 0, 1, qrsize, qrcode);
|
||||||
fillRectangle(0, 6, qrsize, 1, qrcode);
|
fillRectangle(0, 6, qrsize, 1, qrcode);
|
||||||
|
|
||||||
// Fill 3 finder patterns (all corners except bottom right) and format bits
|
// Fill 3 finder patterns (all corners except bottom right) and format bits
|
||||||
fillRectangle(0, 0, 9, 9, qrcode);
|
fillRectangle(0, 0, 9, 9, qrcode);
|
||||||
fillRectangle(qrsize - 8, 0, 8, 9, qrcode);
|
fillRectangle(qrsize - 8, 0, 8, 9, qrcode);
|
||||||
fillRectangle(0, qrsize - 8, 9, 8, qrcode);
|
fillRectangle(0, qrsize - 8, 9, 8, qrcode);
|
||||||
|
|
||||||
// Fill numerous alignment patterns
|
// Fill numerous alignment patterns
|
||||||
uint8_t[7] alignPatPos;
|
uint8_t[7] alignPatPos;
|
||||||
int numAlign = getAlignmentPatternPositions(version_, alignPatPos);
|
int numAlign = getAlignmentPatternPositions(version_, alignPatPos);
|
||||||
|
@ -664,7 +664,7 @@ private void initializeFunctionModules(int version_, uint8_t* qrcode) {
|
||||||
fillRectangle(alignPatPos[i] - 2, alignPatPos[j] - 2, 5, 5, qrcode);
|
fillRectangle(alignPatPos[i] - 2, alignPatPos[j] - 2, 5, 5, qrcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill version_ blocks
|
// Fill version_ blocks
|
||||||
if (version_ >= 7) {
|
if (version_ >= 7) {
|
||||||
fillRectangle(qrsize - 11, 0, 3, 6, qrcode);
|
fillRectangle(qrsize - 11, 0, 3, 6, qrcode);
|
||||||
|
@ -683,7 +683,7 @@ static void drawWhiteFunctionModules(uint8_t* qrcode, int version_) {
|
||||||
setModule(qrcode, 6, i, false);
|
setModule(qrcode, 6, i, false);
|
||||||
setModule(qrcode, i, 6, false);
|
setModule(qrcode, i, 6, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
|
// Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
|
||||||
for (int dy = -4; dy <= 4; dy++) {
|
for (int dy = -4; dy <= 4; dy++) {
|
||||||
for (int dx = -4; dx <= 4; dx++) {
|
for (int dx = -4; dx <= 4; dx++) {
|
||||||
|
@ -697,7 +697,7 @@ static void drawWhiteFunctionModules(uint8_t* qrcode, int version_) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw numerous alignment patterns
|
// Draw numerous alignment patterns
|
||||||
uint8_t[7] alignPatPos;
|
uint8_t[7] alignPatPos;
|
||||||
int numAlign = getAlignmentPatternPositions(version_, alignPatPos);
|
int numAlign = getAlignmentPatternPositions(version_, alignPatPos);
|
||||||
|
@ -711,7 +711,7 @@ static void drawWhiteFunctionModules(uint8_t* qrcode, int version_) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw version_ blocks
|
// Draw version_ blocks
|
||||||
if (version_ >= 7) {
|
if (version_ >= 7) {
|
||||||
// Calculate error correction code and pack bits
|
// Calculate error correction code and pack bits
|
||||||
|
@ -720,7 +720,7 @@ static void drawWhiteFunctionModules(uint8_t* qrcode, int version_) {
|
||||||
rem = (rem << 1) ^ ((rem >> 11) * 0x1F25);
|
rem = (rem << 1) ^ ((rem >> 11) * 0x1F25);
|
||||||
c_long bits = cast(c_long)version_ << 12 | rem; // uint18
|
c_long bits = cast(c_long)version_ << 12 | rem; // uint18
|
||||||
assert(bits >> 18 == 0);
|
assert(bits >> 18 == 0);
|
||||||
|
|
||||||
// Draw two copies
|
// Draw two copies
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
|
@ -747,7 +747,7 @@ static void drawFormatBits(qrcodegen_Ecc ecl, qrcodegen_Mask mask, uint8_t* qrco
|
||||||
rem = (rem << 1) ^ ((rem >> 9) * 0x537);
|
rem = (rem << 1) ^ ((rem >> 9) * 0x537);
|
||||||
int bits = (data << 10 | rem) ^ 0x5412; // uint15
|
int bits = (data << 10 | rem) ^ 0x5412; // uint15
|
||||||
assert(bits >> 15 == 0);
|
assert(bits >> 15 == 0);
|
||||||
|
|
||||||
// Draw first copy
|
// Draw first copy
|
||||||
for (int i = 0; i <= 5; i++)
|
for (int i = 0; i <= 5; i++)
|
||||||
setModule(qrcode, 8, i, getBit(bits, i));
|
setModule(qrcode, 8, i, getBit(bits, i));
|
||||||
|
@ -756,7 +756,7 @@ static void drawFormatBits(qrcodegen_Ecc ecl, qrcodegen_Mask mask, uint8_t* qrco
|
||||||
setModule(qrcode, 7, 8, getBit(bits, 8));
|
setModule(qrcode, 7, 8, getBit(bits, 8));
|
||||||
for (int i = 9; i < 15; i++)
|
for (int i = 9; i < 15; i++)
|
||||||
setModule(qrcode, 14 - i, 8, getBit(bits, i));
|
setModule(qrcode, 14 - i, 8, getBit(bits, i));
|
||||||
|
|
||||||
// Draw second copy
|
// Draw second copy
|
||||||
int qrsize = qrcodegen_getSize(qrcode);
|
int qrsize = qrcodegen_getSize(qrcode);
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
|
@ -860,7 +860,7 @@ static void applyMask(const uint8_t* functionModules, uint8_t* qrcode, qrcodegen
|
||||||
static long getPenaltyScore(const uint8_t* qrcode) {
|
static long getPenaltyScore(const uint8_t* qrcode) {
|
||||||
int qrsize = qrcodegen_getSize(qrcode);
|
int qrsize = qrcodegen_getSize(qrcode);
|
||||||
long result = 0;
|
long result = 0;
|
||||||
|
|
||||||
// Adjacent modules in row having same color, and finder-like patterns
|
// Adjacent modules in row having same color, and finder-like patterns
|
||||||
for (int y = 0; y < qrsize; y++) {
|
for (int y = 0; y < qrsize; y++) {
|
||||||
bool runColor = false;
|
bool runColor = false;
|
||||||
|
@ -905,7 +905,7 @@ static long getPenaltyScore(const uint8_t* qrcode) {
|
||||||
}
|
}
|
||||||
result += finderPenaltyTerminateAndCount(runColor, runY, runHistory, qrsize) * PENALTY_N3;
|
result += finderPenaltyTerminateAndCount(runColor, runY, runHistory, qrsize) * PENALTY_N3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2*2 blocks of modules having same color
|
// 2*2 blocks of modules having same color
|
||||||
for (int y = 0; y < qrsize - 1; y++) {
|
for (int y = 0; y < qrsize - 1; y++) {
|
||||||
for (int x = 0; x < qrsize - 1; x++) {
|
for (int x = 0; x < qrsize - 1; x++) {
|
||||||
|
@ -916,7 +916,7 @@ static long getPenaltyScore(const uint8_t* qrcode) {
|
||||||
result += PENALTY_N2;
|
result += PENALTY_N2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Balance of black and white modules
|
// Balance of black and white modules
|
||||||
int black = 0;
|
int black = 0;
|
||||||
for (int y = 0; y < qrsize; y++) {
|
for (int y = 0; y < qrsize; y++) {
|
||||||
|
@ -1171,7 +1171,7 @@ qrcodegen_Segment qrcodegen_makeNumeric(const(char)* digits, uint8_t* buf) {
|
||||||
if (bitLen > 0)
|
if (bitLen > 0)
|
||||||
memset(buf, 0, (cast(size_t)bitLen + 7) / 8 * (buf[0]).sizeof);
|
memset(buf, 0, (cast(size_t)bitLen + 7) / 8 * (buf[0]).sizeof);
|
||||||
result.bitLength = 0;
|
result.bitLength = 0;
|
||||||
|
|
||||||
uint accumData = 0;
|
uint accumData = 0;
|
||||||
int accumCount = 0;
|
int accumCount = 0;
|
||||||
for (; *digits != '\0'; digits++) {
|
for (; *digits != '\0'; digits++) {
|
||||||
|
@ -1212,7 +1212,7 @@ qrcodegen_Segment qrcodegen_makeAlphanumeric(const(char)* text, uint8_t* buf) {
|
||||||
if (bitLen > 0)
|
if (bitLen > 0)
|
||||||
memset(buf, 0, (cast(size_t)bitLen + 7) / 8 * (buf[0]).sizeof);
|
memset(buf, 0, (cast(size_t)bitLen + 7) / 8 * (buf[0]).sizeof);
|
||||||
result.bitLength = 0;
|
result.bitLength = 0;
|
||||||
|
|
||||||
uint accumData = 0;
|
uint accumData = 0;
|
||||||
int accumCount = 0;
|
int accumCount = 0;
|
||||||
for (; *text != '\0'; text++) {
|
for (; *text != '\0'; text++) {
|
||||||
|
|
4
rss.d
4
rss.d
|
@ -723,8 +723,8 @@ auto testAtom1 = `<?xml version="1.0" encoding="utf-8"?>
|
||||||
<link href="http://example.org/" />
|
<link href="http://example.org/" />
|
||||||
<id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
|
<id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
|
||||||
<updated>2003-12-13T18:30:02Z</updated>
|
<updated>2003-12-13T18:30:02Z</updated>
|
||||||
|
|
||||||
|
|
||||||
<entry>
|
<entry>
|
||||||
<title>Atom-Powered Robots Run Amok</title>
|
<title>Atom-Powered Robots Run Amok</title>
|
||||||
<link href="http://example.org/2003/12/13/atom03" />
|
<link href="http://example.org/2003/12/13/atom03" />
|
||||||
|
|
14
screen.d
14
screen.d
|
@ -358,7 +358,7 @@ class Image : Drawable{
|
||||||
for(int b = 0; b < hei; b++)
|
for(int b = 0; b < hei; b++)
|
||||||
p.putpixel(XY(a, b), i.getPixel(XY(a + x, b + y)));
|
p.putpixel(XY(a, b), i.getPixel(XY(a + x, b + y)));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SDL_Surface* s1;
|
SDL_Surface* s1;
|
||||||
|
|
||||||
s1 = IMG_Load(std.string.toStringz(filename));
|
s1 = IMG_Load(std.string.toStringz(filename));
|
||||||
|
@ -467,7 +467,7 @@ class Image : Drawable{
|
||||||
a.g = bufp[1];
|
a.g = bufp[1];
|
||||||
a.b = bufp[0];
|
a.b = bufp[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ int wordLength(in char[] w){
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hline(Point start, int width, Color color){
|
void hline(Point start, int width, Color color){
|
||||||
if(useGL && s.bpp == 124){
|
if(useGL && s.bpp == 124){
|
||||||
line(start, XY(start.x + width, start.y), color);
|
line(start, XY(start.x + width, start.y), color);
|
||||||
|
@ -1080,7 +1080,7 @@ int wordLength(in char[] w){
|
||||||
point.y++;
|
point.y++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void circle(Point center, int radius, Color color){
|
void circle(Point center, int radius, Color color){
|
||||||
if(special) center += translate;
|
if(special) center += translate;
|
||||||
|
@ -1222,7 +1222,7 @@ int wordLength(in char[] w){
|
||||||
bufp = cast(ubyte*)s.surface.pixels;
|
bufp = cast(ubyte*)s.surface.pixels;
|
||||||
for(int y = 0; y < s.height; y++)
|
for(int y = 0; y < s.height; y++)
|
||||||
for(int x = 0; x < s.width; x++){
|
for(int x = 0; x < s.width; x++){
|
||||||
|
|
||||||
bufp[2] = cast(ubyte)((bufp[2] * (255-color.a) + color.r * color.a) / 255);
|
bufp[2] = cast(ubyte)((bufp[2] * (255-color.a) + color.r * color.a) / 255);
|
||||||
bufp[1] = cast(ubyte)((bufp[1] * (255-color.a) + color.g * color.a) / 255);
|
bufp[1] = cast(ubyte)((bufp[1] * (255-color.a) + color.g * color.a) / 255);
|
||||||
bufp[0] = cast(ubyte)((bufp[0] * (255-color.a) + color.b * color.a) / 255);
|
bufp[0] = cast(ubyte)((bufp[0] * (255-color.a) + color.b * color.a) / 255);
|
||||||
|
@ -1396,7 +1396,7 @@ Point drawShadedRect(Painter p, Point where, int width, int height){
|
||||||
Color gray = RGB(128,128,128);
|
Color gray = RGB(128,128,128);
|
||||||
|
|
||||||
Point w;
|
Point w;
|
||||||
|
|
||||||
// top section
|
// top section
|
||||||
w = where + XY( BORDER_WIDTH, 0);
|
w = where + XY( BORDER_WIDTH, 0);
|
||||||
p.box( w + XY(0, 0 * BORDER_WIDTH / 4),
|
p.box( w + XY(0, 0 * BORDER_WIDTH / 4),
|
||||||
|
@ -1419,7 +1419,7 @@ Point drawShadedRect(Painter p, Point where, int width, int height){
|
||||||
p.box( w + XY(-1 *BORDER_WIDTH / 4, 3 * BORDER_WIDTH / 4),
|
p.box( w + XY(-1 *BORDER_WIDTH / 4, 3 * BORDER_WIDTH / 4),
|
||||||
w + XY( 1 *BORDER_WIDTH / 4 + width, 4 * BORDER_WIDTH / 4),
|
w + XY( 1 *BORDER_WIDTH / 4 + width, 4 * BORDER_WIDTH / 4),
|
||||||
gray);
|
gray);
|
||||||
|
|
||||||
// left section
|
// left section
|
||||||
w = where + XY( 0, BORDER_WIDTH);
|
w = where + XY( 0, BORDER_WIDTH);
|
||||||
p.box( w + XY(0 * BORDER_WIDTH / 4, -1),
|
p.box( w + XY(0 * BORDER_WIDTH / 4, -1),
|
||||||
|
|
4
script.d
4
script.d
|
@ -298,7 +298,7 @@ unittest {
|
||||||
return str ~ " concatenation";
|
return str ~ " concatenation";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// once you have the globals set up, you call the interpreter
|
// once you have the globals set up, you call the interpreter
|
||||||
// with one simple function.
|
// with one simple function.
|
||||||
interpret(scriptSource, globals);
|
interpret(scriptSource, globals);
|
||||||
|
@ -3745,7 +3745,7 @@ void repl(bool enhanced = false)(var globals) {
|
||||||
Range r;
|
Range r;
|
||||||
r.popFront();
|
r.popFront();
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeln(T...)(T t) {
|
void writeln(T...)(T t) {
|
||||||
|
|
|
@ -3022,7 +3022,7 @@ snd_pcm_t* openAlsaPcm(snd_pcm_stream_t direction, int SampleRate, int channels,
|
||||||
throw new AlsaException("params malloc", err);
|
throw new AlsaException("params malloc", err);
|
||||||
scope(exit)
|
scope(exit)
|
||||||
snd_pcm_hw_params_free(hwParams);
|
snd_pcm_hw_params_free(hwParams);
|
||||||
|
|
||||||
if (auto err = snd_pcm_hw_params_any(handle, hwParams))
|
if (auto err = snd_pcm_hw_params_any(handle, hwParams))
|
||||||
// can actually survive a failure here, we will just move forward
|
// can actually survive a failure here, we will just move forward
|
||||||
{} // throw new AlsaException("params init", err);
|
{} // throw new AlsaException("params init", err);
|
||||||
|
|
8
sqlite.d
8
sqlite.d
|
@ -524,12 +524,12 @@ template extract(A, T, R...){
|
||||||
if(sqlite3_bind_double(s, col, value) != SQLITE_OK)
|
if(sqlite3_bind_double(s, col, value) != SQLITE_OK)
|
||||||
throw new DatabaseException("bind " ~ db.error());
|
throw new DatabaseException("bind " ~ db.error());
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind(int col, int value){
|
void bind(int col, int value){
|
||||||
if(sqlite3_bind_int(s, col, value) != SQLITE_OK)
|
if(sqlite3_bind_int(s, col, value) != SQLITE_OK)
|
||||||
throw new DatabaseException("bind " ~ db.error());
|
throw new DatabaseException("bind " ~ db.error());
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind(int col, long value){
|
void bind(int col, long value){
|
||||||
if(sqlite3_bind_int64(s, col, value) != SQLITE_OK)
|
if(sqlite3_bind_int64(s, col, value) != SQLITE_OK)
|
||||||
throw new DatabaseException("bind " ~ db.error());
|
throw new DatabaseException("bind " ~ db.error());
|
||||||
|
@ -700,12 +700,12 @@ extern(C){
|
||||||
void *, /* 1st argument to callback */
|
void *, /* 1st argument to callback */
|
||||||
char **errmsg /* Error msg written here */
|
char **errmsg /* Error msg written here */
|
||||||
);
|
);
|
||||||
|
|
||||||
int sqlite3_open(
|
int sqlite3_open(
|
||||||
const(char) *filename, /* Database filename (UTF-8) */
|
const(char) *filename, /* Database filename (UTF-8) */
|
||||||
sqlite3 **ppDb /* OUT: SQLite db handle */
|
sqlite3 **ppDb /* OUT: SQLite db handle */
|
||||||
);
|
);
|
||||||
|
|
||||||
int sqlite3_open_v2(
|
int sqlite3_open_v2(
|
||||||
const char *filename, /* Database filename (UTF-8) */
|
const char *filename, /* Database filename (UTF-8) */
|
||||||
sqlite3 **ppDb, /* OUT: SQLite db handle */
|
sqlite3 **ppDb, /* OUT: SQLite db handle */
|
||||||
|
|
|
@ -104,7 +104,7 @@ version(use_openssl) {
|
||||||
throw new Exception("ssl connect");
|
throw new Exception("ssl connect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@trusted
|
@trusted
|
||||||
override ptrdiff_t send(scope const(void)[] buf, SocketFlags flags) {
|
override ptrdiff_t send(scope const(void)[] buf, SocketFlags flags) {
|
||||||
auto retval = SSL_write(ssl, buf.ptr, cast(uint) buf.length);
|
auto retval = SSL_write(ssl, buf.ptr, cast(uint) buf.length);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
The main interface for this module is the Terminal struct, which
|
The main interface for this module is the Terminal struct, which
|
||||||
encapsulates the output functions and line-buffered input of the terminal, and
|
encapsulates the output functions and line-buffered input of the terminal, and
|
||||||
RealTimeConsoleInput, which gives real time input.
|
RealTimeConsoleInput, which gives real time input.
|
||||||
|
|
||||||
Creating an instance of these structs will perform console initialization. When the struct
|
Creating an instance of these structs will perform console initialization. When the struct
|
||||||
goes out of scope, any changes in console settings will be automatically reverted and pending
|
goes out of scope, any changes in console settings will be automatically reverted and pending
|
||||||
output is flushed. Do not create a global Terminal, as this will skip the destructor. You should
|
output is flushed. Do not create a global Terminal, as this will skip the destructor. You should
|
||||||
|
@ -8012,7 +8012,7 @@ struct ScrollbackBuffer {
|
||||||
linePos++;
|
linePos++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal.moveTo(x, y + ((linePos >= 0) ? linePos : 0));
|
terminal.moveTo(x, y + ((linePos >= 0) ? linePos : 0));
|
||||||
|
|
||||||
auto todo = line.components;
|
auto todo = line.components;
|
||||||
|
|
|
@ -2667,7 +2667,7 @@ P s = 2 3 ; 2 → Restore xterm window title from stack.
|
||||||
'0'-'9' == 0-9
|
'0'-'9' == 0-9
|
||||||
'a'-'z' == 10 - 36
|
'a'-'z' == 10 - 36
|
||||||
anything else is invalid
|
anything else is invalid
|
||||||
|
|
||||||
then a palette in hex rgba format (8 chars each), up to 26 entries
|
then a palette in hex rgba format (8 chars each), up to 26 entries
|
||||||
|
|
||||||
then a capital Z
|
then a capital Z
|
||||||
|
|
10
web.d
10
web.d
|
@ -1811,7 +1811,7 @@ mixin template CustomCgiFancyMain(CustomCgi, T, Args...) if(is(CustomCgi : Cgi))
|
||||||
//writefln("%s", reflection.functions[args[1]].dispatcher(null, namedArgs, "string"));
|
//writefln("%s", reflection.functions[args[1]].dispatcher(null, namedArgs, "string"));
|
||||||
} else {
|
} else {
|
||||||
+/
|
+/
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin CustomCgiMain!(CustomCgi, fancyMainFunction, Args);
|
mixin CustomCgiMain!(CustomCgi, fancyMainFunction, Args);
|
||||||
|
@ -1858,7 +1858,7 @@ Form createAutomaticForm(Document document, string action, in Parameter[] parame
|
||||||
type = param.type;
|
type = param.type;
|
||||||
if(param.name in fieldTypes)
|
if(param.name in fieldTypes)
|
||||||
type = fieldTypes[param.name];
|
type = fieldTypes[param.name];
|
||||||
|
|
||||||
if(type == "select") {
|
if(type == "select") {
|
||||||
input = Element.make("select");
|
input = Element.make("select");
|
||||||
|
|
||||||
|
@ -3298,7 +3298,7 @@ class Session {
|
||||||
|
|
||||||
if(hasData)
|
if(hasData)
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clears the session data from both memory and disk.
|
/// Clears the session data from both memory and disk.
|
||||||
|
@ -3635,7 +3635,7 @@ struct TemplateFilters {
|
||||||
} else {
|
} else {
|
||||||
date = cast(SysTime) DateTime.fromISOExtString(replacement);
|
date = cast(SysTime) DateTime.fromISOExtString(replacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto day = date.day;
|
auto day = date.day;
|
||||||
auto year = date.year;
|
auto year = date.year;
|
||||||
assert(date.month < monthNames.length, to!string(date.month));
|
assert(date.month < monthNames.length, to!string(date.month));
|
||||||
|
@ -4238,7 +4238,7 @@ string makeJavascriptApi(const ReflectionInfo* mod, string base, bool isNested =
|
||||||
|
|
||||||
script ~= n.name;
|
script ~= n.name;
|
||||||
|
|
||||||
}
|
}
|
||||||
script ~= ") { return {\n";
|
script ~= ") { return {\n";
|
||||||
|
|
||||||
outp2 = false;
|
outp2 = false;
|
||||||
|
|
Loading…
Reference in New Issue