@@ -931,44 +931,49 @@ Exec_stat MCDeployToELF(const MCDeployParameters& p_params, bool p_is_android)
931931
932932// //////////////////////////////////////////////////////////////////////////////
933933
934+ Exec_stat MCDeployToELF (const MCDeployParameters& p_params, bool p_is_android)
935+ {
936+ bool t_success;
937+ t_success = true ;
938+
939+ // MW-2013-05-03: [[ Linux64 ]] Snoop the engine type from the ident field.
940+
941+ MCDeployFileRef t_engine;
942+ t_engine = NULL ;
943+ if (t_success && !MCDeployFileOpen (p_params . engine, kMCOpenFileModeRead , t_engine))
944+ t_success = MCDeployThrow (kMCDeployErrorNoEngine );
945+
946+ char t_ident[EI_NIDENT];
947+ if (t_success && !MCDeployFileRead (t_engine, t_ident, EI_NIDENT))
948+ t_success = MCDeployThrow (kMCDeployErrorLinuxNoHeader );
949+
950+ if (t_success)
951+ {
952+ if (t_ident[EI_CLASS] == ELFCLASS32)
953+ return MCDeployToELF<MCLinuxELF32Traits>(p_params, p_is_android);
954+ else if (t_ident[EI_CLASS] == ELFCLASS64)
955+ return MCDeployToELF<MCLinuxELF64Traits>(p_params, p_is_android);
956+
957+ t_success = MCDeployThrow (kMCDeployErrorLinuxBadHeaderType );
958+ }
959+
960+ return t_success ? ES_NORMAL : ES_ERROR;
961+ }
962+
934963// This method attempts to build a Linux standalone using the given deployment
935964// parameters.
936965//
937966Exec_stat MCDeployToLinux (const MCDeployParameters& p_params)
938967{
939- bool t_success;
940- t_success = true ;
941-
942- // MW-2013-05-03: [[ Linux64 ]] Snoop the engine type from the ident field.
943-
944- MCDeployFileRef t_engine;
945- t_engine = NULL ;
946- if (t_success && !MCDeployFileOpen (p_params . engine, kMCOpenFileModeRead , t_engine))
947- t_success = MCDeployThrow (kMCDeployErrorNoEngine );
948-
949- char t_ident[EI_NIDENT];
950- if (t_success && !MCDeployFileRead (t_engine, t_ident, EI_NIDENT))
951- t_success = MCDeployThrow (kMCDeployErrorLinuxNoHeader );
952-
953- if (t_success)
954- {
955- if (t_ident[EI_CLASS] == ELFCLASS32)
956- return MCDeployToELF<MCLinuxELF32Traits>(p_params, false );
957- else if (t_ident[EI_CLASS] == ELFCLASS64)
958- return MCDeployToELF<MCLinuxELF64Traits>(p_params, false );
959-
960- t_success = MCDeployThrow (kMCDeployErrorLinuxBadHeaderType );
961- }
962-
963- return t_success ? ES_NORMAL : ES_ERROR;
968+ return MCDeployToELF (p_params, false );
964969}
965970
966971// This method attempts to build an Android standalone using the given deployment
967972// parameters.
968973//
969974Exec_stat MCDeployToAndroid (const MCDeployParameters& p_params)
970975{
971- return MCDeployToELF<MCLinuxELF32Traits> (p_params, true );
976+ return MCDeployToELF (p_params, true );
972977}
973978
974979// //////////////////////////////////////////////////////////////////////////////
0 commit comments