Changeset 263

Show
Ignore:
Timestamp:
06/26/08 01:57:21 (4 months ago)
Author:
mattn
Message:

* removed config.mk (not used)
* fixed some warnings in synapse.cpp (const stuff, unused variable)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • GtkRadiant/trunk/libs/synapse/synapse.cpp

    r185 r263  
    4040{ 
    4141 
    42 static PFN_SYN_PRINTF_VA g_pPrintf = NULL;   
    43    
     42static PFN_SYN_PRINTF_VA g_pPrintf = NULL; 
     43 
    4444void Set_Syn_Printf(PFN_SYN_PRINTF_VA pf) 
    4545{ 
     
    5353  char buf[BUFFER_SIZE]; 
    5454  va_list args; 
    55    
     55 
    5656  if (!text) 
    5757    return; 
    58    
     58 
    5959  if (g_pPrintf) 
    6060  { 
     
    117117{ 
    118118  // browse the paths to locate all potential modules 
    119    
     119 
    120120  Set_Syn_Printf(pf); 
    121    
     121 
    122122  if (conf_file) 
    123123  { 
     
    129129      Syn_Printf("'%s' invalid/not found\n", conf_file); 
    130130      return false; 
    131     }     
     131    } 
    132132  } 
    133133 
     
    160160        Str newModule; 
    161161        newModule.Format("%s%s", path, name); 
    162         Syn_Printf("Found '%s'\n", newModule.GetBuffer());       
     162        Syn_Printf("Found '%s'\n", newModule.GetBuffer()); 
    163163        EnumerateInterfaces(newModule); 
    164164      } 
     
    170170} 
    171171 
    172 #if defined(_WIN32)   
     172#if defined(_WIN32) 
    173173#define FORMAT_BUFSIZE 2048 
    174174const char* CSynapseServer::FormatGetLastError() 
     
    176176  static char buf[FORMAT_BUFSIZE]; 
    177177  FormatMessage( 
    178     FORMAT_MESSAGE_FROM_SYSTEM |  
     178    FORMAT_MESSAGE_FROM_SYSTEM | 
    179179    FORMAT_MESSAGE_IGNORE_INSERTS, 
    180180    NULL, 
     
    183183    buf, 
    184184    FORMAT_BUFSIZE, 
    185     NULL  
     185    NULL 
    186186  ); 
    187187  return buf; 
     
    240240  CSynapseClientSlot slot; 
    241241  slot.mpDLL = dlopen (soname.GetBuffer(), RTLD_NOW); 
    242   PFN_SYNAPSE_ENUMERATEINTERFACES *pEnumerate; 
    243242  if (!slot.mpDLL) 
    244243  { 
    245     char* error; 
     244    const char* error; 
    246245    if ((error = (char *)dlerror()) == NULL) 
    247246      error = "Unknown"; 
     
    252251  if (!slot.mpEnumerate) 
    253252  { 
    254     char* error; 
     253    const char* error; 
    255254    if ((error = (char *)dlerror()) == NULL) 
    256255      error = "Unknown"; 
     
    265264    if (dlclose(slot.mpDLL)) 
    266265    { 
    267       char* error; 
     266      const char* error; 
    268267      if ((error = (char *)dlerror()) == NULL) 
    269268        error = "Unknown"; 
     
    286285  if (dlclose(mpDLL)) 
    287286  { 
    288     char* error; 
     287    const char* error; 
    289288    if ((error = (char *)dlerror()) == NULL) 
    290289      error = "Unknown"; 
     
    320319    } 
    321320  } 
    322   mStack.push_front(pAPI);       
    323   mbStackChanged = true;   
     321  mStack.push_front(pAPI); 
     322  mbStackChanged = true; 
    324323} 
    325324 
     
    374373          } 
    375374        } 
    376       }       
     375      } 
    377376      else if (pAPI->mType == SYN_PROVIDE) 
    378377      { 
     
    390389  { 
    391390    pClientSlot->ReleaseSO(); 
    392   }   
     391  } 
    393392  return mClients.erase(iSlot); 
    394393} 
     
    397396{ 
    398397  /* walk through the standard APIs and push them in */ 
    399   int i,max = pClient->GetAPICount();   
     398  int i,max = pClient->GetAPICount(); 
    400399  for(i=0; i<max; i++) 
    401400  { 
     
    406405    } 
    407406  } 
    408    
     407 
    409408  /* if this client has 'List' API Manager types, walk through them for addition too */ 
    410409  max = pClient->GetManagerListCount(); 
     
    420419    } 
    421420  } 
    422    
     421 
    423422  /* if there are loose match managers, prompt them against the current list of SYN_PROVIDE interfaces 
    424423   * and let them decide which ones they might want 
    425424   */ 
    426    
     425 
    427426  max = pClient->GetManagerMatchCount(); 
    428427 
     
    481480bool CSynapseServer::ResolveAPI(APIDescriptor_t* pAPI) 
    482481{ 
    483   //Syn_Printf("In ResolveAPI %s %p '%s' '%s'\n", APITypeName[pAPI->mType], pAPI, pAPI->major_name, pAPI->minor_name);   
     482  //Syn_Printf("In ResolveAPI %s %p '%s' '%s'\n", APITypeName[pAPI->mType], pAPI, pAPI->major_name, pAPI->minor_name); 
    484483  // loop through active clients, search for a client providing what we are looking for 
    485484  list<CSynapseClientSlot>::iterator iClient; 
     
    532531        } 
    533532      } 
    534     }   
     533    } 
    535534  } 
    536535  return false; 
     
    561560  } 
    562561 
    563   // push the interfaces that need to be resolved for this client   
     562  // push the interfaces that need to be resolved for this client 
    564563  // NOTE: this doesn't take care of the SYN_REQUIRE_ANY interfaces 
    565564  PushRequired(pClient); 
     
    574573    if (!mbStackChanged) 
    575574    { 
    576       // the stack didn't change last loop  
     575      // the stack didn't change last loop 
    577576      iCurrent++; 
    578577      if (iCurrent==mStack.end()) 
     
    606605{ 
    607606  bool ret = DoResolve(pClient); 
    608   list<CSynapseClientSlot>::iterator iClient;   
     607  list<CSynapseClientSlot>::iterator iClient; 
    609608  iClient = mClients.begin(); 
    610609  while(iClient != mClients.end()) 
     
    627626  // do a first pass to shutdown the clients nicely (i.e. decref, release memory and drop everything) 
    628627  // we seperate the client shutdown calls from the dlclose cause that part is a clean decref / free situation whereas dlclose will break links without advice 
    629   list<CSynapseClientSlot>::iterator iClient;   
     628  list<CSynapseClientSlot>::iterator iClient; 
    630629  iClient = mClients.begin(); 
    631630  for(iClient = mClients.begin(); iClient != mClients.end(); iClient++) 
    632631  { 
    633632    (*iClient).mpClient->Shutdown(); 
    634   }   
     633  } 
    635634  // now release them from the server's point of view 
    636635  iClient = mClients.begin(); 
     
    638637  { 
    639638    iClient = ShutdownClient(iClient); 
    640   }   
     639  } 
    641640} 
    642641 
     
    653652void CSynapseServer::DumpActiveClients() 
    654653{ 
    655   list<CSynapseClientSlot>::iterator iClient;   
     654  list<CSynapseClientSlot>::iterator iClient; 
    656655  for(iClient=mClients.begin(); iClient!=mClients.end(); iClient++) 
    657656  { 
     
    714713      return true; 
    715714    } 
    716     mpFocusedNode = mpFocusedNode->next;     
     715    mpFocusedNode = mpFocusedNode->next; 
    717716  } 
    718717  return false; 
     
    875874  } 
    876875  else if (type == SYN_REQUIRE) 
    877   {     
     876  { 
    878877    if (size != 0) 
    879878    { 
     
    898897    return false; 
    899898  } 
    900   mAPIDescriptors.push_back(pAPI);   
     899  mAPIDescriptors.push_back(pAPI); 
    901900  #ifdef SYNAPSE_VERBOSE 
    902901    Syn_Printf("AddAPI: %s %p '%s' '%s' from '%s', size %d\n", APITypeName[pAPI->mType], pAPI, major, minor, GetInfo(), pAPI->mSize); 
     
    942941 
    943942bool CSynapseClient::ConfigXML( CSynapseServer *pServer, const char *client_name, const XMLConfigEntry_t entries[] ) { 
    944    
     943 
    945944  if ( !client_name ) { 
    946945    client_name = GetName(); 
    947946  } 
    948    
     947 
    949948  Syn_Printf("Dynamic APIs for client '%s'\n", GetInfo()); 
    950949  if ( !pServer->SelectClientConfig( client_name ) ) 
     
    953952    return false; 
    954953  } 
    955    
     954 
    956955  int i = 0; 
    957956  while ( entries[i].type != SYN_UNKNOWN ) { // don't test pTable, for a SYN_PROVIDE it will be empty 
     
    10291028{ 
    10301029  assert(mType == API_MATCH); 
    1031    
     1030 
    10321031  /*! 
    10331032  if this interface has been allocated already, avoid requesting it again.. 
     
    10391038      return false; 
    10401039  } 
    1041    
     1040 
    10421041  if (!strcmp(major, major_pattern)) 
    10431042    return true; 
     
    10631062  char minor_tok[MAX_PATTERN_STRING]; 
    10641063  char *token; 
    1065    
     1064 
    10661065  if (mAPIs.size()) 
    10671066  { 
     
    10691068    return; 
    10701069  } 
    1071    
     1070 
    10721071  strncpy(minor_tok, minor_pattern, MAX_PATTERN_STRING); 
    10731072  token = strtok(minor_tok, " "); 
     
    10851084  } 
    10861085} 
    1087    
     1086 
    10881087int CSynapseAPIManager::GetAPICount() 
    10891088{