fix warnings of DMD2.071

This commit is contained in:
Vadim Lopatin 2016-04-11 10:24:45 +03:00
parent 2f39fd8891
commit 0f61a1d355
12 changed files with 23 additions and 0 deletions

View File

@ -1138,12 +1138,15 @@ class EditableContent {
static alias isDigit = std.uni.isNumber; static alias isDigit = std.uni.isNumber;
static bool isAlpha(dchar ch) pure nothrow { static bool isAlpha(dchar ch) pure nothrow {
static import std.uni;
return std.uni.isAlpha(ch) || ch == '_'; return std.uni.isAlpha(ch) || ch == '_';
} }
static bool isAlNum(dchar ch) pure nothrow { static bool isAlNum(dchar ch) pure nothrow {
static import std.uni;
return isDigit(ch) || isAlpha(ch); return isDigit(ch) || isAlpha(ch);
} }
static bool isLowerAlpha(dchar ch) pure nothrow { static bool isLowerAlpha(dchar ch) pure nothrow {
static import std.uni;
return std.uni.isLower(ch) || ch == '_'; return std.uni.isLower(ch) || ch == '_';
} }
static alias isUpperAlpha = std.uni.isUpper; static alias isUpperAlpha = std.uni.isUpper;

View File

@ -592,6 +592,7 @@ struct ButtonDetails {
/// update for button down /// update for button down
void down(short x, short y, ushort flags) { void down(short x, short y, ushort flags) {
static import std.datetime;
//Log.d("Button down ", x, ",", y, " _downTs=", _downTs, " _upTs=", _upTs); //Log.d("Button down ", x, ",", y, " _downTs=", _downTs, " _upTs=", _upTs);
long oldDownTs = _downTs; long oldDownTs = _downTs;
_downX = x; _downX = x;
@ -605,6 +606,7 @@ struct ButtonDetails {
} }
/// update for button up /// update for button up
void up(short x, short y, ushort flags) { void up(short x, short y, ushort flags) {
static import std.datetime;
//Log.d("Button up ", x, ",", y, " _downTs=", _downTs, " _upTs=", _upTs); //Log.d("Button up ", x, ",", y, " _downTs=", _downTs, " _upTs=", _upTs);
_doubleClick = false; _doubleClick = false;
_upTs = std.datetime.Clock.currStdTime; _upTs = std.datetime.Clock.currStdTime;
@ -613,6 +615,7 @@ struct ButtonDetails {
@property bool isDown() { return _downTs != 0 && _upTs == 0; } @property bool isDown() { return _downTs != 0 && _upTs == 0; }
/// returns button down state duration in hnsecs (1/10000 of second). /// returns button down state duration in hnsecs (1/10000 of second).
@property int downDuration() { @property int downDuration() {
static import std.datetime;
if (_downTs == 0) if (_downTs == 0)
return 0; return 0;
if (_downTs != 0 && _upTs != 0) if (_downTs != 0 && _upTs != 0)
@ -724,6 +727,7 @@ class MouseEvent {
} }
/// construct mouse event from data /// construct mouse event from data
this (MouseAction a, MouseButton b, ushort f, short x, short y, short wheelDelta = 0) { this (MouseAction a, MouseButton b, ushort f, short x, short y, short wheelDelta = 0) {
static import std.datetime;
_eventTimestamp = std.datetime.Clock.currStdTime; _eventTimestamp = std.datetime.Clock.currStdTime;
_action = a; _action = a;
_button = b; _button = b;

View File

@ -55,6 +55,7 @@ enum LogLevel : int {
/// Returns timestamp in milliseconds since 1970 UTC similar to Java System.currentTimeMillis() /// Returns timestamp in milliseconds since 1970 UTC similar to Java System.currentTimeMillis()
@property long currentTimeMillis() { @property long currentTimeMillis() {
static import std.datetime;
return std.datetime.Clock.currStdTime / 10000; return std.datetime.Clock.currStdTime / 10000;
} }

View File

@ -1630,12 +1630,15 @@ final class Setting {
throw new Exception("JSON parsing error in (" ~ to!string(line) ~ ":" ~ to!string(col) ~ ") " ~ context ~ ": " ~ msg); throw new Exception("JSON parsing error in (" ~ to!string(line) ~ ":" ~ to!string(col) ~ ") " ~ context ~ ": " ~ msg);
} }
static bool isAlpha(char ch) { static bool isAlpha(char ch) {
static import std.ascii;
return std.ascii.isAlpha(ch) || ch == '_'; return std.ascii.isAlpha(ch) || ch == '_';
} }
static bool isAlNum(char ch) { static bool isAlNum(char ch) {
static import std.ascii;
return std.ascii.isAlphaNum(ch) || ch == '_'; return std.ascii.isAlphaNum(ch) || ch == '_';
} }
@property char skipSpaces() { @property char skipSpaces() {
static import std.ascii;
for(;pos < json.length;pos++) { for(;pos < json.length;pos++) {
char ch = json[pos]; char ch = json[pos];
if (!std.ascii.isWhite(ch)) if (!std.ascii.isWhite(ch))
@ -1866,6 +1869,7 @@ final class Setting {
} }
private Setting parseJSON(ref JsonParser parser) { private Setting parseJSON(ref JsonParser parser) {
static import std.ascii;
char ch = parser.skipSpaces; char ch = parser.skipSpaces;
if (ch == '\"') { if (ch == '\"') {
this = parser.parseString; this = parser.parseString;

View File

@ -473,6 +473,7 @@ wstring fromWStringz(const(wchar) * s) {
Uppercase unicode character. Uppercase unicode character.
*/ */
deprecated dchar dcharToUpper(dchar ch) { deprecated dchar dcharToUpper(dchar ch) {
static import std.uni;
return std.uni.toUpper(ch); return std.uni.toUpper(ch);
} }

View File

@ -39,6 +39,7 @@ import dlangui.graphics.scene.effect;
derelict.util.exception.ShouldThrow gl3MissingSymFunc( string symName ) { derelict.util.exception.ShouldThrow gl3MissingSymFunc( string symName ) {
import std.algorithm : equal; import std.algorithm : equal;
static import derelict.util.exception;
foreach(s; ["glGetError", "glShaderSource", "glCompileShader", foreach(s; ["glGetError", "glShaderSource", "glCompileShader",
"glGetShaderiv", "glGetShaderInfoLog", "glGetString", "glGetShaderiv", "glGetShaderInfoLog", "glGetString",
"glCreateProgram", "glUseProgram", "glDeleteProgram", "glCreateProgram", "glUseProgram", "glDeleteProgram",

View File

@ -53,6 +53,7 @@ import std.conv : to;
/// load and decode image from file to ColorDrawBuf, returns null if loading or decoding is failed /// load and decode image from file to ColorDrawBuf, returns null if loading or decoding is failed
ColorDrawBuf loadImage(string filename) { ColorDrawBuf loadImage(string filename) {
static import std.file;
try { try {
immutable ubyte[] data = cast(immutable ubyte[])std.file.read(filename); immutable ubyte[] data = cast(immutable ubyte[])std.file.read(filename);
return loadImage(data, filename); return loadImage(data, filename);

View File

@ -251,6 +251,7 @@ struct AutoParams {
this.bumpMapping = bumpMapping; this.bumpMapping = bumpMapping;
} }
string defs() { string defs() {
import std.conv : to;
char[] buf; char[] buf;
if (directionalLightCount) { if (directionalLightCount) {
buf ~= "DIRECTIONAL_LIGHT_COUNT "; buf ~= "DIRECTIONAL_LIGHT_COUNT ";

View File

@ -445,6 +445,7 @@ class Window : CustomEventTarget {
static immutable int PERFORMANCE_LOGGING_THRESHOLD_MS = 20; static immutable int PERFORMANCE_LOGGING_THRESHOLD_MS = 20;
void onDraw(DrawBuf buf) { void onDraw(DrawBuf buf) {
static import std.datetime;
try { try {
bool needDraw = false; bool needDraw = false;
bool needLayout = false; bool needLayout = false;

View File

@ -184,6 +184,7 @@ version (Windows) {
/// initialize logging (for win32 - to file ui.log, for other platforms - stderr; log level is TRACE for debug builds, and WARN for release builds) /// initialize logging (for win32 - to file ui.log, for other platforms - stderr; log level is TRACE for debug builds, and WARN for release builds)
extern (C) void initLogs() { extern (C) void initLogs() {
static import std.stdio;
version (Windows) { version (Windows) {
debug { debug {
Log.setFileLogger(new std.stdio.File("ui.log", "w")); Log.setFileLogger(new std.stdio.File("ui.log", "w"));

View File

@ -306,6 +306,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
/// override to add custom items on left panel /// override to add custom items on left panel
protected void updateLeftPaneWidth() { protected void updateLeftPaneWidth() {
import std.conv : to;
_iconsWidth = _showIcons ? _iconsPaneWidth : 0; _iconsWidth = _showIcons ? _iconsPaneWidth : 0;
_foldingWidth = _showFolding ? _foldingPaneWidth : 0; _foldingWidth = _showFolding ? _foldingPaneWidth : 0;
_modificationMarksWidth = _showModificationMarks ? _modificationMarksPaneWidth : 0; _modificationMarksWidth = _showModificationMarks ? _modificationMarksPaneWidth : 0;
@ -369,6 +370,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
} }
protected void drawLeftPaneLineNumbers(DrawBuf buf, Rect rc, int line) { protected void drawLeftPaneLineNumbers(DrawBuf buf, Rect rc, int line) {
import std.conv : to;
buf.fillRect(rc, _leftPaneLineNumberBackgroundColor); buf.fillRect(rc, _leftPaneLineNumberBackgroundColor);
if (line < 0) if (line < 0)
return; return;
@ -2842,6 +2844,7 @@ class LogWidget : EditBox {
/// append lines to the end of text /// append lines to the end of text
void appendText(dstring text) { void appendText(dstring text) {
import std.array : split;
if (text.length == 0) if (text.length == 0)
return; return;
dstring[] lines = text.split("\n"); dstring[] lines = text.split("\n");

View File

@ -147,6 +147,7 @@ class MenuItem {
/// get hotkey character from label (e.g. 'F' for item labeled "&File"), 0 if no hotkey /// get hotkey character from label (e.g. 'F' for item labeled "&File"), 0 if no hotkey
dchar getHotkey() { dchar getHotkey() {
static import std.uni;
dstring s = label; dstring s = label;
dchar ch = 0; dchar ch = 0;
for (int i = 0; i < s.length - 1; i++) { for (int i = 0; i < s.length - 1; i++) {
@ -160,6 +161,7 @@ class MenuItem {
/// find subitem by hotkey character, returns subitem index, -1 if not found /// find subitem by hotkey character, returns subitem index, -1 if not found
int findSubitemByHotkey(dchar ch) { int findSubitemByHotkey(dchar ch) {
static import std.uni;
if (!ch) if (!ch)
return -1; return -1;
ch = std.uni.toUpper(ch); ch = std.uni.toUpper(ch);