C++ 巴达';s AppLog奇怪地扭曲了我报告的字符串

C++ 巴达';s AppLog奇怪地扭曲了我报告的字符串,c++,macros,bada,C++,Macros,Bada,我正在改编这个例子,发现AppLog奇怪地破坏了我报告的字符串 void MyFormsApp::OnUserEventReceivedN (RequestId requestId, IList *pArgs) { AppLog("OnUEveRxdNb, beginning"); if(!pArgs) { AppLog("OnUserEventReceivedN, null List"); return; } if(reques

我正在改编这个例子,发现AppLog奇怪地破坏了我报告的字符串

void
MyFormsApp::OnUserEventReceivedN (RequestId requestId, IList *pArgs)
{
    AppLog("OnUEveRxdNb, beginning");
    if(!pArgs) {
        AppLog("OnUserEventReceivedN, null List");
        return;
    }

    if(requestId==TabsForm::TABS_SWITCH_CALL)
    {
        Integer * tabindex = static_cast<Integer *>(pArgs->GetAt(0));
        MyLog(L"OnUEveRxdN, formID : ", formID->ToInt());
        //MyLog(L"OnUserEventReceivedN, formID : ", formID->ToInt());
        if(tabindex)
        {
            switch(tabindex->ToInt())
            {
            case TabsForm::SEARCH_TAB:
                frame_->SetCurrentForm(*search_form_);
                search_form_->RequestRedraw(true);
                break;
            case TabsForm::RESULTS_TAB:
                frame_->SetCurrentForm(*results_form_);
                results_form_->RequestRedraw(true);
                break;
            case TabsForm::CONTENTS_TAB:
                frame_->SetCurrentForm(*contents_form_);
                contents_form_->RequestRedraw(true);
                break;
            }
        }
    }
    pArgs->RemoveAll(true);
    delete pArgs;
} //closebracket
void
MyFormsApp::OnUserEventReceivedN(RequestId RequestId,IList*pArgs)
{
AppLog(“OnUEveRxdNb,开始”);
如果(!pArgs){
AppLog(“OnUserEventReceivedN,空列表”);
返回;
}
if(requestId==TabsForm::TABS\u开关\u调用)
{
整数*tabindex=static_cast(pArgs->GetAt(0));
MyLog(L“OnUEveRxdN,formID:,formID->ToInt());
//MyLog(L“OnUserEventReceivedN,formID:,formID->ToInt());
if(tabindex)
{
开关(tabindex->ToInt())
{
案例选项卡窗体::搜索选项卡:
框架->设置当前表单(*搜索表单);
搜索表单->请求重绘(true);
打破
案例选项卡窗体::结果选项卡:
框架->设置当前形式(*结果形式);
结果\u表单\u->RequestRedraw(真);
打破
案例选项卡窗体::内容选项卡:
框架->设置当前格式(*内容\格式);
contents\u form\u->RequestRedraw(true);
打破
}
}
}
pArgs->RemoveAll(正确);
删除pArgs;
}//闭括号
MyLog是

void MyLog(const String &badaStr) {
    char *natStr = new char[badaStr.GetLength()];
    for (int i = 0; i < badaStr.GetLength(); ++i)
        natStr[i] = badaStr[i];
    AppLog(natStr);
    delete[] natStr;
}

void MyLog(const mchar *pValue, const int int_param) {
    String str(pValue);
    result r = str.Append(int_param);
    MyLog(str);
}

void MyLog(const char *pValue, const int int_param) {
    String str(pValue);
    result r = str.Append(int_param);
    MyLog(str);
}
void MyLog(常量字符串和badaStr){
char*natStr=new char[badaStr.GetLength()];
对于(int i=0;i
如果你看到我从哪里得到了对它的两个调用,那么第二个被注释掉了,因为它在我的字符串末尾附加了垃圾。在我的应用程序中,我可以从其他地方调用这些函数,但这里的字符串必须被截断。它不是每个函数的总
char
计数,因为将第一个
AppLog
替换为
AppLog(“BadaReader::OnUserEventReceivedN,开始”)没有区别


有人能发现我的错误吗?或者Bada 2.0.2以这种随机故障而闻名吗?

为什么需要单独的日志功能? bada有三个AppLog宏。Yoc可以使用它们。 另外,如果需要打印字符串do

AppLog("Log Statement %s",string_name->GetPointer());

string_name->GetPointer()返回const char*

我在另一个方法中重新创建了此行为。我认为这可能与后续异常覆盖为
AppLog
预留的一些缓冲区有关,因为当我上次遇到此问题时,它是与异常一起出现的,即在导致异常之前。已解决:
natStr[badaStr.GetLength()]='\0'从我将其内联到
MyLog
Ah的地方丢失,所以这就是您使用%s/%s的方式。我现在发现,
AppLog
具有
printf
功能,但
printf
不知道
Osp::Base::String
。顺便说一句,它是带有
GetPointer()
%S
,而不是
%S