Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions engine/src/execpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,3 +981,27 @@ bool MCExecPoint::copyasnameref(MCNameRef& r_name)
{
return MCNameCreateWithOldString(getsvalue(), r_name);
}

// Assumes the contents of the ep is UTF-16 and attempts conversion to native. If
// successful, the new contents is native and the method returns true, otherwise
// false and the contents remains unchanged.
bool MCExecPoint::trytoconvertutf16tonative()
{
// if empty then it can be native obviously but this also avoids getsvalue returning nil
if (isempty())
return true;

MCExecPoint t_other_ep;
t_other_ep . setsvalue(getsvalue());
t_other_ep . utf16tonative();
t_other_ep . nativetoutf16();

if (getsvalue() . getlength() == t_other_ep . getsvalue() . getlength()
&& memcmp(getsvalue() . getstring(), t_other_ep . getsvalue() . getstring(), getsvalue() . getlength()) == 0)
{
copysvalue(t_other_ep . getsvalue(). getstring(), t_other_ep . getsvalue(). getlength());
return true;
}
return false;
}

2 changes: 2 additions & 0 deletions engine/src/execpt.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ class MCExecPoint
void concatnameref(MCNameRef name, Exec_concat sep, bool first);

bool copyasnameref(MCNameRef& name);

bool trytoconvertutf16tonative();

private:
void dounicodetomultibyte(bool p_native, bool p_reverse);
Expand Down
2 changes: 1 addition & 1 deletion engine/src/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ class MCObject : public MCDLlist

// MW-2011-01-14: [[ Bug 9288 ]] Added 'parid' to make sure 'the properties of card id ...' returns
// the correct result.
Exec_stat getproparray(MCExecPoint &ep, uint4 parid);
Exec_stat getproparray(MCExecPoint &ep, uint4 parid, bool effective);

MCObjectHandle *gethandle(void);

Expand Down
2 changes: 1 addition & 1 deletion engine/src/objectprops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ Exec_stat MCObject::getprop(uint4 parid, Properties which, MCExecPoint &ep, Bool
ep.clear();
break;
case P_PROPERTIES:
return getproparray(ep, parid);
return getproparray(ep, parid, effective);
case P_CUSTOM_PROPERTY_SET:
ep . setnameref_unsafe(getdefaultpropsetname());
break;
Expand Down
Loading