Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit 4eee62c

Browse files
committed
Some more modifications on globals after Mark's feedback livecode#6
1 parent efe18dd commit 4eee62c

5 files changed

Lines changed: 10 additions & 20 deletions

File tree

engine/src/dskmain.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,11 @@ bool X_init(int argc, char *argv[], char *envp[])
131131
delete MCeerror;
132132
delete MCresult;
133133
#endif
134-
135-
////
136134

137135
/* UNCHECKED */ MCStringCreateWithCString(argv[0], MCcmd);
138136

139137
#if defined(_MAC_DESKTOP)
140-
{
141-
char *t_new_cmd;
142-
uint4 t_length;
143-
t_length = MCStringGetLength(MCcmd);
144-
t_new_cmd = new char[t_length + 1];
145-
MCS_utf8tonative(MCStringGetCString(MCcmd), t_length, t_new_cmd, t_length);
146-
t_new_cmd[t_length] = 0;
147-
/* UNCHECKED */ MCStringCreateWithCString(t_new_cmd, MCcmd);
148-
}
138+
/* UNCHECKED */ MCStringCreateWithBytes(argv[0], strlen(argv[0]), kMCStringEncodingUTF8, MCcmd);
149139
#endif
150140

151141
#if defined(_LINUX_DESKTOP) || defined(_MAC_DESKTOP) //get fullpath

engine/src/hc.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ static MCBitmap *convert_bitmap(uint1 *sptr, uint2 width, uint2 height)
189189
uint1 *startptr = sptr;
190190
uint2 repcount = 1;
191191
uint2 line = 0;
192-
char *MChcstat_cstring;
193192
while (dptr < deptr)
194193
{
195194
uint2 hrepcount = bpl;
@@ -1350,7 +1349,6 @@ IO_stat MCHccard::parse(char *sptr)
13501349
maxid = MCU_max(id, maxid);
13511350
uint2 ntext;
13521351
uint4 offset;
1353-
char *MChcstat_cstring;
13541352
if (version == 1)
13551353
{
13561354
bmapid = swap_uint4(&uint4ptr[3]);
@@ -1420,7 +1418,7 @@ IO_stat MCHccard::parse(char *sptr)
14201418
if (sptr[offset])
14211419
name = strclone(&sptr[offset]);
14221420
script = convert_script(&sptr[offset + strlen(&sptr[offset]) + 1]);
1423-
delete MChcstat_cstring;
1421+
14241422
return IO_NORMAL;
14251423
}
14261424

engine/src/mode_development.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static MCStringRef s_command_path = NULL;
138138
static void restart_revolution(void)
139139
{
140140
#if defined(TARGET_PLATFORM_WINDOWS)
141-
_spawnl(_P_NOWAIT, strdup(MCStringGetCString(s_command_path)), strdup(MCStringGetCString(s_command_path)), NULL);
141+
_spawnl(_P_NOWAIT, MCStringGetCString(s_command_path), MCStringGetCString(s_command_path), NULL);
142142
#elif defined(TARGET_PLATFORM_MACOS_X)
143143
if (fork() == 0)
144144
{

engine/src/osxspec.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,9 @@ void MCS_init()
952952
if (err == noErr)
953953
{
954954
p2cstr(proxystr);
955-
/* UNCHECKED */ MCStringCreateWithCString((char *)proxystr, MChttpproxy);
955+
MCAutoStringRef t_proxystr;
956+
/* UNCHECKED */ MCStringCreateWithCString((char *)proxystr, &t_proxystr);
957+
MCValueAssign(MChttpproxy, *t_proxystr);
956958
}
957959
}
958960
ICStop(icinst);

engine/src/property.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3737,7 +3737,7 @@ Exec_stat MCProperty::eval(MCExecPoint &ep)
37373737
MCdialogdata->fetch(ep);
37383738
break;
37393739
case P_HC_IMPORT_STAT:
3740-
ep.setsvalue(MCStringGetCString(MChcstat));
3740+
ep.setsvalue(MChcstat);
37413741
break;
37423742
case P_SCRIPT_TEXT_FONT:
37433743
ep.setsvalue(MCscriptfont);
@@ -3828,7 +3828,7 @@ Exec_stat MCProperty::eval(MCExecPoint &ep)
38283828
ep.setboolean(MCsystemPS);
38293829
break;
38303830
case P_FILE_TYPE:
3831-
ep.setsvalue(MCStringGetCString(MCfiletype));
3831+
ep.setsvalue(MCfiletype);
38323832
break;
38333833
case P_STACK_FILE_TYPE:
38343834
ep.setsvalue(MCstackfiletype);
@@ -3897,13 +3897,13 @@ Exec_stat MCProperty::eval(MCExecPoint &ep)
38973897
if (MChttpheaders == NULL)
38983898
ep.clear();
38993899
else
3900-
ep.setsvalue(MCStringGetCString(MChttpheaders));
3900+
ep.setsvalue(MChttpheaders);
39013901
break;
39023902
case P_HTTP_PROXY:
39033903
if (MChttpproxy == NULL)
39043904
ep . clear();
39053905
else
3906-
ep . copysvalue(MCStringGetCString(MChttpproxy));
3906+
ep . copysvalue(MChttpproxy);
39073907
break;
39083908
case P_SHOW_INVISIBLES:
39093909
ep.setboolean(MCshowinvisibles);

0 commit comments

Comments
 (0)