MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SE_Load_Actual

Function SE_Load_Actual

code/qcommon/stringed_ingame.cpp:845–890  ·  view source on GitHub ↗

filename is local here, eg: "strings/german/obj.str" return is either NULL for good else error message to display...

Source from the content-addressed store, hash-verified

843// return is either NULL for good else error message to display...
844//
845static const char *SE_Load_Actual( const char *psFileName, SE_BOOL bLoadDebug, SE_BOOL bSpeculativeLoad )
846{
847 const char *psErrorMessage = NULL;
848
849 unsigned char *psLoadedData = SE_LoadFileData( psFileName );
850 if ( psLoadedData )
851 {
852 // now parse the data...
853 //
854 char *psParsePos = (char *) psLoadedData;
855
856 TheStringPackage.SetupNewFileParse( psFileName, bLoadDebug );
857
858 char sLineBuffer[16384]; // should be enough for one line of text (some of them can be BIG though)
859 while ( !psErrorMessage && TheStringPackage.ReadLine((const char *&) psParsePos, sLineBuffer ) )
860 {
861 if (strlen(sLineBuffer))
862 {
863// __DEBUGOUT( sLineBuffer );
864// __DEBUGOUT( "\n" );
865
866 psErrorMessage = TheStringPackage.ParseLine( sLineBuffer );
867 }
868 }
869
870 SE_FreeFileDataAfterLoad( psLoadedData);
871
872 if (!psErrorMessage && !TheStringPackage.EndMarkerFoundDuringParse())
873 {
874 psErrorMessage = va("Truncated file, failed to find \"%s\" at file end!", sSE_KEYWORD_ENDMARKER);
875 }
876 }
877 else
878 {
879 if ( bSpeculativeLoad )
880 {
881 // then it's ok to not find the file, so do nothing...
882 }
883 else
884 {
885 psErrorMessage = va("Unable to load \"%s\"!", psFileName);
886 }
887 }
888
889 return psErrorMessage;
890}
891
892static const char *SE_GetFoundFile( std::string &strResult )
893{

Callers 1

SE_LoadFunction · 0.70

Calls 7

SE_LoadFileDataFunction · 0.70
SE_FreeFileDataAfterLoadFunction · 0.70
vaFunction · 0.70
SetupNewFileParseMethod · 0.45
ReadLineMethod · 0.45
ParseLineMethod · 0.45

Tested by

no test coverage detected