Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion nvdaHelper/archBuild_sconscript
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ env.Append(
('_WIN32_WINNT','_WIN32_WINNT_WIN7')
]
)
env.Append(CCFLAGS=['/W3','/WX'])
env.Append(CCFLAGS=[
'/W3',
'/WX',
'/std:c++17'
])
if 'analyze' in debug:
env.Append(CCFLAGS=['/analyze'])
# Disable: Inconsistent annotation for 'x': this instance has no annotations.
Expand Down
2 changes: 1 addition & 1 deletion nvdaHelper/localWin10/oneCoreSpeech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void __stdcall ocSpeech_speak(OcSpeech* instance, char16 *text) {
}).then([instance, markersStr] (IBuffer^ buffer) {
// Data has been read from the speech stream.
// Pass it to the callback.
byte* bytes = getBytes(buffer);
BYTE* bytes = getBytes(buffer);
instance->callback(bytes, buffer->Length, markersStr->c_str());
}).then([instance] (task<void> previous) {
// Catch any unhandled exceptions that occurred during these tasks.
Expand Down
13 changes: 10 additions & 3 deletions nvdaHelper/remote/COMProxyRegistration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ This license can be found at:
#include <cwchar>
#include <string>
#include <locale>
#include <codecvt>
#include <vector>
#define WIN32_LEAN_AND_MEAN
#define CINTERFACE
Expand Down Expand Up @@ -140,8 +139,16 @@ COMProxyRegistration_t* registerCOMProxy(wchar_t* dllPath) {
for(unsigned short idx=0;idx<fileInfo.TableSize;++idx) {
IID iid=*(fileInfo.pStubVtblList[idx]->header.piid);
CLSID clsidBackup={0};
wstring_convert<codecvt_utf8_utf16<wchar_t>> converter;
wstring name=converter.from_bytes(fileInfo.pNamesArray[idx]);
int nameLength=MultiByteToWideChar(CP_UTF8,0, fileInfo.pNamesArray[idx],-1,NULL,0);
Comment thread
feerrenrut marked this conversation as resolved.
Resolved
if (nameLength == 0) {
LOG_ERROR(L"Unable to get name length for MultiByteToWideChar conversion for entry "<<idx<<L" in ProxyFileInfo, error "<<GetLastError());
continue;
}
wstring name(nameLength,L'\0');
if (MultiByteToWideChar(CP_UTF8,0, fileInfo.pNamesArray[idx],-1,name.data(),nameLength) == 0) {
Comment thread
feerrenrut marked this conversation as resolved.
Resolved
LOG_ERROR(L"Unable to perform MultiByteToWideChar conversion for entry "<<idx<<L" in ProxyFileInfo, error "<<GetLastError());
continue;
}
// Fetch the old CLSID for this interface if one is set, so we can replace it on deregistration.
// If not set, then we'll use the standard marshaler clsid on deregistration.
res=CoGetPSClsid(iid,&clsidBackup);
Expand Down
4 changes: 2 additions & 2 deletions nvdaHelper/remote/WinWord/Fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ bool Fields::hasLinks(){
}


std::experimental::optional<int> Fields::getEndOfPageNumberFieldAtIndex(const int index){
std::optional<int> Fields::getEndOfPageNumberFieldAtIndex(const int index){
for( auto&& pageNum : m_pageNumbers ){
if(inRange(index, pageNum.first, pageNum.second)){
return pageNum.second;
}
}
return std::experimental::optional<int>();
return std::optional<int>();
}

} // end namespace WinWord
4 changes: 2 additions & 2 deletions nvdaHelper/remote/WinWord/Fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This license can be found at:

#define WIN32_LEAN_AND_MEAN
#include <vector>
#include <boost/optional.hpp>
#include <optional>

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

Fields(const Fields&) = delete; // Copy constructor disabled, no implementation.
Fields& operator=(const Fields&) = delete; // Assignment disabled, no implementation.
Expand Down
12 changes: 6 additions & 6 deletions nvdaHelper/remote/winword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This license can be found at:
#include <oleacc.h>
#include <common/xml.h>
#include <common/log.h>
#include <boost/optional.hpp>
#include <optional>
#include "nvdaHelperRemote.h"
#include "nvdaInProcUtils.h"
#include "nvdaInProcUtils.h"
Expand Down Expand Up @@ -751,7 +751,7 @@ inline bool generateFootnoteEndnoteXML(IDispatch* pDispatchRange, wostringstream
return true;
}

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

std::experimental::optional<float>
std::optional<float>
getStartOfRangeDistanceFromEdgeOfDocument(IDispatchPtr pDispatchRange) {
float rangePos = -1.0f;
auto res = _com_dispatch_raw_method( pDispatchRange, wdDISPID_RANGE_INFORMATION,
Expand All @@ -831,7 +831,7 @@ getStartOfRangeDistanceFromEdgeOfDocument(IDispatchPtr pDispatchRange) {
return rangePos;
}

std::experimental::optional< std::pair<float, float> >
std::optional< std::pair<float, float> >
calculatePreAndPostColumnOffsets(IDispatchPtr pDispatchPageSetup) {
float leftMargin = -1.0f;
auto res = _com_dispatch_raw_propget( pDispatchPageSetup, wdDISPID_PAGESETUP_LEFTMARGIN,
Expand Down Expand Up @@ -1182,8 +1182,8 @@ void winword_getTextInRange_helper(HWND hwnd, winword_getTextInRange_args* args)
if(text) {
int noteCharOffset=-1;
bool isNoteChar=false;
std::experimental::optional<int> pageBreakCharIndex;
std::experimental::optional<int> columnBreakCharIndex;
std::optional<int> pageBreakCharIndex;
std::optional<int> columnBreakCharIndex;
if(!isFormField) {
//Force a new chunk before and after control+b (note characters)
for(int i=0;text[i]!=L'\0';++i) {
Expand Down
14 changes: 7 additions & 7 deletions nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This license can be found at:
#include <functional>
#include <vector>
#include <map>
#include <boost/optional.hpp>
#include <optional>
#include <windows.h>
#include <set>
#include <string>
Expand Down Expand Up @@ -287,24 +287,24 @@ void GeckoVBufBackend_t::versionSpecificInit(IAccessible2* pacc) {
SysFreeString(toolkitVersion);
}

experimental::optional<int>
optional<int>
getIAccessible2UniqueID(IAccessible2* targetAcc) {
int ID = 0;
//Get ID -- IAccessible2 uniqueID
if (targetAcc->get_uniqueID((long*)&ID) != S_OK) {
LOG_DEBUG(L"pacc->get_uniqueID failed");
return experimental::optional<int>();
return optional<int>();
}
return ID;
}

class LabelInfo {
public:
bool isVisible;
std::experimental::optional<int> ID;
optional<int> ID;
};

using OptionalLabelInfo = std::experimental::optional< LabelInfo >;
using OptionalLabelInfo = optional< LabelInfo >;
OptionalLabelInfo GeckoVBufBackend_t::getLabelInfo(IAccessible2* pacc2) {
CComQIPtr<IAccessible2_2> pacc2_2=pacc2;
if (!pacc2_2) return OptionalLabelInfo();
Expand Down Expand Up @@ -657,7 +657,7 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
// Whether the name of this node has been explicitly set (as opposed to calculated by descendant)
const bool nameIsExplicit = IA2AttribsMapIt != IA2AttribsMap.end() && IA2AttribsMapIt->second == L"true";
// Whether the name is the content of this node.
std::experimental::optional<LabelInfo> labelInfo_;
optional<LabelInfo> labelInfo_;
// A version of the getIdForVisibleLabel function that caches its result
auto isLabelVisibleCached = [&]() {
if (!labelInfo_) {
Expand All @@ -673,7 +673,7 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
if (!labelInfo_) {
labelInfo_ = getLabelInfo(pacc);
}
experimental::optional<int> id;
optional<int> id;
if (labelInfo_) {
id = labelInfo_->ID;
}
Expand Down
4 changes: 2 additions & 2 deletions nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This license can be found at:
#define VIRTUALBUFFER_BACKENDS_EXAMPLE_H

#include <vbufBase/backend.h>
#include <boost/optional.hpp>
#include <optional>

class LabelInfo;

Expand All @@ -42,7 +42,7 @@ class GeckoVBufBackend_t: public VBufBackend_t {
bool hasEncodedAccDescription;
std::wstring toolkitName;

std::experimental::optional< LabelInfo > getLabelInfo(IAccessible2* pacc2);
std::optional< LabelInfo > getLabelInfo(IAccessible2* pacc2);
CComPtr<IAccessible2> getLabelElement(IAccessible2_2* element);
CComPtr<IAccessible2> getSelectedItem(IAccessible2* container,
const std::map<std::wstring, std::wstring>& attribs);
Expand Down