Changeset 809 in dev


Ignore:
Timestamp:
Feb 13, 2011, 4:10:19 PM (14 years ago)
Author:
イグトランス (egtra)
Message:

実行時で落っこちるところ(2ヶ所)を修正

Location:
branches/egtra/ab5.0/abdev
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/egtra/ab5.0/abdev/BasicCompiler_Common/error.cpp

    r562 r809  
    44
    55#define STRING_SYSTEM_DECLAREHANDLE "*_System_DeclareHandle_"
    6 void DifferentTypeError( const Type &varType, const Type &calcFormalType, const int iWarning,const char *pszFuncName,const int ParmNum){
     6void DifferentTypeError(const Type &varType, const Type &calcFormalType, const int iWarning, const char *pszFuncName, const int ParmNum)
     7{
    78    //////////////////////////
    89    // キャストに関する警告
    910    //////////////////////////
    10     char temporary[255];
    11     Type calcType( calcFormalType );
    12 
    13     if(IS_LITERAL(calcType.GetIndex()))
     11    std::ostringstream s;
     12    Type calcType(calcFormalType);
     13
     14    if (IS_LITERAL(calcType.GetIndex()))
    1415    {
    1516        calcType.SetIndex( -1 );
    1617    }
    1718
    18     if(pszFuncName)
    19         sprintf(temporary,"\"%s\"の第%dパラメータが、",pszFuncName,ParmNum+1);
    20     else temporary[0]=0;
    21 
    22     std::string varTypeName = compiler.TypeToString( varType );
    23     if(memcmp( varTypeName.c_str(),STRING_SYSTEM_DECLAREHANDLE,lstrlen(STRING_SYSTEM_DECLAREHANDLE))==0)
    24     {
    25         varTypeName = varTypeName.substr( lstrlen(STRING_SYSTEM_DECLAREHANDLE) );
    26     }
    27 
    28     std::string calcTypeName = compiler.TypeToString( calcType );
    29     if(memcmp( calcTypeName.c_str(),STRING_SYSTEM_DECLAREHANDLE,lstrlen(STRING_SYSTEM_DECLAREHANDLE))==0)
    30     {
    31         calcTypeName = calcTypeName.substr( lstrlen(STRING_SYSTEM_DECLAREHANDLE) );
    32     }
    33     sprintf(temporary+lstrlen(temporary),"%sから%s",calcTypeName.c_str(),varTypeName.c_str());
     19    if (pszFuncName)
     20    {
     21        s << boost::format("\"%s\"の第%dパラメータが、") % pszFuncName % (ParmNum + 1);
     22    }
     23
     24    std::string varTypeName = compiler.TypeToString(varType);
     25    if (memcmp(varTypeName.c_str(), STRING_SYSTEM_DECLAREHANDLE, lstrlen(STRING_SYSTEM_DECLAREHANDLE)) == 0)
     26    {
     27        varTypeName = varTypeName.substr(strlen(STRING_SYSTEM_DECLAREHANDLE));
     28    }
     29
     30    std::string calcTypeName = compiler.TypeToString(calcType);
     31    if (memcmp(calcTypeName.c_str(), STRING_SYSTEM_DECLAREHANDLE, strlen(STRING_SYSTEM_DECLAREHANDLE)) == 0)
     32    {
     33        calcTypeName = calcTypeName.substr(strlen(STRING_SYSTEM_DECLAREHANDLE));
     34    }
     35    s << boost::format("%sから%s") % calcTypeName % varTypeName;
    3436
    3537    extern int cp;
    36     if(iWarning==1) compiler.errorMessenger.Output(-101,temporary,cp);
    37     else if(iWarning==2) compiler.errorMessenger.Output(-102,temporary,cp);
    38     else if(iWarning==3) compiler.errorMessenger.Output(50,temporary,cp);
     38    int errorCode;
     39    switch (iWarning)
     40    {
     41        case 1: errorCode = -101; break;
     42        case 2: errorCode = -102; break;
     43        case 3: errorCode = 50; break;
     44    }
     45    compiler.errorMessenger.Output(errorCode, s.str().c_str(), cp);
    3946}
    4047
  • branches/egtra/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp

    r750 r809  
    353353const std::string Compiler::TypeToString( const Type &type )
    354354{
    355     if( PTR_LEVEL( type.GetBasicType() ) ){
     355    if(type.GetBasicType() != DEF_NON && PTR_LEVEL( type.GetBasicType() ) ){
    356356        //ポインタレベルが1以上の場合
    357357        Type tempType( type );
  • branches/egtra/ab5.0/abdev/BasicCompiler_Common/stdafx.h

    r806 r809  
    2828//boost libraries
    2929#include <boost/foreach.hpp>
     30#include <boost/format.hpp>
     31#include <boost/optional.hpp>
    3032#include <boost/serialization/serialization.hpp>
    3133#include <boost/serialization/nvp.hpp>
  • branches/egtra/ab5.0/abdev/ab_common/src/ResourceManager/ResourceManager.cpp

    r769 r809  
    3939
    4040    std::string baseDir = Jenga::Common::Path::ExtractDirPath( resourceFilePath );
     41
     42    if (buffer.empty())
     43    {
     44        return false;
     45    }
    4146
    4247    i2=0;
Note: See TracChangeset for help on using the changeset viewer.