Changeset 441

Show
Ignore:
Timestamp:
08/26/09 18:35:43 (15 years ago)
Author:
bhilburn
Message:

Mostly style fixes. Changing over some fprintf's to use the proper
MACRO.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/service_management_layer/ServiceManagementLayer.cpp

    r439 r441  
    3939#include <netdb.h> 
    4040#include <fcntl.h> 
     41#include <sqlite3.h> 
    4142#include <sys/ioctl.h> 
    4243#include <sys/mman.h> 
     
    4748#include "tinyxml/tinyxml.h" 
    4849#include "tinyxml/tinystr.h" 
    49  
    50 #include <sqlite3.h> 
    5150 
    5251#include "vtcross/debug.h" 
     
    8483bool shellFound; 
    8584 
    86 //Callback function used internally by some of the SQLite3 commands 
    87 int callback(void *notUsed, int argc, char **argv, char **azColName){ 
    88     int i; 
    89     for(i=0; i<argc; i++){ 
     85/* Callback function used internally by some of the SQLite3 commands */ 
     86int32_t  
     87callback(void *notUsed, int32_t argc, char **argv, char **azColName) 
     88{ 
     89    for(size_t i = 0; i < argc; i++) { 
    9090        printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); 
    9191    } 
     92 
    9293    printf("\n"); 
    9394    return 0; 
    9495} 
    9596 
    96  
    97  
    9897ServiceManagementLayer::ServiceManagementLayer() 
    9998{ 
    10099    LOG("Creating Service Management Layer.\n"); 
     100 
    101101    shellSocketFD = -1; 
    102102    numberOfCognitiveEngines = 0; 
     
    105105} 
    106106 
    107 //Free and clear the DB's associated with this SML in the destructor 
    108 //Note that exiting with an error condition will cause SML to not be destructed, 
    109 // resulting in the DB's staying in memory until the destructor is encountered in future executions 
     107/* Free and clear the DB's associated with this SML in the destructor. 
     108 * 
     109 * Note that exiting with an error condition will cause SML to not be destructed, 
     110 * resulting in the DB's staying in memory until the destructor is encountered in  
     111 * future executions. */ 
    110112ServiceManagementLayer::~ServiceManagementLayer() 
    111113{ 
    112114    char *errorMsg; 
     115    int32_t rc;         /* sqlite command return code */ 
     116 
    113117    _services_DB->command="drop table "; 
    114118    _services_DB->command.append(_services_DB->tablename); 
    115     int rc = sqlite3_exec(_services_DB->db, _services_DB->command.c_str(), callback, 0, &errorMsg); 
    116     if( rc!=SQLITE_OK && rc!=101 ) 
    117         fprintf(stderr, "ServiceManagementLayer::Destructor services 'drop table' error: %s\n", errorMsg); 
     119    rc = sqlite3_exec(_services_DB->db, _services_DB->command.c_str(), callback, 0, &errorMsg); 
     120    if((rc != SQLITE_OK) && (rc != 101)) 
     121        WARNING("ServiceManagementLayer::Destructor services 'drop table' error: %s\n", errorMsg); 
     122 
    118123    _services_DB->command="vacuum"; 
    119124    rc = sqlite3_exec(_services_DB->db, _services_DB->command.c_str(), callback, 0, &errorMsg); 
    120     if( rc!=SQLITE_OK && rc!=101 ) 
    121         fprintf(stderr, "ServiceManagementLayer::Destructor services 'vacuum' error: %s\n", errorMsg); 
     125    if((rc != SQLITE_OK) && (rc != 101)) 
     126        WARNING("ServiceManagementLayer::Destructor services 'vacuum' error: %s\n", errorMsg); 
     127 
    122128    free(_services_DB); 
    123129 
     
    125131    _data_DB->command.append(_data_DB->tablename); 
    126132    rc = sqlite3_exec(_data_DB->db, _data_DB->command.c_str(), callback, 0, &errorMsg); 
    127     if( rc!=SQLITE_OK && rc!=101 ) 
    128         fprintf(stderr, "ServiceManagementLayer::Destructor data 'drop table' error: %s\n", errorMsg); 
     133    if((rc != SQLITE_OK) && (rc != 101)) 
     134        WARNING("ServiceManagementLayer::Destructor data 'drop table' error: %s\n", errorMsg); 
     135 
    129136    _data_DB->command="vacuum"; 
    130137    rc = sqlite3_exec(_data_DB->db, _data_DB->command.c_str(), callback, 0, &errorMsg); 
    131     if( rc!=SQLITE_OK && rc!=101 ) 
    132         fprintf(stderr, "ServiceManagementLayer::Destructor data 'vacuum' error: %s\n", errorMsg); 
     138    if((rc != SQLITE_OK) && (rc != 101)) 
     139        WARNING("ServiceManagementLayer::Destructor data 'vacuum' error: %s\n", errorMsg); 
     140 
    133141    free(_data_DB); 
    134142}