Skip to content

Commit df099f6

Browse files
authored
[CORE] Change StringClass::Peek_Buffer functions to mutable Peek_Buffer and immutable str (#996)
1 parent a427097 commit df099f6

File tree

14 files changed

+28
-28
lines changed

14 files changed

+28
-28
lines changed

Core/Libraries/Source/WWVegas/WW3D2/animatedsoundmgr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ Is_In_Param_List
228228
// OutputDebugString( "\n" );
229229

230230
// if ( stricmp( string.Peek_Buffer(), param_to_check ) == 0 ) // Breaks with whitespaces
231-
if ( strstr( string.Peek_Buffer(), param_to_check ) != 0 )
231+
if ( strstr( string.str(), param_to_check ) != 0 )
232232
{
233233
return( true );
234234
}
@@ -447,7 +447,7 @@ AnimatedSoundMgrClass::Get_Embedded_Sound_Name (HAnimClass *anim)
447447
return NULL;
448448
}
449449

450-
return list->BoneName.Peek_Buffer();
450+
return list->BoneName.str();
451451
}
452452

453453

@@ -527,7 +527,7 @@ AnimatedSoundMgrClass::Trigger_Sound
527527
//
528528
// Stop the audio
529529
//
530-
SoundLibrary->Stop_Playing_Audio( sound_list->List[index]->SoundName.Peek_Buffer() );
530+
SoundLibrary->Stop_Playing_Audio( sound_list->List[index]->SoundName.str() );
531531
}
532532
else
533533
{
@@ -536,11 +536,11 @@ AnimatedSoundMgrClass::Trigger_Sound
536536
//
537537
if (sound_list->List[index]->Is2D == true)
538538
{
539-
SoundLibrary->Play_2D_Audio(sound_list->List[index]->SoundName.Peek_Buffer());
539+
SoundLibrary->Play_2D_Audio(sound_list->List[index]->SoundName.str());
540540
}
541541
else
542542
{
543-
SoundLibrary->Play_3D_Audio(sound_list->List[index]->SoundName.Peek_Buffer(), tm);
543+
SoundLibrary->Play_3D_Audio(sound_list->List[index]->SoundName.str(), tm);
544544
}
545545
}
546546

Core/Libraries/Source/WWVegas/WW3D2/statistics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void Record_Texture_End()
113113
// if (tfc->Get_Texture_Flash()) flash="F";
114114
// }
115115

116-
working_string.Format("%4.4d %3.3d %3.3d %s ",id,texture_statistics[a].usage_count,texture_statistics[a].change_count,flash.Peek_Buffer());
116+
working_string.Format("%4.4d %3.3d %3.3d %s ",id,texture_statistics[a].usage_count,texture_statistics[a].change_count,flash.str());
117117
texture_statistics_string+=working_string;
118118

119119
StringClass error="";

Core/Libraries/Source/WWVegas/WW3D2/w3dexclusionlist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ bool W3DExclusionListClass::Is_Excluded(HAnimClass * hanim) const
8686
{
8787
// For HAnims, the name to check is the one trailing the '.'
8888
StringClass copy = hanim->Get_Name();
89-
char * root_name = copy.Peek_Buffer();
89+
const char * root_name = copy.str();
9090

91-
char * tmp = strchr(root_name,'.');
91+
const char * tmp = strchr(root_name,'.');
9292
if (tmp) {
9393
return Is_Excluded(tmp + 1);
9494
} else {

Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void WWProfileHierachyNodeClass::Write_To_File(FileClass* file,int recursion)
202202
for (i=0;i<recursion;++i) { string+="\t"; }
203203
work.Format("%s\t%d\t%f\r\n",Name,TotalCalls,TotalTime*1000.0f);
204204
string+=work;
205-
file->Write(string.Peek_Buffer(),string.Get_Length());
205+
file->Write(string.str(),string.Get_Length());
206206
}
207207
if (Child) {
208208
Child->Write_To_File(file,recursion+1);
@@ -577,7 +577,7 @@ void WWProfileManager::End_Collecting(const char* filename)
577577
"Total frames: %d, average frame time: %fms\r\n"
578578
"All frames taking more than twice the average frame time are marked with keyword SPIKE.\r\n\r\n",
579579
ProfileCollectVector.Count(),avg_frame_time*1000.0f);
580-
file->Write(str.Peek_Buffer(),str.Get_Length());
580+
file->Write(str.str(),str.Get_Length());
581581

582582
HashTemplateIterator<StringClass,unsigned> ite(ProfileStringHash);
583583
for (ite.First();!ite.Is_Done();ite.Next()) {
@@ -591,18 +591,18 @@ void WWProfileManager::End_Collecting(const char* filename)
591591
if (name[i]==';') name[i]=':';
592592
}
593593
str.Format("ID: %d %s\r\n",ite.Peek_Value(),name);
594-
file->Write(str.Peek_Buffer(),str.Get_Length());
594+
file->Write(str.str(),str.Get_Length());
595595
}
596596

