Show
Ignore:
Timestamp:
03/21/17 15:43:24 (4 years ago)
Author:
jwoithe
Message:

configrom: there is no obvious reason why a space should be added to the end of the vendor and model strings returned from the interface. Retain the explicit null termination of these strings to cover for the case where an interface may not return any null bytes. Also fix indentation associated with the null termination code. The issue with the trailing space was noticed and reported by Nils Philippsen: its presence broke a test in the saffire_dice mixer python code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libieee1394/configrom.cpp

    r2673 r2677  
    177177                len ); 
    178178 
    179     while (*(buf + len - 1) == '\0') { 
    180             len--; 
     179        while (*(buf + len - 1) == '\0') { 
     180                len--; 
    181181        } 
    182         // \todo XXX seems a bit strage to do this but the nodemgr.c code does 
    183         // it. try to figure out why this is needed (or not) 
    184     buf[len++] = ' '; 
    185     buf[len] = '\0'; 
     182        // Ensure vendor string is null terminated 
     183        buf[len] = '\0'; 
    186184 
    187185 
     
    196194                ( void* )CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA( m_modelNameKv ), 
    197195                len ); 
    198     while (*(buf + len - 1) == '\0') { 
    199             len--; 
     196        while (*(buf + len - 1) == '\0') { 
     197                len--; 
    200198        } 
    201         // \todo XXX for edirol fa-66 it seems somehow broken. see above 
    202         // todo as well. 
    203     buf[len++] = ' '; 
    204     buf[len] = '\0'; 
     199        // Ensure model name string is null terminated 
     200        buf[len] = '\0'; 
    205201 
    206202        debugOutput( DEBUG_LEVEL_VERBOSE, "Model name: '%s'\n", buf);