diff options
Diffstat (limited to 'issue396.patch')
-rw-r--r-- | issue396.patch | 294 |
1 files changed, 294 insertions, 0 deletions
diff --git a/issue396.patch b/issue396.patch new file mode 100644 index 000000000000..c31fa1489ebd --- /dev/null +++ b/issue396.patch @@ -0,0 +1,294 @@ +diff --git a/src/ipe/appui_qt.cpp b/src/ipe/appui_qt.cpp +index 3ffe128..4cb0674 100644 +--- a/src/ipe/appui_qt.cpp ++++ b/src/ipe/appui_qt.cpp +@@ -894,7 +894,7 @@ static const char * const aboutText = + void AppUi::aboutIpe() + { + std::vector<char> buf(strlen(aboutText) + 100); +- sprintf(&buf[0], aboutText, ++ sprintf(buf.data(), aboutText, + IPELIB_VERSION / 10000, + (IPELIB_VERSION / 100) % 100, + IPELIB_VERSION % 100, +@@ -903,7 +903,7 @@ void AppUi::aboutIpe() + QMessageBox msgBox(this); + msgBox.setWindowTitle("About Ipe"); + msgBox.setWindowIcon(prefsIcon("ipe")); +- msgBox.setInformativeText(&buf[0]); ++ msgBox.setInformativeText(buf.data()); + msgBox.setIconPixmap(prefsPixmap("ipe")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); +diff --git a/src/ipe/appui_win.cpp b/src/ipe/appui_win.cpp +index 4ddc912..41aa2ed 100644 +--- a/src/ipe/appui_win.cpp ++++ b/src/ipe/appui_win.cpp +@@ -1334,13 +1334,13 @@ static const char * const aboutText = + void AppUi::aboutIpe() + { + std::vector<char> buf(strlen(aboutText) + 100); +- sprintf(&buf[0], aboutText, ++ sprintf(buf.data(), aboutText, + IPELIB_VERSION / 10000, + (IPELIB_VERSION / 100) % 100, + IPELIB_VERSION % 100, + COPYRIGHT_YEAR); + +- WString wbuf(&buf[0]); ++ WString wbuf(buf.data()); + MessageBoxW(hwnd, wbuf.data(), L"About Ipe", + MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); + } +diff --git a/src/ipe/main_win.cpp b/src/ipe/main_win.cpp +index 36eb58e..f32161f 100644 +--- a/src/ipe/main_win.cpp ++++ b/src/ipe/main_win.cpp +@@ -98,7 +98,7 @@ static HACCEL makeAccel(lua_State *L, int arg) + lua_pop(L, 2); + } + +- HACCEL hAccel = CreateAcceleratorTable(&accel[0], accel.size()); ++ HACCEL hAccel = CreateAcceleratorTable(accel.data(), accel.size()); + return hAccel; + } + +diff --git a/src/ipe/pagesorter_win.cpp b/src/ipe/pagesorter_win.cpp +index 74c2d68..05af4a0 100644 +--- a/src/ipe/pagesorter_win.cpp ++++ b/src/ipe/pagesorter_win.cpp +@@ -360,7 +360,7 @@ int AppUi::pageSorter(lua_State *L, Document *doc, int pno, + + + int res = +- DialogBoxIndirectParamW(nullptr, (LPCDLGTEMPLATE) &t[0], ++ DialogBoxIndirectParamW(nullptr, (LPCDLGTEMPLATE) t.data(), + nullptr, dialogProc, (LPARAM) &sData); + + if (res == 1) { +diff --git a/src/ipecairo/ipecairopainter.cpp b/src/ipecairo/ipecairopainter.cpp +index 9b913e3..f029575 100644 +--- a/src/ipecairo/ipecairopainter.cpp ++++ b/src/ipecairo/ipecairopainter.cpp +@@ -547,7 +547,7 @@ void CairoPainter::doDrawPath(TPathMode mode) + std::vector<double> dashes; + double offset; + dashStyle(dashes, offset); +- cairo_set_dash(iCairo, &dashes[0], dashes.size(), offset); ++ cairo_set_dash(iCairo, dashes.data(), dashes.size(), offset); + } + cairo_stroke(iCairo); + } +@@ -936,7 +936,7 @@ void CairoPainter::opd() + dashes.emplace_back(obj->number()->value()); + } + double offset = iArgs[1]->number()->value(); +- cairo_set_dash(iCairo, &dashes[0], dashes.size(), offset); ++ cairo_set_dash(iCairo, dashes.data(), dashes.size(), offset); + } + + void CairoPainter::opi() +@@ -1420,7 +1420,7 @@ void CairoPainter::drawGlyphs(std::vector<cairo_glyph_t> &glyphs) + 0.5); + cairo_save(iCairo); + cairo_set_font_matrix(iCairo, &matrix); +- cairo_show_glyphs(iCairo, &glyphs[0], glyphs.size()); ++ cairo_show_glyphs(iCairo, glyphs.data(), glyphs.size()); + cairo_restore(iCairo); + double s = ps.iFontSize; + cairo_set_font_size(iCairo, 0.23 * s); +@@ -1442,7 +1442,7 @@ void CairoPainter::drawGlyphs(std::vector<cairo_glyph_t> &glyphs) + cairo_set_source_rgba(iCairo, + ps.iFillRgb[0], ps.iFillRgb[1], ps.iFillRgb[2], + ps.iFillOpacity); +- cairo_show_glyphs(iCairo, &glyphs[0], glyphs.size()); ++ cairo_show_glyphs(iCairo, glyphs.data(), glyphs.size()); + cairo_restore(iCairo); + } + } +diff --git a/src/ipecanvas/ipeselector_win.cpp b/src/ipecanvas/ipeselector_win.cpp +index af3b9d7..d09781d 100644 +--- a/src/ipecanvas/ipeselector_win.cpp ++++ b/src/ipecanvas/ipeselector_win.cpp +@@ -145,7 +145,7 @@ int showPageSelectDialog(int width, int height, const char * title, + t.push_back(0); + t.push_back(0); + +- int res = DialogBoxIndirectParamW(nullptr, (LPCDLGTEMPLATE) &t[0], ++ int res = DialogBoxIndirectParamW(nullptr, (LPCDLGTEMPLATE) t.data(), + nullptr, dialogProc, (LPARAM) &sData); + return res; + } +diff --git a/src/ipelib/ipeplatform.cpp b/src/ipelib/ipeplatform.cpp +index 1639831..4a9ec31 100755 +--- a/src/ipelib/ipeplatform.cpp ++++ b/src/ipelib/ipeplatform.cpp +@@ -616,7 +616,7 @@ std::wstring String::w() const noexcept + return L"\0"; + int rw = MultiByteToWideChar(CP_UTF8, 0, data(), size(), nullptr, 0); + std::wstring result(rw + 1, wchar_t(0)); +- MultiByteToWideChar(CP_UTF8, 0, data(), size(), &result[0], rw); ++ MultiByteToWideChar(CP_UTF8, 0, data(), size(), result.data(), rw); + return result; + } + +diff --git a/src/ipelua/ipelib.cpp b/src/ipelua/ipelib.cpp +index 8c2226b..a2a3879 100644 +--- a/src/ipelua/ipelib.cpp ++++ b/src/ipelua/ipelib.cpp +@@ -517,7 +517,7 @@ static int ipe_splinetobeziers(lua_State *L) + bool closed = lua_toboolean(L, 2); + std::vector<Bezier> result; + if (closed) { +- Bezier::closedSpline(v.size(), &v[0], result); ++ Bezier::closedSpline(v.size(), v.data(), result); + } else { + // get spline type + lua_getfield(L, 1, "type"); +@@ -529,21 +529,21 @@ static int ipe_splinetobeziers(lua_State *L) + lua_pop(L, 1); // pop type + switch (type) { + case CurveSegment::ESpline: +- Bezier::spline(v.size(), &v[0], result); ++ Bezier::spline(v.size(), v.data(), result); + break; + case CurveSegment::EOldSpline: +- Bezier::oldSpline(v.size(), &v[0], result); ++ Bezier::oldSpline(v.size(), v.data(), result); + break; + case CurveSegment::ECardinalSpline: { + lua_getfield(L, 1, "tension"); + if (!lua_isnumber(L, -1)) + luaL_error(L, "spline has no tension"); + float tension = lua_tonumberx(L, -1, nullptr); +- Bezier::cardinalSpline(v.size(), &v[0], tension, result); ++ Bezier::cardinalSpline(v.size(), v.data(), tension, result); + lua_pop(L, 1); // tension + break; } + case CurveSegment::ESpiroSpline: +- Bezier::spiroSpline(v.size(), &v[0], result); ++ Bezier::spiroSpline(v.size(), v.data(), result); + break; + default: + break; +diff --git a/src/ipepresenter/ipepresenter_qt.cpp b/src/ipepresenter/ipepresenter_qt.cpp +index b7551aa..9ed4bb1 100644 +--- a/src/ipepresenter/ipepresenter_qt.cpp ++++ b/src/ipepresenter/ipepresenter_qt.cpp +@@ -406,14 +406,14 @@ static const char * const aboutText = + void MainWindow::aboutIpePresenter() + { + std::vector<char> buf(strlen(aboutText) + 100); +- sprintf(&buf[0], aboutText, ++ sprintf(buf.data(), aboutText, + IPELIB_VERSION / 10000, + (IPELIB_VERSION / 100) % 100, + IPELIB_VERSION % 100); + + QMessageBox msgBox(this); + msgBox.setWindowTitle("About IpePresenter"); +- msgBox.setInformativeText(&buf[0]); ++ msgBox.setInformativeText(buf.data()); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + } +diff --git a/src/ipepresenter/ipepresenter_win.cpp b/src/ipepresenter/ipepresenter_win.cpp +index 7ce1475..fe984f6 100644 +--- a/src/ipepresenter/ipepresenter_win.cpp ++++ b/src/ipepresenter/ipepresenter_win.cpp +@@ -27,7 +27,7 @@ BOOL setWindowText(HWND h, const char *s) + { + int rw = MultiByteToWideChar(CP_UTF8, 0, s, -1, nullptr, 0); + std::vector<wchar_t> ws(rw); +- MultiByteToWideChar(CP_UTF8, 0, s, -1, &ws[0], rw); ++ MultiByteToWideChar(CP_UTF8, 0, s, -1, ws.data(), rw); + std::vector<wchar_t> w; + for (auto ch : ws) { + if (ch != '\r') { +@@ -37,7 +37,7 @@ BOOL setWindowText(HWND h, const char *s) + } + } + w.push_back(0); +- return SetWindowTextW(h, &w[0]); ++ return SetWindowTextW(h, w.data()); + } + + // -------------------------------------------------------------------- +@@ -520,7 +520,7 @@ static const char * const aboutText = + void AppUi::aboutIpePresenter() + { + std::vector<char> buf(strlen(aboutText) + 100); +- sprintf(&buf[0], aboutText, ++ sprintf(buf.data(), aboutText, + IPELIB_VERSION / 10000, + (IPELIB_VERSION / 100) % 100, + IPELIB_VERSION % 100); +diff --git a/src/ipeui/ipeui_win.cpp b/src/ipeui/ipeui_win.cpp +index 5134dfd..2d3996b 100644 +--- a/src/ipeui/ipeui_win.cpp ++++ b/src/ipeui/ipeui_win.cpp +@@ -38,7 +38,7 @@ BOOL setWindowText(HWND h, const char *s) + } + } + w.push_back(0); +- return SetWindowTextW(h, &w[0]); ++ return SetWindowTextW(h, w.data()); + } + + void sendMessage(HWND h, UINT code, const char *t, WPARAM wParam) +@@ -51,8 +51,8 @@ static std::string wideToUtf8(const wchar_t *wbuf) + { + int rm = WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, nullptr, 0, nullptr, nullptr); + std::vector<char> multi(rm); +- WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, &multi[0], rm, nullptr, nullptr); +- return std::string(&multi[0]); ++ WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, multi.data(), rm, nullptr, nullptr); ++ return std::string(multi.data()); + } + + static void buildFlags(std::vector<short> &t, DWORD flags) +@@ -249,7 +249,7 @@ static std::string getEditText(HWND h) + w.push_back(ch); + } + w.push_back(0); +- return wideToUtf8(&w[0]); ++ return wideToUtf8(w.data()); + } + + void PDialog::retrieveValues() +@@ -509,7 +509,7 @@ bool PDialog::buildAndRun(int w, int h) + int res = + DialogBoxIndirectParamW((HINSTANCE) GetWindowLongPtr(iParent, + GWLP_HINSTANCE), +- (LPCDLGTEMPLATE) &t[0], ++ (LPCDLGTEMPLATE) t.data(), + iParent, (DLGPROC) dialogProc, (LPARAM) this); + // retrieveValues() has been called before EndDialog! + hDialog = nullptr; // already destroyed by Windows +@@ -1014,7 +1014,7 @@ static int ipeui_fileDialog(lua_State *L) + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = hwnd; + +- ofn.lpstrFilter = &filters[0]; ++ ofn.lpstrFilter = filters.data(); + ofn.nFilterIndex = selected; + + ofn.lpstrFile = szFileName; +@@ -1242,7 +1242,7 @@ static int ipeui_wait(lua_State *L) + INFINITE, WT_EXECUTEINWAITTHREAD|WT_EXECUTEONLYONCE); + + DialogBoxIndirectParamW((HINSTANCE) GetWindowLongPtr(parent, GWLP_HINSTANCE), +- (LPCDLGTEMPLATE) &t[0], ++ (LPCDLGTEMPLATE) t.data(), + parent, (DLGPROC) waitDialogProc, + (LPARAM) &dialogHandle); + +@@ -1263,7 +1263,7 @@ static int ipeui_wait(lua_State *L) + lua_pushvalue(L, 2); + + DialogBoxIndirectParamW((HINSTANCE) GetWindowLongPtr(parent, GWLP_HINSTANCE), +- (LPCDLGTEMPLATE) &t[0], ++ (LPCDLGTEMPLATE) t.data(), + parent, (DLGPROC) waitDialogProc, + (LPARAM) &dialogHandle); + UnregisterWait(waitHandle); |