[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise
From: Will Stephenson <wstephenson () kde ! org>
Date: 2008-05-08 8:42:41
Message-ID: 1210236161.450609.20552.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 805329 by wstephens:
Use an int literal for an array size, pending removal of ugly c-array.
M +4 -4 coreprotocol.cpp
M +2 -5 gwfield.cpp
M +3 -3 gwfield.h
M +3 -3 inputprotocolbase.cpp
M +5 -2 responseprotocol.cpp
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp \
#805328:805329 @@ -296,7 +296,7 @@
// value
//dout.writeRawBytes( GW_URLVAR_VAL, sizeof( GW_URLVAR_VAL ) );
- char valString[ Field::NMFIELD_MAX_STR_LENGTH ];
+ char valString[ NMFIELD_MAX_STR_LENGTH ];
switch ( field->type() )
{
case NMFIELD_TYPE_UTF8: // Field contains UTF-8
@@ -308,7 +308,7 @@
// encoded.replace( "%20", "+" );
// dout << encoded.ascii();
- snprintf( valString, Field::NMFIELD_MAX_STR_LENGTH, "%s", url_escape_string( \
sField->value().toString().toUtf8() ).data() ); + snprintf( valString, \
NMFIELD_MAX_STR_LENGTH, "%s", url_escape_string( sField->value().toString().toUtf8() \
).data() ); //dout << sField->value().toString().ascii();
break;
}
@@ -319,7 +319,7 @@
const Field::MultiField *mField = static_cast<const Field::MultiField*>( field \
);
subFieldCount = mField->fields().count(); // determines if we have a subarray to \
send after this field //dout << QString::number( subFieldCount ).ascii();
- snprintf( valString, Field::NMFIELD_MAX_STR_LENGTH, "%u", subFieldCount );
+ snprintf( valString, NMFIELD_MAX_STR_LENGTH, "%u", subFieldCount );
break;
}
default: // Field contains a numeric value
@@ -327,7 +327,7 @@
//debug( " - it's a number" );
const Field::SingleField *sField = static_cast<const Field::SingleField*>( field \
); //dout << QString::number( sField->value().toInt() ).ascii();
- snprintf( valString,Field:: NMFIELD_MAX_STR_LENGTH, "%u", \
sField->value().toInt() ); + snprintf( valString, NMFIELD_MAX_STR_LENGTH, "%u", \
sField->value().toInt() ); }
}
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/gwfield.cpp \
#805328:805329 @@ -111,9 +111,6 @@
QLatin1String Field::NM_FIELD_TRUE ("1");
QLatin1String Field::NM_FIELD_FALSE ("0");
-uint Field::NM_PROTOCOL_VERSION = 5;
-uint Field::NMFIELD_MAX_STR_LENGTH = 32768;
-
/* === FieldList ==================================================== */
FieldList::~FieldList()
{
@@ -128,10 +125,10 @@
FieldListIterator FieldList::find( FieldListIterator &it, QLatin1String tag )
{
FieldListIterator theEnd = end();
- //cout << "FieldList::find() looking for " << tag.data() << endl;
+ //qDebug() << "FieldList::find() looking for " << tag << endl;
for ( ; it != theEnd; ++it )
{
- //cout << " - on " << (*it)->tag().data() << endl;
+ //qDebug() << " - on " << (*it)->tag() << endl;
if ( (*it)->tag() == tag )
break;
}
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/gwfield.h \
#805328:805329 @@ -75,7 +75,10 @@
#define NMFIELD_METHOD_NOT_ARRAY 40
#define NMFIELD_METHOD_OR_ARRAY 41
#define NMFIELD_METHOD_AND_ARRAY 42
+#define NM_PROTOCOL_VERSION 5
+#define NMFIELD_MAX_STR_LENGTH 32768
+
/* Attribute Names (field tags) */
namespace Field {
extern KOPETE_EXPORT QLatin1String NM_A_IP_ADDRESS;
@@ -156,10 +159,7 @@
extern KOPETE_EXPORT QLatin1String KOPETE_NM_USER_DETAILS_ARCHIVE_FLAG;
extern KOPETE_EXPORT QLatin1String KOPETE_NM_USER_DETAILS_FULL_NAME;
- extern KOPETE_EXPORT uint NM_PROTOCOL_VERSION;
- extern KOPETE_EXPORT uint NMFIELD_MAX_STR_LENGTH;
-
/**
* Fields are typed units of information interchanged between the groupwise server \
and its clients.
* In this implementation Fields are assumed to have a straight data flow from a \
Task to a socket and vice versa,
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/inputprotocolbase.cpp \
#805328:805329 @@ -38,9 +38,9 @@
void InputProtocolBase::debug( const QString &str )
{
#ifdef LIBGW_USE_KDEBUG
- kDebug() << "debug: " << str;
+ kDebug() << str;
#else
- qDebug( "GW RAW PROTO: %s\n", qPrintable(str) );
+ qDebug() << "GW RAW PROTO:" << qPrintable(str);
#endif
}
@@ -83,7 +83,7 @@
return false;
m_din >> val;
m_bytes += sizeof( quint32 );
- if ( val > Field::NMFIELD_MAX_STR_LENGTH )
+ if ( val > NMFIELD_MAX_STR_LENGTH )
return false;
//qDebug( "EventProtocol::safeReadBytes() - expecting %i bytes", val );
QByteArray temp( val, 0 );
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp \
#805328:805329 @@ -116,7 +116,7 @@
}
// find transaction id field and create Response object if nonzero
int tId = 0;
- int resultCode = 0;
+ int resultCode = -1;
Field::FieldListIterator it;
Field::FieldListIterator end = m_collatingFields.end();
it = m_collatingFields.find( Field::NM_A_SZ_TRANSACTION_ID );
@@ -155,6 +155,9 @@
else
{
debug( "- WARNING - NO TRANSACTION ID FOUND!" );
+ if ( resultCode == -1 ) {
+ debug( "- WARNING - NO RESULT CODE FOUND!" );
+ }
m_state = ProtocolError;
m_din.unsetDevice();
m_collatingFields.purge();
@@ -246,7 +249,7 @@
currentList.purge();
return false;
}
- if ( val > Field::NMFIELD_MAX_STR_LENGTH )
+ if ( val > NMFIELD_MAX_STR_LENGTH )
{
m_packetState = ProtocolError;
break;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic