From 1667d0bbc3dfff8ab5ea4f6bbaa15a5363d35cb1 Mon Sep 17 00:00:00 2001 From: paulc Date: Tue, 15 May 2012 14:13:56 +0000 Subject: [PATCH] Limited the length of the debugging output from expression parser. Fixed the string limit for single char in a few places, it had to be %.1s instead of %1s. git-svn-id: http://yate.null.ro/svn/yate/trunk@5062 acf43c95-373e-0410-b603-e72c3f656dc1 --- engine/NamedList.cpp | 8 ++++---- libs/yscript/evaluator.cpp | 16 ++++++++-------- libs/yscript/javascript.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engine/NamedList.cpp b/engine/NamedList.cpp index 53f48836..be76ad4a 100644 --- a/engine/NamedList.cpp +++ b/engine/NamedList.cpp @@ -109,7 +109,7 @@ NamedList& NamedList::setParam(const char* name, const char* value) NamedList& NamedList::clearParam(const String& name, char childSep) { - XDebug(DebugInfo,"NamedList::clearParam(\"%s\",'%1s')", + XDebug(DebugInfo,"NamedList::clearParam(\"%s\",'%.1s')", name.c_str(),&childSep); String tmp; if (childSep) @@ -139,7 +139,7 @@ NamedList& NamedList::clearParam(NamedString* param) NamedList& NamedList::copyParam(const NamedList& original, const String& name, char childSep) { - XDebug(DebugInfo,"NamedList::copyParam(%p,\"%s\",'%1s')", + XDebug(DebugInfo,"NamedList::copyParam(%p,\"%s\",'%.1s')", &original,name.c_str(),&childSep); if (!childSep) { // faster and simpler - used in most cases @@ -169,7 +169,7 @@ NamedList& NamedList::copyParams(const NamedList& original) NamedList& NamedList::copyParams(const NamedList& original, ObjList* list, char childSep) { - XDebug(DebugInfo,"NamedList::copyParams(%p,%p,'%1s') [%p]", + XDebug(DebugInfo,"NamedList::copyParams(%p,%p,'%.1s') [%p]", &original,list,&childSep,this); for (; list; list = list->next()) { GenObject* obj = list->get(); @@ -185,7 +185,7 @@ NamedList& NamedList::copyParams(const NamedList& original, ObjList* list, char NamedList& NamedList::copyParams(const NamedList& original, const String& list, char childSep) { - XDebug(DebugInfo,"NamedList::copyParams(%p,\"%s\",'%1s') [%p]", + XDebug(DebugInfo,"NamedList::copyParams(%p,\"%s\",'%.1s') [%p]", &original,list.c_str(),&childSep,this); ObjList* l = list.split(',',false); if (l) { diff --git a/libs/yscript/evaluator.cpp b/libs/yscript/evaluator.cpp index f3235a5f..8501090a 100644 --- a/libs/yscript/evaluator.cpp +++ b/libs/yscript/evaluator.cpp @@ -220,7 +220,7 @@ int ExpEvaluator::preProcess(const char*& expr, GenObject* context) ExpEvaluator::Opcode ExpEvaluator::getOperator(const char*& expr, const TokenDict* operators, bool caseInsensitive) const { - XDebug(this,DebugAll,"getOperator('%s',%p,%s)",expr,operators,String::boolText(caseInsensitive)); + XDebug(this,DebugAll,"getOperator('%.30s',%p,%s)",expr,operators,String::boolText(caseInsensitive)); skipComments(expr); if (operators) { bool kw = keywordChar(*expr); @@ -247,7 +247,7 @@ bool ExpEvaluator::gotError(const char* error, const char* text) const return false; error = "unknown error"; } - Debug(this,DebugWarn,"Evaluator error: %s%s%s",error, + Debug(this,DebugWarn,"Evaluator error: %s%s%.50s",error, (text ? " at: " : ""), c_safe(text)); return false; @@ -268,7 +268,7 @@ bool ExpEvaluator::getOperand(const char*& expr, bool endOk) { if (inError()) return false; - XDebug(this,DebugAll,"getOperand '%s'",expr); + XDebug(this,DebugAll,"getOperand '%.30s'",expr); char c = skipComments(expr); if (!c) // end of string @@ -298,7 +298,7 @@ bool ExpEvaluator::getNumber(const char*& expr) { if (inError()) return false; - XDebug(this,DebugAll,"getNumber '%s'",expr); + XDebug(this,DebugAll,"getNumber '%.30s'",expr); char* endp = 0; long int val = ::strtol(expr,&endp,0); if (!endp || (endp == expr)) @@ -313,7 +313,7 @@ bool ExpEvaluator::getString(const char*& expr) { if (inError()) return false; - XDebug(this,DebugAll,"getString '%s'",expr); + XDebug(this,DebugAll,"getString '%.30s'",expr); char c = skipComments(expr); if (c == '"' || c == '\'') { char sep = c; @@ -347,7 +347,7 @@ bool ExpEvaluator::getFunction(const char*& expr) { if (inError()) return false; - XDebug(this,DebugAll,"getFunction '%s'",expr); + XDebug(this,DebugAll,"getFunction '%.30s'",expr); skipComments(expr); int len = getKeyword(expr); const char* s = expr+len; @@ -378,7 +378,7 @@ bool ExpEvaluator::getField(const char*& expr) { if (inError()) return false; - XDebug(this,DebugAll,"getField '%s'",expr); + XDebug(this,DebugAll,"getField '%.30s'",expr); skipComments(expr); int len = getKeyword(expr); if (len <= 0) @@ -493,7 +493,7 @@ bool ExpEvaluator::runCompile(const char*& expr, char stop, Opcode nested) StackedOpcode stack[10]; unsigned int stackPos = 0; #ifdef DEBUG - Debugger debug(DebugInfo,"runCompile()"," '%s' '%1s'",expr,&stop); + Debugger debug(DebugInfo,"runCompile()"," '%.30s' '%.1s'",expr,&stop); #endif if (skipComments(expr) == ')') return false; diff --git a/libs/yscript/javascript.cpp b/libs/yscript/javascript.cpp index ccd8342d..07e91372 100644 --- a/libs/yscript/javascript.cpp +++ b/libs/yscript/javascript.cpp @@ -496,7 +496,7 @@ bool JsCode::getInstruction(const char*& expr, Opcode nested) { if (inError()) return false; - XDebug(this,DebugAll,"JsCode::getInstruction '%s' %u",expr,nested); + XDebug(this,DebugAll,"JsCode::getInstruction '%.30s' %u",expr,nested); if (skipComments(expr) == '{') { expr++; for (;;) { @@ -669,7 +669,7 @@ ExpEvaluator::Opcode JsCode::getOperator(const char*& expr) { if (inError()) return OpcNone; - XDebug(this,DebugAll,"JsCode::getOperator '%s'",expr); + XDebug(this,DebugAll,"JsCode::getOperator '%.30s'",expr); Opcode op = ExpEvaluator::getOperator(expr,s_operators); if (OpcNone != op) return op; @@ -680,7 +680,7 @@ ExpEvaluator::Opcode JsCode::getUnaryOperator(const char*& expr) { if (inError()) return OpcNone; - XDebug(this,DebugAll,"JsCode::getUnaryOperator '%s'",expr); + XDebug(this,DebugAll,"JsCode::getUnaryOperator '%.30s'",expr); Opcode op = ExpEvaluator::getOperator(expr,s_unaryOps); if (OpcNone != op) return op; @@ -691,7 +691,7 @@ ExpEvaluator::Opcode JsCode::getPostfixOperator(const char*& expr) { if (inError()) return OpcNone; - XDebug(this,DebugAll,"JsCode::getPostfixOperator '%s'",expr); + XDebug(this,DebugAll,"JsCode::getPostfixOperator '%.30s'",expr); if (skipComments(expr) == '[') { if (!runCompile(++expr,']')) return OpcNone;