Skip to content

Commit 61ccb81

Browse files
authored
Merge 10a18cd into 669ae5a
2 parents 669ae5a + 10a18cd commit 61ccb81

File tree

8 files changed

+31
-24
lines changed

8 files changed

+31
-24
lines changed

nvdaHelper/archBuild_sconscript

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ env.Append(
9292
('_WIN32_WINNT','_WIN32_WINNT_WIN7')
9393
]
9494
)
95-
env.Append(CCFLAGS=['/W3','/WX'])
95+
env.Append(CCFLAGS=[
96+
'/W3',
97+
'/WX',
98+
'/std:c++17'
99+
])
96100
if 'analyze' in debug:
97101
env.Append(CCFLAGS=['/analyze'])
98102
# Disable: Inconsistent annotation for 'x': this instance has no annotations.

nvdaHelper/localWin10/oneCoreSpeech.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void __stdcall ocSpeech_speak(OcSpeech* instance, char16 *text) {
8888
}).then([instance, markersStr] (IBuffer^ buffer) {
8989
// Data has been read from the speech stream.
9090
// Pass it to the callback.
91-
byte* bytes = getBytes(buffer);
91+
BYTE* bytes = getBytes(buffer);
9292
instance->callback(bytes, buffer->Length, markersStr->c_str());
9393
}).then([instance] (task<void> previous) {
9494
// Catch any unhandled exceptions that occurred during these tasks.

nvdaHelper/remote/COMProxyRegistration.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ This license can be found at:
1616
#include <cwchar>
1717
#include <string>
1818
#include <locale>
19-
#include <codecvt>
2019
#include <vector>
2120
#define WIN32_LEAN_AND_MEAN
2221
#define CINTERFACE
@@ -140,8 +139,12 @@ COMProxyRegistration_t* registerCOMProxy(wchar_t* dllPath) {
140139
for(unsigned short idx=0;idx<fileInfo.TableSize;++idx) {
141140
IID iid=*(fileInfo.pStubVtblList[idx]->header.piid);
142141
CLSID clsidBackup={0};
143-
wstring_convert<codecvt_utf8_utf16<wchar_t>> converter;
144-
wstring name=converter.from_bytes(fileInfo.pNamesArray[idx]);
142+
int nameLength=MultiByteToWideChar(CP_UTF8,0, fileInfo.pNamesArray[idx],-1,NULL,0);
143+
wstring name;
144+
if (MultiByteToWideChar(CP_UTF8,0, fileInfo.pNamesArray[idx],-1,name.data(),nameLength) == 0) {
145+
LOG_ERROR(L"Unable to perform MultiByteToWideChar conversion for entry "<<idx<<L" in ProxyFileInfo, error "<<GetLastError());
146+
continue;
147+
}
145148
// Fetch the old CLSID for this interface if one is set, so we can replace it on deregistration.
146149
// If not set, then we'll use the standard marshaler clsid on deregistration.
147150
res=CoGetPSClsid(iid,&clsidBackup);

nvdaHelper/remote/WinWord/Fields.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ bool Fields::hasLinks(){
123123
}
124124

125125

126-
std::experimental::optional<int> Fields::getEndOfPageNumberFieldAtIndex(const int index){
126+
std::optional<int> Fields::getEndOfPageNumberFieldAtIndex(const int index){
127127
for( auto&& pageNum : m_pageNumbers ){
128128
if(inRange(index, pageNum.first, pageNum.second)){
129129
return pageNum.second;
130130
}
131131
}
132-
return std::experimental::optional<int>();
132+
return std::optional<int>();
133133
}
134134

135135
} // end namespace WinWord

nvdaHelper/remote/WinWord/Fields.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This license can be found at:
1616

1717
#define WIN32_LEAN_AND_MEAN
1818
#include <vector>
19-
#include <boost/optional.hpp>
19+
#include <optional>
2020

2121
struct IDispatch;
2222
namespace WinWord {
@@ -49,7 +49,7 @@ namespace WinWord {
4949
* @param index Find a range that this index is part of.
5050
* @returns an optional value, if a range exists the end index is returned of visible text range.
5151
*/
52-
std::experimental::optional<int> getEndOfPageNumberFieldAtIndex(const int index);
52+
std::optional<int> getEndOfPageNumberFieldAtIndex(const int index);
5353

5454
Fields(const Fields&) = delete; // Copy constructor disabled, no implementation.
5555
Fields& operator=(const Fields&) = delete; // Assignment disabled, no implementation.

nvdaHelper/remote/winword.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This license can be found at:
2121
#include <oleacc.h>
2222
#include <common/xml.h>
2323
#include <common/log.h>
24-
#include <boost/optional.hpp>
24+
#include <optional>
2525
#include "nvdaHelperRemote.h"
2626
#include "nvdaInProcUtils.h"
2727
#include "nvdaInProcUtils.h"
@@ -751,7 +751,7 @@ inline bool generateFootnoteEndnoteXML(IDispatch* pDispatchRange, wostringstream
751751
return true;
752752
}
753753

754-
std::experimental::optional<int> getSectionBreakType(IDispatchPtr pDispatchRange ) {
754+
std::optional<int> getSectionBreakType(IDispatchPtr pDispatchRange ) {
755755
// The following case should handle where we have the page break character ('0x0c') shown with '|p|'
756756
// first section|p|
757757
// second section.
@@ -817,7 +817,7 @@ std::experimental::optional<int> getSectionBreakType(IDispatchPtr pDispatchRange
817817
return type;
818818
}
819819

820-
std::experimental::optional<float>
820+
std::optional<float>
821821
getStartOfRangeDistanceFromEdgeOfDocument(IDispatchPtr pDispatchRange) {
822822
float rangePos = -1.0f;
823823
auto res = _com_dispatch_raw_method( pDispatchRange, wdDISPID_RANGE_INFORMATION,
@@ -831,7 +831,7 @@ getStartOfRangeDistanceFromEdgeOfDocument(IDispatchPtr pDispatchRange) {
831831
return rangePos;
832832
}
833833

834-
std::experimental::optional< std::pair<float, float> >
834+
std::optional< std::pair<float, float> >
835835
calculatePreAndPostColumnOffsets(IDispatchPtr pDispatchPageSetup) {
836836
float leftMargin = -1.0f;
837837
auto res = _com_dispatch_raw_propget( pDispatchPageSetup, wdDISPID_PAGESETUP_LEFTMARGIN,
@@ -1182,8 +1182,8 @@ void winword_getTextInRange_helper(HWND hwnd, winword_getTextInRange_args* args)
11821182
if(text) {
11831183
int noteCharOffset=-1;
11841184
bool isNoteChar=false;
1185-
std::experimental::optional<int> pageBreakCharIndex;
1186-
std::experimental::optional<int> columnBreakCharIndex;
1185+
std::optional<int> pageBreakCharIndex;
1186+
std::optional<int> columnBreakCharIndex;
11871187
if(!isFormField) {
11881188
//Force a new chunk before and after control+b (note characters)
11891189
for(int i=0;text[i]!=L'\0';++i) {

nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This license can be found at:
1616
#include <functional>
1717
#include <vector>
1818
#include <map>
19-
#include <boost/optional.hpp>
19+
#include <optional>
2020
#include <windows.h>
2121
#include <set>
2222
#include <string>
@@ -287,24 +287,24 @@ void GeckoVBufBackend_t::versionSpecificInit(IAccessible2* pacc) {
287287
SysFreeString(toolkitVersion);
288288
}
289289

290-
experimental::optional<int>
290+
optional<int>
291291
getIAccessible2UniqueID(IAccessible2* targetAcc) {
292292
int ID = 0;
293293
//Get ID -- IAccessible2 uniqueID
294294
if (targetAcc->get_uniqueID((long*)&ID) != S_OK) {
295295
LOG_DEBUG(L"pacc->get_uniqueID failed");
296-
return experimental::optional<int>();
296+
return optional<int>();
297297
}
298298
return ID;
299299
}
300300

301301
class LabelInfo {
302302
public:
303303
bool isVisible;
304-
std::experimental::optional<int> ID;
304+
optional<int> ID;
305305
};
306306

307-
using OptionalLabelInfo = std::experimental::optional< LabelInfo >;
307+
using OptionalLabelInfo = optional< LabelInfo >;
308308
OptionalLabelInfo GeckoVBufBackend_t::getLabelInfo(IAccessible2* pacc2) {
309309
CComQIPtr<IAccessible2_2> pacc2_2=pacc2;
310310
if (!pacc2_2) return OptionalLabelInfo();
@@ -657,7 +657,7 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
657657
// Whether the name of this node has been explicitly set (as opposed to calculated by descendant)
658658
const bool nameIsExplicit = IA2AttribsMapIt != IA2AttribsMap.end() && IA2AttribsMapIt->second == L"true";
659659
// Whether the name is the content of this node.
660-
std::experimental::optional<LabelInfo> labelInfo_;
660+
optional<LabelInfo> labelInfo_;
661661
// A version of the getIdForVisibleLabel function that caches its result
662662
auto isLabelVisibleCached = [&]() {
663663
if (!labelInfo_) {
@@ -673,7 +673,7 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
673673
if (!labelInfo_) {
674674
labelInfo_ = getLabelInfo(pacc);
675675
}
676-
experimental::optional<int> id;
676+
optional<int> id;
677677
if (labelInfo_) {
678678
id = labelInfo_->ID;
679679
}

nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This license can be found at:
1616
#define VIRTUALBUFFER_BACKENDS_EXAMPLE_H
1717

1818
#include <vbufBase/backend.h>
19-
#include <boost/optional.hpp>
19+
#include <optional>
2020

2121
class LabelInfo;
2222

@@ -42,7 +42,7 @@ class GeckoVBufBackend_t: public VBufBackend_t {
4242
bool hasEncodedAccDescription;
4343
std::wstring toolkitName;
4444

45-
std::experimental::optional< LabelInfo > getLabelInfo(IAccessible2* pacc2);
45+
std::optional< LabelInfo > getLabelInfo(IAccessible2* pacc2);
4646
CComPtr<IAccessible2> getLabelElement(IAccessible2_2* element);
4747
CComPtr<IAccessible2> getSelectedItem(IAccessible2* container,
4848
const std::map<std::wstring, std::wstring>& attribs);

0 commit comments

Comments
 (0)