simplify name update logic

This commit is contained in:
Chris Danford
2004-05-03 00:34:54 +00:00
parent d30a6fe77b
commit bfd7b1930c
7 changed files with 32 additions and 37 deletions
@@ -15,6 +15,7 @@ struct UsbStorageDevice
sScsiDevice = "";
sSerial = "";
sOsMountDir = "";
sName = "";
};
int iBus;
int iPort;
@@ -30,13 +31,14 @@ struct UsbStorageDevice
bool operator==(const UsbStorageDevice& other) const
{
if( (iBus!=-1 || other.iBus!=-1) && iBus != other.iBus )
return false;
if( (iPort!=-1 || other.iPort!=-1) && iPort != other.iPort )
return false;
if( (iLevel!=-1 || other.iLevel!=-1) && iLevel != other.iLevel )
return false;
return sOsMountDir==other.sOsMountDir; // every time a device is plugged in, it gets a unique device number
#define COMPARE(x) if( x != other.x ) return false;
COMPARE( iBus );
COMPARE( iPort );
COMPARE( iLevel );
COMPARE( sName );
COMPARE( sOsMountDir );
return true;
#undef COMPARE
}
bool operator!=(const UsbStorageDevice& other) const
{