[AGENT++] A Bug

Frank Fock fock at agentpp.com
Sun Jun 11 23:15:20 CEST 2006


Hi,

col is one-based in the below code. So do not see
an error here. Do you agree?

Best regards,
Frank

xiao.zhibin at zte.com.cn wrote:
> Hi everyone:
> I have worked with Agent++ for some time.It is really a great toolkit for 
> SNMP developer,saving us much time.
> However,there seems to be some minor bugs in the file. 
> 
> In Mib.cpp file function Mib::find_next(Oidx &o)
> 
> 
> MibLeaf* MibTable::find_prev(const Oidx& o)
> {
>         if (content.empty()) return 0;
> 
>         // shortcut
>         if (content.last()->last()->get_oid() < o) {
>                 return content.last()->last();
>         }
>         int col = content.first()->size();
> #ifdef USE_ARRAY_TEMPLATE
>         ArrayCursor<MibLeaf> cur;
> #else
>         OrderedListCursor<MibLeaf> cur;
> #endif
>         for (cur.initLast(&content.first()->row); cur.get(); 
>              cur.prev(), col--) {
>                if (cur.get()->get_oid() < o) 
>                         break;
>         }
>         if (!cur.get()) return 0;
>         OidListCursor<MibTableRow> row;
>         for (row.init(&content); row.get(); row.next()) {
>                 // we assume here that tables are arrays, that is every 
> row has
>                 // the same size
>                 printf("\n\nthe oid  is %s 
> ",row.get()->get_nth(col)->get_oid().get_printable());
>                 if (row.get()->get_nth(col)->get_oid() < o) 
>                         return row.get()->get_nth(col);
>         }
>         return 0;
> }
> 
> I think get_nth(col) should be replaced with get_nth(col-1),
> since the col is counted from 0,but argument of get_nth()
> is counted from 1,isn't it?
> 
> 
> with regards 
>      christ_shaw 
> 
> 
>  
> 
> 
> ******************************
> 
> 
> ******************************
> 
> --------------------------------------------------------
> ZTE Information Security Notice: The information contained in this mail is solely property of the sender's organization. This mail communication is confidential. Recipients named above are obligated to maintain secrecy and are not permitted to disclose the contents of this communication to others.
> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. Any views expressed in this message are those of the individual sender.
> This message has been scanned for viruses and Spam by ZTE Anti-Spam system.
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the AGENTPP mailing list