diff options
author | 2015-03-13 17:40:15 +0100 | |
---|---|---|
committer | 2015-03-13 17:40:15 +0100 | |
commit | 7360ae65479fab0a5ef6faab186496a604dbc952 (patch) | |
tree | 84b5270bd4538c3b8b53ffab70a86e08de4ee42c /3rdparty | |
parent | 820ec98714cb229971830ac53df8e40dd12010ab (diff) |
updated 3rd party (nw)
Diffstat (limited to '3rdparty')
23 files changed, 194 insertions, 134 deletions
diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp index 9db3eced5b8..e77f3db6d30 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp @@ -5618,8 +5618,8 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT // From the moment we focused we are ignoring the content of 'buf' ImFormatString(edit_state.InitialText, IM_ARRAYSIZE(edit_state.InitialText), "%s", buf); const char* buf_end = NULL; - edit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), buf, NULL, &buf_end); - edit_state.CurLenA = buf_end - buf; // We can't get the result from ImFormatString() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8. + edit_state.CurLenW = (int)ImTextStrFromUtf8(edit_state.Text, IM_ARRAYSIZE(edit_state.Text), buf, NULL, &buf_end); + edit_state.CurLenA = (int)(buf_end - buf); // We can't get the result from ImFormatString() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8. edit_state.Width = w; edit_state.InputCursorScreenPos = ImVec2(-1.f,-1.f); edit_state.CursorAnimReset(); diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp index 1007787a0bd..7ef7853145f 100644 --- a/3rdparty/bgfx/examples/common/entry/entry.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry.cpp @@ -60,15 +60,17 @@ namespace entry switch (_key) { - case Key::Esc: { return 0x1b; } break; - case Key::Return: { return 0x0d; } break; - case Key::Tab: { return 0x09; } break; - case Key::Space: { return 0xa0; } break; - case Key::Backspace: { return 0x08; } break; - case Key::Plus: { return 0x2b; } break; - case Key::Minus: { return 0x2d; } break; - default: { return '\0'; } break; + case Key::Esc: return 0x1b; + case Key::Return: return '\n'; + case Key::Tab: return '\t'; + case Key::Space: return ' '; + case Key::Backspace: return 0x08; + case Key::Plus: return '+'; + case Key::Minus: return '-'; + default: break; } + + return '\0'; } bool setOrToggle(uint32_t& _flags, const char* _name, uint32_t _bit, int _first, int _argc, char const* const* _argv) diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp index cdd918c0fbb..a2f572022d8 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp @@ -813,6 +813,7 @@ struct Imgui void beginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar, uint8_t _view) { IMGUI_beginFrame(_mx, _my, _button, _width, _height, _inputChar, _view); + nvgViewId(m_nvg, _view); m_view = _view; m_viewWidth = _width; diff --git a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp index 62cb1c87a79..19726040b04 100644 --- a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp @@ -165,7 +165,7 @@ struct OcornutImguiContext ImGui::NewFrame(); - ImGui::ShowTestWindow(); + //ImGui::ShowTestWindow(); //Debug only. } void endFrame() diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.h b/3rdparty/bgfx/examples/common/nanovg/nanovg.h index 4ff96151d73..8709db210d2 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg.h +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.h @@ -599,6 +599,7 @@ struct NVGparams { typedef struct NVGparams NVGparams; NVGcontext* nvgCreate(int edgeaa, unsigned char viewid); +void nvgViewId(struct NVGcontext* ctx, unsigned char viewid); void nvgDelete(struct NVGcontext* ctx); // Contructor and destructor, called by the render back-end. diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp index 40a1fbe8418..6be7bbf9052 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp @@ -1051,6 +1051,13 @@ error: return NULL; } +void nvgViewId(struct NVGcontext* ctx, unsigned char viewid) +{ + struct NVGparams* params = nvgInternalParams(ctx); + struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; + gl->viewid = uint8_t(viewid); +} + void nvgDelete(struct NVGcontext* ctx) { nvgDeleteInternal(ctx); diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp index 53e3acbcd8d..c18d4e939cf 100644 --- a/3rdparty/bgfx/src/image.cpp +++ b/3rdparty/bgfx/src/image.cpp @@ -19,55 +19,55 @@ namespace bgfx // | | | | +----- min blocks x // | | | | | +-- min blocks y // | | | | | | - { 4, 4, 4, 8, 1, 1 }, // BC1 - { 8, 4, 4, 16, 1, 1 }, // BC2 - { 8, 4, 4, 16, 1, 1 }, // BC3 - { 4, 4, 4, 8, 1, 1 }, // BC4 - { 8, 4, 4, 16, 1, 1 }, // BC5 - { 8, 4, 4, 16, 1, 1 }, // BC6H - { 8, 4, 4, 16, 1, 1 }, // BC7 - { 4, 4, 4, 8, 1, 1 }, // ETC1 - { 4, 4, 4, 8, 1, 1 }, // ETC2 - { 8, 4, 4, 16, 1, 1 }, // ETC2A - { 4, 4, 4, 8, 1, 1 }, // ETC2A1 - { 2, 8, 4, 8, 2, 2 }, // PTC12 - { 4, 4, 4, 8, 2, 2 }, // PTC14 - { 2, 8, 4, 8, 2, 2 }, // PTC12A - { 4, 4, 4, 8, 2, 2 }, // PTC14A - { 2, 8, 4, 8, 2, 2 }, // PTC22 - { 4, 4, 4, 8, 2, 2 }, // PTC24 - { 0, 0, 0, 0, 1, 1 }, // Unknown - { 1, 8, 1, 1, 1, 1 }, // R1 - { 8, 1, 1, 1, 1, 1 }, // R8 - { 16, 1, 1, 2, 1, 1 }, // R16 - { 16, 1, 1, 2, 1, 1 }, // R16F - { 32, 1, 1, 4, 1, 1 }, // R32 - { 32, 1, 1, 4, 1, 1 }, // R32F - { 16, 1, 1, 2, 1, 1 }, // RG8 - { 32, 1, 1, 4, 1, 1 }, // RG16 - { 32, 1, 1, 4, 1, 1 }, // RG16F - { 64, 1, 1, 8, 1, 1 }, // RG32 - { 64, 1, 1, 8, 1, 1 }, // RG32F - { 32, 1, 1, 4, 1, 1 }, // BGRA8 - { 32, 1, 1, 4, 1, 1 }, // RGBA8 - { 64, 1, 1, 8, 1, 1 }, // RGBA16 - { 64, 1, 1, 8, 1, 1 }, // RGBA16F - { 128, 1, 1, 16, 1, 1 }, // RGBA32 - { 128, 1, 1, 16, 1, 1 }, // RGBA32F - { 16, 1, 1, 2, 1, 1 }, // R5G6B5 - { 16, 1, 1, 2, 1, 1 }, // RGBA4 - { 16, 1, 1, 2, 1, 1 }, // RGB5A1 - { 32, 1, 1, 4, 1, 1 }, // RGB10A2 - { 32, 1, 1, 4, 1, 1 }, // R11G11B10F - { 0, 0, 0, 0, 1, 1 }, // UnknownDepth - { 16, 1, 1, 2, 1, 1 }, // D16 - { 24, 1, 1, 3, 1, 1 }, // D24 - { 32, 1, 1, 4, 1, 1 }, // D24S8 - { 32, 1, 1, 4, 1, 1 }, // D32 - { 16, 1, 1, 2, 1, 1 }, // D16F - { 24, 1, 1, 3, 1, 1 }, // D24F - { 32, 1, 1, 4, 1, 1 }, // D32F - { 8, 1, 1, 1, 1, 1 }, // D0S8 + { 4, 4, 4, 8, 1, 1, 0, 0 }, // BC1 + { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC2 + { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC3 + { 4, 4, 4, 8, 1, 1, 0, 0 }, // BC4 + { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC5 + { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC6H + { 8, 4, 4, 16, 1, 1, 0, 0 }, // BC7 + { 4, 4, 4, 8, 1, 1, 0, 0 }, // ETC1 + { 4, 4, 4, 8, 1, 1, 0, 0 }, // ETC2 + { 8, 4, 4, 16, 1, 1, 0, 0 }, // ETC2A + { 4, 4, 4, 8, 1, 1, 0, 0 }, // ETC2A1 + { 2, 8, 4, 8, 2, 2, 0, 0 }, // PTC12 + { 4, 4, 4, 8, 2, 2, 0, 0 }, // PTC14 + { 2, 8, 4, 8, 2, 2, 0, 0 }, // PTC12A + { 4, 4, 4, 8, 2, 2, 0, 0 }, // PTC14A + { 2, 8, 4, 8, 2, 2, 0, 0 }, // PTC22 + { 4, 4, 4, 8, 2, 2, 0, 0 }, // PTC24 + { 0, 0, 0, 0, 1, 1, 0, 0 }, // Unknown + { 1, 8, 1, 1, 1, 1, 0, 0 }, // R1 + { 8, 1, 1, 1, 1, 1, 0, 0 }, // R8 + { 16, 1, 1, 2, 1, 1, 0, 0 }, // R16 + { 16, 1, 1, 2, 1, 1, 0, 0 }, // R16F + { 32, 1, 1, 4, 1, 1, 0, 0 }, // R32 + { 32, 1, 1, 4, 1, 1, 0, 0 }, // R32F + { 16, 1, 1, 2, 1, 1, 0, 0 }, // RG8 + { 32, 1, 1, 4, 1, 1, 0, 0 }, // RG16 + { 32, 1, 1, 4, 1, 1, 0, 0 }, // RG16F + { 64, 1, 1, 8, 1, 1, 0, 0 }, // RG32 + { 64, 1, 1, 8, 1, 1, 0, 0 }, // RG32F + { 32, 1, 1, 4, 1, 1, 0, 0 }, // BGRA8 + { 32, 1, 1, 4, 1, 1, 0, 0 }, // RGBA8 + { 64, 1, 1, 8, 1, 1, 0, 0 }, // RGBA16 + { 64, 1, 1, 8, 1, 1, 0, 0 }, // RGBA16F + { 128, 1, 1, 16, 1, 1, 0, 0 }, // RGBA32 + { 128, 1, 1, 16, 1, 1, 0, 0 }, // RGBA32F + { 16, 1, 1, 2, 1, 1, 0, 0 }, // R5G6B5 + { 16, 1, 1, 2, 1, 1, 0, 0 }, // RGBA4 + { 16, 1, 1, 2, 1, 1, 0, 0 }, // RGB5A1 + { 32, 1, 1, 4, 1, 1, 0, 0 }, // RGB10A2 + { 32, 1, 1, 4, 1, 1, 0, 0 }, // R11G11B10F + { 0, 0, 0, 0, 1, 1, 0, 0 }, // UnknownDepth + { 16, 1, 1, 2, 1, 1, 16, 0 }, // D16 + { 24, 1, 1, 3, 1, 1, 24, 0 }, // D24 + { 32, 1, 1, 4, 1, 1, 24, 8 }, // D24S8 + { 32, 1, 1, 4, 1, 1, 32, 0 }, // D32 + { 16, 1, 1, 2, 1, 1, 16, 0 }, // D16F + { 24, 1, 1, 3, 1, 1, 24, 0 }, // D24F + { 32, 1, 1, 4, 1, 1, 32, 0 }, // D32F + { 8, 1, 1, 1, 1, 1, 0, 8 }, // D0S8 }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) ); diff --git a/3rdparty/bgfx/src/image.h b/3rdparty/bgfx/src/image.h index 3ddb1086f7c..ab1430c375d 100644 --- a/3rdparty/bgfx/src/image.h +++ b/3rdparty/bgfx/src/image.h @@ -45,6 +45,8 @@ namespace bgfx uint8_t blockSize; uint8_t minBlockX; uint8_t minBlockY; + uint8_t depthBits; + uint8_t stencilBits; }; /// diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index d49987e2fdf..b9893331939 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -201,7 +201,8 @@ namespace bgfx { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC22 { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC24 { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // Unknown - { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN }, // R1 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R1 +// { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN }, // R1 { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN }, // R8 { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN }, // R16 { DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN }, // R16F @@ -728,7 +729,33 @@ namespace bgfx for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) { - g_caps.formats[ii] = DXGI_FORMAT_UNKNOWN == s_textureFormat[ii].m_fmt ? 0 : 1; + uint8_t support = BGFX_CAPS_FORMAT_TEXTURE_NONE; + + if (DXGI_FORMAT_UNKNOWN != s_textureFormat[ii].m_fmt) + { + D3D11_FEATURE_DATA_FORMAT_SUPPORT data; // D3D11_FEATURE_DATA_FORMAT_SUPPORT2 + data.InFormat = s_textureFormat[ii].m_fmt; + DX_CHECK(m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) ) ); + support |= 0 != (data.OutFormatSupport & (0 + | D3D11_FORMAT_SUPPORT_TEXTURE2D + | D3D11_FORMAT_SUPPORT_TEXTURE3D + | D3D11_FORMAT_SUPPORT_TEXTURECUBE + ) ) + ? BGFX_CAPS_FORMAT_TEXTURE_COLOR + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; + + support |= 0 != (data.OutFormatSupport & (0 + | D3D11_FORMAT_SUPPORT_BUFFER + | D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER + | D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER + ) ) + ? BGFX_CAPS_FORMAT_TEXTURE_VERTEX + : BGFX_CAPS_FORMAT_TEXTURE_NONE + ; + } + + g_caps.formats[ii] = support; } // Init reserved part of view name. diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index c6cffc511fd..03503be7d88 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -4072,9 +4072,22 @@ namespace bgfx } GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx; - if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) + TextureFormat::Enum format = (TextureFormat::Enum)texture.m_textureFormat; + if (isDepth(format) ) { - attachment = GL_DEPTH_ATTACHMENT; + const ImageBlockInfo& info = getBlockInfo(format); + if (0 < info.stencilBits) + { + attachment = GL_DEPTH_STENCIL_ATTACHMENT; + } + else if (0 == info.depthBits) + { + attachment = GL_STENCIL_ATTACHMENT; + } + else + { + attachment = GL_DEPTH_ATTACHMENT; + } } else { diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie Binary files differindex 5480af740cc..461635ee772 100644 --- a/3rdparty/bx/tools/bin/darwin/genie +++ b/3rdparty/bx/tools/bin/darwin/genie diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie Binary files differindex 752d1894fbc..de23a2d3a51 100644 --- a/3rdparty/bx/tools/bin/linux/genie +++ b/3rdparty/bx/tools/bin/linux/genie diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe Binary files differindex 0cc72817afc..e2392ff839f 100644 --- a/3rdparty/bx/tools/bin/windows/genie.exe +++ b/3rdparty/bx/tools/bin/windows/genie.exe diff --git a/3rdparty/genie/README.md b/3rdparty/genie/README.md index 0fc9c18128d..4abe8049d68 100644 --- a/3rdparty/genie/README.md +++ b/3rdparty/genie/README.md @@ -14,7 +14,7 @@ Supported project generators: Download (stable) ----------------- - version 206 (commit e65d8143b1186496b9da03c6461a25402a2ee873) + version 215 (commit 76a21acb8d4c45fbcfd0e2e68feb912934094201) Linux: https://github.com/bkaradzic/bx/raw/master/tools/bin/linux/genie diff --git a/3rdparty/genie/build/gmake.darwin/genie.make b/3rdparty/genie/build/gmake.darwin/genie.make index e532179d4b1..fb575d44efd 100644 --- a/3rdparty/genie/build/gmake.darwin/genie.make +++ b/3rdparty/genie/build/gmake.darwin/genie.make @@ -40,12 +40,13 @@ endif ifeq ($(config),release) OBJDIR = obj/Release TARGETDIR = ../../bin/darwin - TARGET = $(TARGETDIR)/genie + override TARGET = $(TARGETDIR)/genie DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os -mmacosx-version-min=10.4 - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. -Wl,-x -mmacosx-version-min=10.4 LDDEPS += @@ -115,12 +116,13 @@ endif ifeq ($(config),debug) OBJDIR = obj/Debug TARGETDIR = ../../bin/darwin - TARGET = $(TARGETDIR)/genie + override TARGET = $(TARGETDIR)/genie DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g -mmacosx-version-min=10.4 - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. -mmacosx-version-min=10.4 LDDEPS += @@ -190,12 +192,13 @@ endif ifeq ($(config),releaseuniv32) OBJDIR = obj/Universal32/Release TARGETDIR = ../../bin/darwin - TARGET = $(TARGETDIR)/genie + override TARGET = $(TARGETDIR)/genie DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os -arch i386 -arch ppc -mmacosx-version-min=10.4 - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. -Wl,-x -arch i386 -arch ppc -mmacosx-version-min=10.4 LDDEPS += @@ -265,12 +268,13 @@ endif ifeq ($(config),debuguniv32) OBJDIR = obj/Universal32/Debug TARGETDIR = ../../bin/darwin - TARGET = $(TARGETDIR)/genie + override TARGET = $(TARGETDIR)/genie DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_MACOSX INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g -arch i386 -arch ppc -mmacosx-version-min=10.4 - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -mmacosx-version-min=10.4 ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. -arch i386 -arch ppc -mmacosx-version-min=10.4 LDDEPS += diff --git a/3rdparty/genie/build/gmake.linux/genie.make b/3rdparty/genie/build/gmake.linux/genie.make index bc4c40cda53..7dbdb0534c3 100644 --- a/3rdparty/genie/build/gmake.linux/genie.make +++ b/3rdparty/genie/build/gmake.linux/genie.make @@ -40,12 +40,13 @@ endif ifeq ($(config),release) OBJDIR = obj/Release TARGETDIR = ../../bin/linux - TARGET = $(TARGETDIR)/genie + override TARGET = $(TARGETDIR)/genie DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE -DLUA_USE_POSIX -DLUA_USE_DLOPEN INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. -s -rdynamic LDDEPS += @@ -115,12 +116,13 @@ endif ifeq ($(config),debug) OBJDIR = obj/Debug TARGETDIR = ../../bin/linux - TARGET = $(TARGETDIR)/genie + override TARGET = $(TARGETDIR)/genie DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE -DLUA_USE_POSIX -DLUA_USE_DLOPEN INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. -rdynamic LDDEPS += @@ -189,8 +191,8 @@ endif OBJDIRS := \ $(OBJDIR) \ - $(OBJDIR)/src/host \ $(OBJDIR)/src/host/lua-5.2.3/src \ + $(OBJDIR)/src/host \ RESOURCES := \ @@ -211,8 +213,8 @@ $(TARGETDIR): $(OBJDIRS): @echo Creating $(OBJDIR) -$(call MKDIR,$(OBJDIR)) - -$(call MKDIR,$(OBJDIR)/src/host) -$(call MKDIR,$(OBJDIR)/src/host/lua-5.2.3/src) + -$(call MKDIR,$(OBJDIR)/src/host) clean: @echo Cleaning genie diff --git a/3rdparty/genie/build/gmake.windows/genie.make b/3rdparty/genie/build/gmake.windows/genie.make index 237eebc1c18..3b63871b978 100644 --- a/3rdparty/genie/build/gmake.windows/genie.make +++ b/3rdparty/genie/build/gmake.windows/genie.make @@ -40,12 +40,13 @@ endif ifeq ($(config),release) OBJDIR = obj/Release TARGETDIR = ../../bin/windows - TARGET = $(TARGETDIR)/genie.exe + override TARGET = $(TARGETDIR)/genie.exe DEFINES += -DNDEBUG -DLUA_COMPAT_MODULE INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -Os - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. -s LDDEPS += @@ -115,12 +116,13 @@ endif ifeq ($(config),debug) OBJDIR = obj/Debug TARGETDIR = ../../bin/windows - TARGET = $(TARGETDIR)/genie.exe + override TARGET = $(TARGETDIR)/genie.exe DEFINES += -D_DEBUG -DLUA_COMPAT_MODULE INCLUDES += -I../../src/host/lua-5.2.3/src ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -Wall -Wextra -g - ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -L. LDDEPS += diff --git a/3rdparty/genie/makefile b/3rdparty/genie/makefile index c3caf34e9af..8908d3fa3fc 100644 --- a/3rdparty/genie/makefile +++ b/3rdparty/genie/makefile @@ -41,7 +41,7 @@ release-linux: $(GENIE) $(SILENT) $(GENIE) release $(SILENT) make -C build/gmake.darwin clean all CC=x86_64-apple-darwin13-clang++ $(SILENT) make -C build/gmake.linux clean all - $(SILENT) make -C build/gmake.windows clean all CC=x86_64-w64-mingw32-gcc + $(SILENT) make -C build/gmake.windows clean all CC=i686-w64-mingw32-gcc $(SILENT) git checkout src/host/version.h release: release-$(OS) diff --git a/3rdparty/genie/scripts/genie.lua b/3rdparty/genie/scripts/genie.lua index 24fe8313c58..468aa5359ce 100644 --- a/3rdparty/genie/scripts/genie.lua +++ b/3rdparty/genie/scripts/genie.lua @@ -7,7 +7,7 @@ -- default when folks build using the makefile. That way they don't have to -- worry about the /scripts argument and all that. -- - premake.make.undefine = { "TARGET" } + premake.make.override = { "TARGET" } solution "genie" configurations { diff --git a/3rdparty/genie/src/actions/make/make_cpp.lua b/3rdparty/genie/src/actions/make/make_cpp.lua index d4f5c3b351a..4492ac2bbd2 100644 --- a/3rdparty/genie/src/actions/make/make_cpp.lua +++ b/3rdparty/genie/src/actions/make/make_cpp.lua @@ -5,7 +5,7 @@ -- premake.make.cpp = { } - premake.make.undefine = { } + premake.make.override = { } local cpp = premake.make.cpp local make = premake.make @@ -174,10 +174,7 @@ _p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true))) _p('endif') _p('') - for _, variable in ipairs(premake.make.undefine) do - _p('override undefine '.. variable) - end - _p('') + _p('ifndef verbose') _p(' SILENT = @') _p('endif') @@ -228,9 +225,9 @@ -- if this platform requires a special compiler or linker, list it here cpp.platformtools(cfg, cc) - _p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir)) - _p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory)) - _p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name)) + _p(' ' .. (table.contains(premake.make.override,"OBJDIR") and "override " or "") .. 'OBJDIR = %s', _MAKE.esc(cfg.objectsdir)) + _p(' ' .. (table.contains(premake.make.override,"TARGETDIR") and "override " or "") .. 'TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory)) + _p(' ' .. (table.contains(premake.make.override,"TARGET") and "override " or "") .. 'TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name)) _p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines))) _p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs))) diff --git a/3rdparty/genie/src/host/scripts.c b/3rdparty/genie/src/host/scripts.c index ab706827655..bc7542d5c03 100644 --- a/3rdparty/genie/src/host/scripts.c +++ b/3rdparty/genie/src/host/scripts.c @@ -179,17 +179,17 @@ const char* builtin_scripts[] = { "ative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\n_p('')\nend\n_p('clean:')\nfor _ ,prj in ipairs(sln.projects) do\n_p('\\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))\nend\n_p('')\n_p('help:')\n_p(1,'@echo \"Usage: make [config=name] [target]\"')\n_p(1,'@echo \"\"')\n_p(1,'@echo \"CONFIGURATIONS:\"')\nlocal cfgpairs = { }\nfor _, platform in ipairs(platforms) do\nfor _, cfgname in ipairs(sln.configurations) do\n_p(1,'@echo \" %s\"', premake.getconfigname(cfgname, platform, true))\nend\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"TARGETS:\"')\n_p(1,'@echo \" all (default)\"')\n_p(1,'@echo \" clean\"')\nfor _, prj in ipairs(sln.projects) do\n_p(1,'@echo \" %s\"', prj.name)\nend\n_p(1,'@echo \"\"')\n_p(1,'@echo \"For more information, see http://industriousone.com/premake/quick-start\"')\nend\n", /* actions/make/make_cpp.lua */ - "premake.make.cpp = { }\npremake.make.undefine = { }\nlocal cpp = premake.make.cpp\nlocal make = premake.make\nfunction premake.make_cpp(prj)\nlocal cc = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\npremake.gmake_cpp_header(prj, cc, platforms)\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_cpp_config(prj, cfg, cc)\nend\nend\nlocal objdirs = {}\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\nobjdirs[_MAKE.esc(path.getdirectory(path.trimdots(file)))] = 1\nend\nend\n_p('OBJDIRS := \\\\')\n_p('\\t$(OBJDIR) \\\\')\nfor dir, _ in pairs(objdirs) do\n_p('\\t$(OBJDIR)/%s \\\\', dir)\nend\n_p('')\n_p('RESOURCES := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.isresourcefile(file) then\n_p('\\t$(OBJDIR)/%s.res \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('al" + "premake.make.cpp = { }\npremake.make.override = { }\nlocal cpp = premake.make.cpp\nlocal make = premake.make\nfunction premake.make_cpp(prj)\nlocal cc = premake.gettool(prj)\nlocal platforms = premake.filterplatforms(prj.solution, cc.platforms, \"Native\")\npremake.gmake_cpp_header(prj, cc, platforms)\nfor _, platform in ipairs(platforms) do\nfor cfg in premake.eachconfig(prj, platform) do\npremake.gmake_cpp_config(prj, cfg, cc)\nend\nend\nlocal objdirs = {}\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\nobjdirs[_MAKE.esc(path.getdirectory(path.trimdots(file)))] = 1\nend\nend\n_p('OBJDIRS := \\\\')\n_p('\\t$(OBJDIR) \\\\')\nfor dir, _ in pairs(objdirs) do\n_p('\\t$(OBJDIR)/%s \\\\', dir)\nend\n_p('')\n_p('RESOURCES := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.isresourcefile(file) then\n_p('\\t$(OBJDIR)/%s.res \\\\', _MAKE.esc(path.getbasename(file)))\nend\nend\n_p('')\n_p('.PHONY: clean prebuild prelink')\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('al" "l: $(TARGETDIR) $(OBJDIRS) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')\nelse\n_p('all: $(TARGETDIR) $(OBJDIRS) prebuild prelink $(TARGET)')\nend\n_p('\\t@:')\n_p('')\nif (prj.kind == \"StaticLib\" and prj.options.ArchiveSplit) then\n_p('define max_args')\n_p('\\t$(eval _args:=)')\n_p('\\t$(foreach obj,$3,$(eval _args+=$(obj))$(if $(word $2,$(_args)),$1$(_args)$(EOL)$(eval _args:=)))')\n_p('\\t$(if $(_args),$1$(_args))')\n_p('endef')\n_p('')\n_p('define EOL')\n_p('')\n_p('')\n_p('endef')\n_p('')\nend\n_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')\nif prj.kind == \"StaticLib\" then\nif prj.msgarchiving then\n_p('\\t@echo ' .. prj.msgarchiving)\nelse\n_p('\\t@echo Archiving %s', prj.name)\nend\nif (not prj.archivesplit_size) then \nprj.archivesplit_size=200\nend\nif (not prj.options.ArchiveSplit) then\n_p('\\t$(SILENT) $(LINKCMD) $(OBJECTS)')\nelse\n_p('\\t@$(call max_args,$(LINKCMD),'.. prj.archivesplit_size ..',$(OBJECTS))')\nend\nelse\nif prj.msglinking the" "n\n_p('\\t@echo ' .. prj.msglinking)\nelse\n_p('\\t@echo Linking %s', prj.name)\nend\n_p('\\t$(SILENT) $(LINKCMD)')\nend\n_p('\\t$(POSTBUILDCMDS)')\n_p('')\n_p('$(TARGETDIR):')\npremake.make_mkdirrule(\"$(TARGETDIR)\")\n_p('$(OBJDIRS):')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCreatingMessage\")) then\n_p('\\t@echo Creating $(OBJDIR)')\nend\n_p('\\t-$(call MKDIR,$(OBJDIR))')\nfor dir, _ in pairs(objdirs) do\n_p('\\t-$(call MKDIR,$(OBJDIR)/%s)', dir)\nend\n_p('')\nif os.is(\"MacOSX\") and prj.kind == \"WindowedApp\" then\n_p('$(dir $(TARGETDIR))PkgInfo:')\n_p('$(dir $(TARGETDIR))Info.plist:')\n_p('')\nend\n_p('clean:')\nif (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \"SkipCleaningMessage\")) then\n_p('\\t@echo Cleaning %s', prj.name)\nend\n_p('ifeq (posix,$(SHELLTYPE))')\n_p('\\t$(SILENT) rm -f $(TARGET)')\n_p('\\t$(SILENT) rm -rf $(OBJDIR)')\n_p('else')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(TARGET)) del $(subst /," - "\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj)\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\nfor _, variable in ipairs(premake.make.undefine) do\n_p('override undefine '.. variable)\nend\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHEL" - "LTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = windres')\n_p(' endif')\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines)))\n_p(' INCLUDES +=%s', make.list(" - "cc.getincludedirs(cfg.includedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(cfg, cc)\n_p(' OBJECTS := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (exclude == file)\nif (excluded) then break end\nend\nif excluded == false then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", " - "\"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platform = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions, cfg.b" - "uildoptions_cpp)))\n_p(' ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p(' LINKCMD = libtool -o $(TARGET)')\nelse\nif cc.llvm then\n_p(' LINKCMD = $(AR) rcs $(TARGET)')\nelse\n_p(' LINKCMD = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX" - "\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppf" - "ile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif (path.isobjcfile(file) and prj.msgcompile_objc) then\n_p('\\t@echo ' .. prj.msgcompile_objc)\nelseif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nif (path.isobjcfile(file)) then\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCFLAGS) $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.o=%%.d) -c \"$<\"')\nelse\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\nend\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$" - "@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n", + "\\\\\\\\,$(TARGET))')\n_p('\\t$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj)\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -" + "p \"$(1)\"')\n_p(' COPY = $(SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = windres')\n_p(' endif')\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p(' ' .. (table.contains(premake.make.override,\"OBJDIR\") and \"override \" or \"\") .. 'OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' ' .. (table.contains(premake.make.override,\"TARGETDIR\") and \"override \" or \"\") .. 'TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' ' .. (table.contains(premake.make.override,\"TARGET\") and \"override \" or \"\") .. " + " 'TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines)))\n_p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(cfg, cc)\n_p(' OBJECTS := \\\\')\nfor _, file in ipairs(prj.files) do\nif path.iscppfile(file) then\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (exclude == file)\nif (excluded) then break end\nend\nif excluded == false then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' de" + "fine POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platform = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions" + ", cfg.buildoptions_c)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)))\n_p(' ALL_OBJCFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p(' LINKCMD = libtool -o $(TARGET)')\nelse\nif cc.llvm then" + "\n_p(' LINKCMD = $(AR) rcs $(TARGET)')\nelse\n_p(' LINKCMD = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o " + "\"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif (path.isobjcfile(file) and prj.msgcompile_objc) then\n_p('\\t@echo ' .. prj.msgcompile_objc)\nelseif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\nif (path.isobjcfile(file)) then\n_p('\\t$(SILENT) $(CXX) $(ALL_OBJCFLAGS) $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.o=%%.d) -c \"$<\"')\nelse\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\nend\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfu" + "nction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n", /* actions/make/make_csharp.lua */ "local function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\n local name = cfg.buildtarget.basename .. \".\"\n local dir = path.getdirectory(fname)\n if dir ~= \".\" then \nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.project.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Co" diff --git a/3rdparty/mongoose/mongoose.c b/3rdparty/mongoose/mongoose.c index f7f47cadadd..53908b63053 100644 --- a/3rdparty/mongoose/mongoose.c +++ b/3rdparty/mongoose/mongoose.c @@ -262,7 +262,7 @@ struct ns_connection *ns_bind(struct ns_mgr *, const char *, struct ns_connection *ns_connect(struct ns_mgr *, const char *, ns_callback_t, void *); -int ns_send(struct ns_connection *, const void *buf, int len); +int ns_send(struct ns_connection *, const void *buf, size_t len); int ns_printf(struct ns_connection *, const char *fmt, ...); int ns_vprintf(struct ns_connection *, const char *fmt, va_list ap); @@ -1017,14 +1017,14 @@ static void ns_write_to_socket(struct ns_connection *conn) { } } -int ns_send(struct ns_connection *conn, const void *buf, int len) { +int ns_send(struct ns_connection *conn, const void *buf, size_t len) { return (int) ns_out(conn, buf, len); } static void ns_handle_udp(struct ns_connection *ls) { struct ns_connection nc; char buf[NS_UDP_RECEIVE_BUFFER_SIZE]; - int n; + ssize_t n; socklen_t s_len = sizeof(nc.sa); memset(&nc, 0, sizeof(nc)); @@ -1381,7 +1381,7 @@ typedef pid_t process_id_t; struct vec { const char *ptr; - int len; + uintptr_t len; }; // For directory listing and WevDAV support @@ -1501,7 +1501,7 @@ struct connection { char *request; int64_t num_bytes_recv; // Total number of bytes received int64_t cl; // Reply content length, for Range support - int request_len; // Request length, including last \r\n after last header + ssize_t request_len; // Request length, including last \r\n after last header }; #define MG_CONN_2_CONN(c) ((struct connection *) ((char *) (c) - \ @@ -1743,7 +1743,7 @@ static int mg_snprintf(char *buf, size_t buflen, const char *fmt, ...) { // -1 if request is malformed // 0 if request is not yet fully buffered // >0 actual request length, including last \r\n\r\n -static int get_request_len(const char *s, int buf_len) { +static int get_request_len(const char *s, size_t buf_len) { const unsigned char *buf = (unsigned char *) s; int i; @@ -1785,7 +1785,7 @@ static char *skip(char **buf, const char *delimiters) { // Parse HTTP headers from the given buffer, advance buffer to the point // where parsing stopped. static void parse_http_headers(char **buf, struct mg_connection *ri) { - size_t i; + int i; for (i = 0; i < ARRAY_SIZE(ri->http_headers); i++) { ri->http_headers[i].name = skip(buf, ": "); @@ -2336,13 +2336,13 @@ static void on_cgi_data(struct ns_connection *nc) { // If reply has not been parsed yet, parse it if (conn->ns_conn->flags & NSF_BUFFER_BUT_DONT_SEND) { struct iobuf *io = &conn->ns_conn->send_iobuf; - int s_len = sizeof(cgi_status) - 1; - int len = get_request_len(io->buf + s_len, io->len - s_len); + size_t s_len = sizeof(cgi_status) - 1; + ssize_t len = get_request_len(io->buf + s_len, io->len - s_len); char buf[MAX_REQUEST_SIZE], *s = buf; if (len == 0) return; - if (len < 0 || len > (int) sizeof(buf)) { + if (len < 0 || len > sizeof(buf)) { len = io->len; iobuf_remove(io, io->len); send_http_error(conn, 500, "CGI program sent malformed headers: [%.*s]", @@ -2436,8 +2436,8 @@ static void remove_double_dots_and_double_slashes(char *s) { *p = '\0'; } -int mg_url_decode(const char *src, int src_len, char *dst, - int dst_len, int is_form_url_encoded) { +int mg_url_decode(const char *src, size_t src_len, char *dst, + size_t dst_len, int is_form_url_encoded) { int i, j, a, b; #define HEXTOI(x) (isdigit(x) ? x - '0' : x - 'W') @@ -2471,7 +2471,7 @@ static int is_valid_http_method(const char *s) { // This function modifies the buffer by NUL-terminating // HTTP request components, header names and header values. // Note that len must point to the last \n of HTTP headers. -static int parse_http_message(char *buf, int len, struct mg_connection *ri) { +static size_t parse_http_message(char *buf, size_t len, struct mg_connection *ri) { int is_request, n; // Reset the connection. Make sure that we don't touch fields that are @@ -2553,7 +2553,7 @@ const char *mg_get_header(const struct mg_connection *ri, const char *s) { } // Perform case-insensitive match of string against pattern -int mg_match_prefix(const char *pattern, int pattern_len, const char *str) { +int mg_match_prefix(const char *pattern, ssize_t pattern_len, const char *str) { const char *or_str; int len, res, i = 0, j = 0; @@ -2644,12 +2644,12 @@ static int convert_uri_to_file_name(struct connection *conn, char *buf, #endif const char *uri = conn->mg_conn.uri; const char *domain = mg_get_header(&conn->mg_conn, "Host"); - int match_len, root_len = root == NULL ? 0 : strlen(root); + size_t match_len, root_len = root == NULL ? 0 : strlen(root); // Perform virtual hosting rewrites if (rewrites != NULL && domain != NULL) { const char *colon = strchr(domain, ':'); - int domain_len = colon == NULL ? (int) strlen(domain) : colon - domain; + ssize_t domain_len = colon == NULL ? strlen(domain) : colon - domain; while ((rewrites = next_option(rewrites, &a, &b)) != NULL) { if (a.len > 1 && a.ptr[0] == '@' && a.len == domain_len + 1 && @@ -2709,7 +2709,7 @@ static int should_keep_alive(const struct mg_connection *conn) { (header == NULL && http_version && !strcmp(http_version, "1.1"))); } -size_t mg_write(struct mg_connection *c, const void *buf, int len) { +size_t mg_write(struct mg_connection *c, const void *buf, size_t len) { struct connection *conn = MG_CONN_2_CONN(c); ns_send(conn->ns_conn, buf, len); return conn->ns_conn->send_iobuf.len; @@ -2873,8 +2873,8 @@ static void SHA1Init(SHA1_CTX *context) { } static void SHA1Update(SHA1_CTX *context, const unsigned char *data, - uint32_t len) { - uint32_t i, j; + size_t len) { + size_t i, j; j = context->count[0]; if ((context->count[0] += len << 3) < j) @@ -2962,7 +2962,7 @@ static void send_websocket_handshake(struct mg_connection *conn, mg_write(conn, buf, strlen(buf)); } -static int deliver_websocket_frame(struct connection *conn) { +static size_t deliver_websocket_frame(struct connection *conn) { // Having buf unsigned char * is important, as it is used below in arithmetic unsigned char *buf = (unsigned char *) conn->ns_conn->recv_iobuf.buf; size_t i, len, buf_len = conn->ns_conn->recv_iobuf.len, frame_len = 0, @@ -3241,7 +3241,8 @@ static int find_index_file(struct connection *conn, char *path, const char *list = conn->server->config_options[INDEX_FILES]; file_stat_t st; struct vec filename_vec; - size_t n = strlen(path), found = 0; + size_t n = strlen(path); + int found = 0; // The 'path' given to us points to the directory. Remove all trailing // directory separator characters from the end of the path, and @@ -3499,7 +3500,7 @@ static int scan_directory(struct connection *conn, const char *dir, return arr_ind; } -int mg_url_encode(const char *src, size_t s_len, char *dst, size_t dst_len) { +size_t mg_url_encode(const char *src, size_t s_len, char *dst, size_t dst_len) { static const char *dont_escape = "._-$,;~()"; static const char *hex = "0123456789abcdef"; size_t i = 0, j = 0; @@ -3796,7 +3797,7 @@ static void handle_put(struct connection *conn, const char *path) { static void forward_put_data(struct connection *conn) { struct iobuf *io = &conn->ns_conn->recv_iobuf; size_t k = conn->cl < (int64_t) io->len ? conn->cl : (int64_t) io->len; // To write - int n = write(conn->endpoint.fd, io->buf, k); // Write them! + size_t n = write(conn->endpoint.fd, io->buf, k); // Write them! if (n > 0) { iobuf_remove(io, n); conn->cl -= n; @@ -4183,9 +4184,10 @@ static int is_dav_request(const struct connection *conn) { } #endif // MONGOOSE_NO_AUTH -static int parse_header(const char *str, int str_len, const char *var_name, +static int parse_header(const char *str, size_t str_len, const char *var_name, char *buf, size_t buf_size) { - int ch = ' ', ch1 = ',', len = 0, n = strlen(var_name); + int ch = ' ', ch1 = ',', len = 0; + size_t n = strlen(var_name); const char *p, *end = str + str_len, *s = NULL; if (buf != NULL && buf_size > 0) buf[0] = '\0'; @@ -4226,7 +4228,7 @@ static void send_ssi_file(struct mg_connection *, const char *, FILE *, int); static void send_file_data(struct mg_connection *conn, FILE *fp) { char buf[IOBUF_SIZE]; - int n; + size_t n; while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) { mg_write(conn, buf, n); } @@ -4898,7 +4900,7 @@ static void close_local_endpoint(struct connection *conn) { static void transfer_file_data(struct connection *conn) { char buf[IOBUF_SIZE]; - int n; + size_t n; // If output buffer is too big, don't send anything. Wait until // mongoose drains already buffered data to the client. @@ -4919,7 +4921,7 @@ static void transfer_file_data(struct connection *conn) { } } -int mg_poll_server(struct mg_server *server, int milliseconds) { +time_t mg_poll_server(struct mg_server *server, int milliseconds) { return ns_mgr_poll(&server->ns_mgr, milliseconds); } diff --git a/3rdparty/mongoose/mongoose.h b/3rdparty/mongoose/mongoose.h index cfe411e3e4e..064adea3757 100644 --- a/3rdparty/mongoose/mongoose.h +++ b/3rdparty/mongoose/mongoose.h @@ -88,7 +88,7 @@ enum { struct mg_server *mg_create_server(void *server_param, mg_handler_t handler); void mg_destroy_server(struct mg_server **); const char *mg_set_option(struct mg_server *, const char *opt, const char *val); -int mg_poll_server(struct mg_server *, int milliseconds); +time_t mg_poll_server(struct mg_server *, int milliseconds); const char **mg_get_valid_option_names(void); const char *mg_get_option(const struct mg_server *server, const char *name); void mg_copy_listeners(struct mg_server *from, struct mg_server *to); @@ -102,7 +102,7 @@ void mg_send_status(struct mg_connection *, int status_code); void mg_send_header(struct mg_connection *, const char *name, const char *val); size_t mg_send_data(struct mg_connection *, const void *data, int data_len); size_t mg_printf_data(struct mg_connection *, const char *format, ...); -size_t mg_write(struct mg_connection *, const void *buf, int len); +size_t mg_write(struct mg_connection *, const void *buf, size_t len); size_t mg_printf(struct mg_connection *conn, const char *fmt, ...); size_t mg_websocket_write(struct mg_connection *, int opcode, @@ -128,8 +128,8 @@ int mg_parse_multipart(const char *buf, int buf_len, void *mg_start_thread(void *(*func)(void *), void *param); char *mg_md5(char buf[33], ...); int mg_authorize_digest(struct mg_connection *c, FILE *fp); -int mg_url_encode(const char *src, size_t s_len, char *dst, size_t dst_len); -int mg_url_decode(const char *src, int src_len, char *dst, int dst_len, int); +size_t mg_url_encode(const char *src, size_t s_len, char *dst, size_t dst_len); +int mg_url_decode(const char *src, size_t src_len, char *dst, size_t dst_len, int); int mg_terminate_ssl(struct mg_connection *c, const char *cert); int mg_forward(struct mg_connection *c, const char *addr); void *mg_mmap(FILE *fp, size_t size); |