/[svn]/liblscp/trunk/src/common.c
ViewVC logotype

Diff of /liblscp/trunk/src/common.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 963 by capela, Sun Dec 3 18:30:04 2006 UTC revision 977 by capela, Sun Dec 17 15:08:35 2006 UTC
# Line 213  lscp_status_t lscp_client_call ( lscp_cl Line 213  lscp_status_t lscp_client_call ( lscp_cl
213                                                  && pszBuffer[cchBuffer - 2] == '\r'                                                  && pszBuffer[cchBuffer - 2] == '\r'
214                                                  && (iResult < 1 || (cchBuffer >= 3                                                  && (iResult < 1 || (cchBuffer >= 3
215                                                                  && pszBuffer[cchBuffer - 3] == '.'))) {                                                                  && pszBuffer[cchBuffer - 3] == '.'))) {
216                                                  // Get rid of the trailing dot and CRLF anyway...                                                  // Get rid of the trailling dot and CRLF anyway...
217                                                  while (cchBuffer > 0 && (                                                  while (cchBuffer > 0 && (
218                                                          pszBuffer[cchBuffer - 1] == '\r' ||                                                          pszBuffer[cchBuffer - 1] == '\r' ||
219                                                          pszBuffer[cchBuffer - 1] == '\n' ||                                                          pszBuffer[cchBuffer - 1] == '\n' ||
# Line 225  lscp_status_t lscp_client_call ( lscp_cl Line 225  lscp_status_t lscp_client_call ( lscp_cl
225                                  }                                  }
226                                  // The result string is now set to the command response, if any.                                  // The result string is now set to the command response, if any.
227                          } else {                          } else {
228                                    // Get rid of the CRLF anyway...
229                                    while (cchBuffer > 0 && (
230                                            achBuffer[cchBuffer - 1] == '\r' ||
231                                            achBuffer[cchBuffer - 1] == '\n'))
232                                            achBuffer[--cchBuffer] = (char) 0;
233                                  // Parse the error/warning message, skip first colon...                                  // Parse the error/warning message, skip first colon...
234                                  pszToken = lscp_strtok(achBuffer, pszSeps, &(pch));                                  pszToken = lscp_strtok(achBuffer, pszSeps, &(pch));
235                                  if (pszToken) {                                  if (pszToken) {
# Line 749  lscp_midi_instrument_t *lscp_midi_instru Line 754  lscp_midi_instrument_t *lscp_midi_instru
754                  case '{':                  case '{':
755                          pchHead = pch + 1;                          pchHead = pch + 1;
756                          if (k == 0) {                          if (k == 0) {
757                                  pInstrs[i].bank_msb = atoi(pchHead);                                  pInstrs[i].map = atoi(pchHead);
758                                  k++;                                  k++;
759                          }                          }
760                          break;                          break;
761                  case ',':                  case ',':
762                          pchHead = pch + 1;                          pchHead = pch + 1;
763                          if (k == 1) {                          if (k == 1) {
764                                  pInstrs[i].bank_lsb = atoi(pchHead);                                  pInstrs[i].bank = atoi(pchHead);
765                                  k++;                                  k++;
766                          }                          }
767                          else                          else
768                          if (k == 2) {                          if (k == 2) {
769                                  pInstrs[i].program = atoi(pchHead);                                  pInstrs[i].prog = atoi(pchHead);
770                                  k++;                                  k++;
771                          }                          }
772                          break;                          break;
# Line 778  lscp_midi_instrument_t *lscp_midi_instru Line 783  lscp_midi_instrument_t *lscp_midi_instru
783                          pNewInstrs = (lscp_midi_instrument_t *) malloc(iSize * sizeof(lscp_midi_instrument_t));                          pNewInstrs = (lscp_midi_instrument_t *) malloc(iSize * sizeof(lscp_midi_instrument_t));
784                          if (pNewInstrs) {                          if (pNewInstrs) {
785                                  for (j = 0; j < i; j++) {                                  for (j = 0; j < i; j++) {
786                                          pNewInstrs[j].bank_msb = pInstrs[j].bank_msb;                                          pNewInstrs[j].map  = pInstrs[j].map;
787                                          pNewInstrs[j].bank_lsb = pInstrs[j].bank_lsb;                                          pNewInstrs[j].bank = pInstrs[j].bank;
788                                          pNewInstrs[j].program  = pInstrs[j].program;                                          pNewInstrs[j].prog = pInstrs[j].prog;
789                                  }                                  }
790                                  free(pInstrs);                                  free(pInstrs);
791                                  pInstrs = pNewInstrs;                                  pInstrs = pNewInstrs;
# Line 790  lscp_midi_instrument_t *lscp_midi_instru Line 795  lscp_midi_instrument_t *lscp_midi_instru
795                    
796          // Special terminate split array.          // Special terminate split array.
797          for ( ; i < iSize; i++) {          for ( ; i < iSize; i++) {
798                  pInstrs[i].bank_msb = -1;                  pInstrs[i].map  = -1;
799                  pInstrs[i].bank_lsb = -1;                  pInstrs[i].bank = -1;
800                  pInstrs[i].program  = -1;                  pInstrs[i].prog = -1;
801          }          }
802                    
803          return pInstrs;          return pInstrs;
# Line 830  int lscp_midi_instruments_size ( lscp_mi Line 835  int lscp_midi_instruments_size ( lscp_mi
835    
836  void lscp_server_info_init ( lscp_server_info_t *pServerInfo )  void lscp_server_info_init ( lscp_server_info_t *pServerInfo )
837  {  {
838          pServerInfo->description = NULL;          pServerInfo->description      = NULL;
839          pServerInfo->version     = NULL;          pServerInfo->version          = NULL;
840            pServerInfo->protocol_version = NULL;
841  }  }
842    
843  void lscp_server_info_free ( lscp_server_info_t *pServerInfo )  void lscp_server_info_free ( lscp_server_info_t *pServerInfo )
# Line 840  void lscp_server_info_free ( lscp_server Line 846  void lscp_server_info_free ( lscp_server
846                  free(pServerInfo->description);                  free(pServerInfo->description);
847          if (pServerInfo->version)          if (pServerInfo->version)
848                  free(pServerInfo->version);                  free(pServerInfo->version);
849            if (pServerInfo->protocol_version)
850                    free(pServerInfo->protocol_version);
851  }  }
852    
853  void lscp_server_info_reset ( lscp_server_info_t *pServerInfo )  void lscp_server_info_reset ( lscp_server_info_t *pServerInfo )
# Line 889  void lscp_channel_info_init ( lscp_chann Line 897  void lscp_channel_info_init ( lscp_chann
897          pChannelInfo->midi_device       = 0;          pChannelInfo->midi_device       = 0;
898          pChannelInfo->midi_port         = 0;          pChannelInfo->midi_port         = 0;
899          pChannelInfo->midi_channel      = 0;          pChannelInfo->midi_channel      = 0;
900            pChannelInfo->midi_map          = 0;
901          pChannelInfo->volume            = 0.0;          pChannelInfo->volume            = 0.0;
902          pChannelInfo->mute              = 0;          pChannelInfo->mute              = 0;
903          pChannelInfo->solo              = 0;          pChannelInfo->solo              = 0;

Legend:
Removed from v.963  
changed lines
  Added in v.977

  ViewVC Help
Powered by ViewVC