597597
str.Format("\r\n\r\n");
598-
file->Write(str.Peek_Buffer(),str.Get_Length());
598+
file->Write(str.str(),str.Get_Length());
599599

600600
for (i=0;i<ProfileCollectVector.Count();++i) {
601601
float frame_time=ProfileCollectVector[i]->Get_Total_Time();
602602
str.Format("FRAME: %d %2.2f %s ",i,frame_time*1000.0f,frame_time>avg_frame_time*2.0f ? "SPIKE" : "OK");
603603
ProfileCollectVector[i]->Add_To_String_Compact(str,0);
604604
str+="\r\n";
605-
file->Write(str.Peek_Buffer(),str.Get_Length());
605+
file->Write(str.str(),str.Get_Length());
606606
}
607607

608608
//

Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ void CPUDetectClass::Init_Processor_String()
792792
case INTEL_PROCESSOR_PENTIUM4: str+="Pentium4"; break;
793793
}
794794
}
795-
strncpy(ProcessorString,str.Peek_Buffer(),sizeof(ProcessorString));
795+
strncpy(ProcessorString,str.str(),sizeof(ProcessorString));
796796
}
797797

798798
}
@@ -959,7 +959,7 @@ void CPUDetectClass::Init_Processor_Log()
959959
#ifdef WIN32
960960
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo));
961961
#elif defined(_UNIX)
962-
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo.Peek_Buffer()));
962+
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo.str()));
963963
#endif
964964

965965
SYSLOG(("Processor: %s\r\n",CPUDetectClass::Get_Processor_String()));
@@ -974,7 +974,7 @@ void CPUDetectClass::Init_Processor_Log()
974974
#ifdef WIN32
975975
SYSLOG(("Processor type: %s\r\n", cpu_type));
976976
#elif defined(_UNIX)
977-
SYSLOG(("Processor type: %s\r\n", cpu_type.Peek_Buffer()));
977+
SYSLOG(("Processor type: %s\r\n", cpu_type.str()));
978978
#endif
979979

980980
SYSLOG(("\r\n"));

Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ FileClass * SimpleFileFactoryClass::Get_File( char const *filename )
285285
const char *tok;
286286
while((tok=strtok(tokstart, ";")) != NULL) {
287287
tokstart=NULL;
288-
new_name.Format("%s%s",tok,stripped_name.Peek_Buffer());
288+
new_name.Format("%s%s",tok,stripped_name.str());
289289
file->Set_Name( new_name ); // Call Set_Name to force an allocated name
290290
if (file->Open()) {
291291
file->Close();

Core/Libraries/Source/WWVegas/WWLib/hashtemplate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ template <class KeyType, class ValueType> inline HashTemplateClass<KeyType,Value
415415
template <> inline unsigned int HashTemplateKeyClass<StringClass>::Get_Hash_Value(const StringClass& s)
416416
{
417417
unsigned int len=s.Get_Length();
418-
unsigned char* buffer=(unsigned char*)s.Peek_Buffer();
418+
unsigned const char* buffer=(unsigned const char*)s.str();
419419
if (len<8) {
420420
unsigned int hval=0;
421421
for (unsigned int a=0;a<len;++a) {

Core/Libraries/Source/WWVegas/WWLib/textfile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ TextFileClass::Read_Line (StringClass &string)
134134
if (retval) {
135135

136136
int len = string.Get_Length ();
137-
char *raw_string = string.Peek_Buffer ();
137+
const char *raw_string = string.str();
138138

139139
//
140140
// Strip the CR\LF or LF from the string

Core/Libraries/Source/WWVegas/WWLib/wwstring.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class StringClass
128128

129129
TCHAR * Get_Buffer (int new_length);
130130
TCHAR * Peek_Buffer (void);
131-
const TCHAR * Peek_Buffer (void) const;
131+
const TCHAR * str (void) const;
132132

133133
bool Copy_Wide (const WCHAR *source);
134134

@@ -562,10 +562,10 @@ StringClass::Peek_Buffer (void)
562562
}
563563

564564
///////////////////////////////////////////////////////////////////
565-
// Peek_Buffer
565+
// str (formerly Peek_Buffer)
566566
///////////////////////////////////////////////////////////////////
567567
inline const TCHAR *
568-
StringClass::Peek_Buffer (void) const
568+
StringClass::str (void) const
569569
{
570570
return m_Buffer;
571571
}

Core/Tools/W3DView/AnimatedSoundOptionsDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ AnimatedSoundOptionsDialogClass::Load_Animated_Sound_Settings (void)
211211
file->Close ();
212212
_TheFileFactory->Return_File (file);
213213
} else {
214-
WWDEBUG_SAY (("Failed to load file %s\n", sound_def_lib_path.Peek_Buffer ()));
214+
WWDEBUG_SAY (("Failed to load file %s\n", sound_def_lib_path.str ()));
215215
}
216216

217217
//

0 commit comments

Comments
 (0)