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

Commit 587d22c

Browse files
[[ Mac64 ]] Avoid the deprecated Pascal string APIs in revspeech
1 parent 9d21d63 commit 587d22c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

revspeech/src/osxspeech.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ bool OSXSpeechNarrator::ListVoices(NarratorGender p_gender, NarratorListVoicesCa
134134
&&(GetVoiceDescription(&tVoice, &myInfo, sizeof(myInfo)) == noErr))
135135
{
136136
if ((t_gender != -1) && (myInfo.gender != t_gender)) continue;
137-
char cvoice[255];
138-
CopyPascalStringToC(myInfo.name, cvoice);
137+
char cvoice[256];
138+
strncpy(cvoice, (const char*)&myInfo.name[1], myInfo.name[0]);
139139
p_callback(p_context, p_gender, cvoice);
140140
}
141141
}
@@ -276,7 +276,7 @@ void OSXSpeechNarrator::FindAndSelect()
276276
{
277277
VoiceSpec *FoundVoice = nil;
278278
VoiceSpec tVoice;
279-
char cvoice[255];
279+
char cvoice[256];
280280
short NumVoices;
281281
if (CountVoices(&NumVoices) == noErr) {
282282
for (short count = 1;count<=NumVoices;count++)
@@ -285,7 +285,7 @@ void OSXSpeechNarrator::FindAndSelect()
285285
{
286286
VoiceDescription myInfo;
287287
if (GetVoiceDescription(&tVoice, &myInfo, sizeof(myInfo)) == noErr) {
288-
CopyPascalStringToC(myInfo.name,cvoice);
288+
strncpy(cvoice, (const char*)&myInfo.name[1], myInfo.name[0]);
289289
if (strcmp(cvoice,speechvoice) == 0)
290290
{
291291
FoundVoice = &tVoice;

0 commit comments

Comments
 (0)