Ignore:
Timestamp:
Oct 4, 2023, 6:18:02 PM (23 months ago)
Author:
gyoung
Message:

Fix all the warnings and errors reported by CPPCheck.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/classes/idl/idl_audio/cwaudio.c

    r93 r108  
    266266      WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3ALBUM),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)30),0);
    267267      WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3COMMENT),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)30),0);
    268       WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3YEAR),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)4)-1),0);
     268      WinSendMsg(WinWindowFromID(hwnd,IDEF_ID3YEAR),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)4),0);
    269269#endif     
    270270      /* Fill drop downlist with knwon genres */
     
    977977                   
    978978              if(_somIsA(thisPtr, mmMIDIClass))
    979                 strncpy(chrDevice,"SEQUENCER", sizeof(chrDevice));
     979                strncpy(chrDevice,"SEQUENCER", sizeof(chrDevice) - 1);
    980980              else
    981                 strncpy(chrDevice,"WAVEAUDIO", sizeof(chrDevice));
     981                strncpy(chrDevice,"WAVEAUDIO", sizeof(chrDevice) - 1);
    982982                   
    983983              ulNameSize=sizeof(name);
     
    985985                   
    986986              /* Start audio file */ 
    987               sprintf(chrCommand,"open \"%s\"  type %s alias wave%d SHAREABLE wait",name, chrDevice, thisPtr);
     987              sprintf(chrCommand,"open \"%s\"  type %s alias wave%p SHAREABLE wait",name, chrDevice, thisPtr);
    988988              rc = mciSendString( chrCommand, retMsg, sizeof(retMsg), hwnd, 0);
    989989              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    993993                   
    994994              /* Set time format */
    995               sprintf(chrCommand,"SET wave%d TIME FORMAT MILLISECONDS wait", thisPtr);
     995              sprintf(chrCommand,"SET wave%p TIME FORMAT MILLISECONDS wait", thisPtr);
    996996              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    997997              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    10001000              }
    10011001                   
    1002               sprintf(chrCommand,"STATUS wave%d LENGTH WAIT", thisPtr);
     1002              sprintf(chrCommand,"STATUS wave%p LENGTH WAIT", thisPtr);
    10031003              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    10041004              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    10091009              iTime=atoi(retMsg);
    10101010                   
    1011               //   sprintf(chrCommand,"SETPOSITIONADVISE wave%d ON EVERY %d NOTIFY", thisPtr, 3000);
     1011              //   sprintf(chrCommand,"SETPOSITIONADVISE wave%p ON EVERY %d NOTIFY", thisPtr, 3000);
    10121012              //   rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), hwnd, 0);
    10131013                   
     
    10201020                iTime=100;
    10211021                   
    1022               sprintf(chrCommand,"SETCUEPOINT wave%d ON at %d WAIT", thisPtr, iTime);
     1022              sprintf(chrCommand,"SETCUEPOINT wave%p ON at %d WAIT", thisPtr, iTime);
    10231023              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), hwnd, 0);
    10241024              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    10281028               
    10291029              /* Set volume */
    1030               sprintf(chrCommand,"SET wave%d AUDIO VOLUME %d wait", thisPtr, globalClassVolume);
     1030              sprintf(chrCommand,"SET wave%p AUDIO VOLUME %d wait", thisPtr, globalClassVolume);
    10311031              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    10321032              /* Not able to set the volume isn't that bad so don't quit in case of an error. */
     
    10401040              WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, 1, 100);
    10411041                   
    1042               sprintf(chrCommand,"play wave%d ", thisPtr);
     1042              sprintf(chrCommand,"play wave%p ", thisPtr);
    10431043              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    10441044              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    10801080
    10811081                    /* Set volume */
    1082                     sprintf(chrCommand,"SET wave%d AUDIO VOLUME %d ", thisPtr, globalClassVolume);
     1082                    sprintf(chrCommand,"SET wave%p AUDIO VOLUME %d ", thisPtr, globalClassVolume);
    10831083                    mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    10841084                    /* Not able to set the volume isn't that bad so don't quit in case of an error. */
     
    10951095                    WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1 );
    10961096                   
    1097                     sprintf(chrCommand,"stop wave%d wait", thisPtr);
     1097                    sprintf(chrCommand,"stop wave%p wait", thisPtr);
    10981098                    mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    10991099                   
    1100                     sprintf(chrCommand,"close wave%d wait", thisPtr);
     1100                    sprintf(chrCommand,"close wave%p wait", thisPtr);
    11011101                    mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    11021102                   
     
    11141114                    // CWMMDataFileData *mmdf_somThis = CWMMDataFileGetData(thisPtr);                 
    11151115                   
    1116                     sprintf(chrCommand,"STATUS wave%d MODE WAIT", thisPtr);
     1116                    sprintf(chrCommand,"STATUS wave%p MODE WAIT", thisPtr);
    11171117                    rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    11181118                    if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    11231123                    if(!stricmp(retMsg, "playing"))
    11241124                      {
    1125                         sprintf(chrCommand,"PAUSE wave%d wait", thisPtr);
     1125                        sprintf(chrCommand,"PAUSE wave%p wait", thisPtr);
    11261126                        rc=mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    11271127                        if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    11421142                    //  CWMMDataFileData *mmdf_somThis = CWMMDataFileGetData(thisPtr);
    11431143                   
    1144                     sprintf(chrCommand,"STATUS wave%d MODE WAIT", thisPtr);
     1144                    sprintf(chrCommand,"STATUS wave%p MODE WAIT", thisPtr);
    11451145                    rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    11461146                    if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    11511151                    if(!stricmp(retMsg, "paused"))
    11521152                      {
    1153                         sprintf(chrCommand,"RESUME wave%d wait", thisPtr);
     1153                        sprintf(chrCommand,"RESUME wave%p wait", thisPtr);
    11541154                        rc=mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    11551155                        if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    11911191          }
    11921192          /* Get current play position */
    1193           sprintf(chrCommand,"STATUS wave%d POSITION WAIT", thisPtr);
     1193          sprintf(chrCommand,"STATUS wave%p POSITION WAIT", thisPtr);
    11941194          rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    11951195          if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    12401240          char retMsg[20];
    12411241
    1242           sprintf(chrCommand,"STATUS wave%d MODE WAIT", thisPtr);
     1242          sprintf(chrCommand,"STATUS wave%p MODE WAIT", thisPtr);
    12431243          do {
    12441244            APIRET rc;
     
    32603260              //              HlpWriteToTrapLog("File: %s\n",  fName);
    32613261              /* open the file */
    3262               sprintf(chrCommand,"open \"%s\"  type SEQUENCER alias wave%d SHAREABLE wait",fName,  somSelf);
     3262              sprintf(chrCommand,"open \"%s\"  type SEQUENCER alias wave%p SHAREABLE wait",fName,  somSelf);
    32633263              rc = mciSendString( chrCommand, retMsg, sizeof(retMsg), NULLHANDLE, 0);
    32643264              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
     
    32673267
    32683268              /* Set time format */
    3269               sprintf(chrCommand,"SET wave%d TIME FORMAT MILLISECONDS wait", somSelf);
     3269              sprintf(chrCommand,"SET wave%p TIME FORMAT MILLISECONDS wait", somSelf);
    32703270              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    32713271              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
    32723272                /* close the file */
    3273                 sprintf(chrCommand,"close wave%d wait", somSelf);
     3273                sprintf(chrCommand,"close wave%p wait", somSelf);
    32743274                mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    32753275                break;
     
    32773277
    32783278              /* Get midi info */
    3279               sprintf(chrCommand,"STATUS wave%d LENGTH WAIT", somSelf);
     3279              sprintf(chrCommand,"STATUS wave%p LENGTH WAIT", somSelf);
    32803280              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    32813281              if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
    32823282                /* close the file */
    3283                 sprintf(chrCommand,"close wave%d wait", somSelf);
     3283                sprintf(chrCommand,"close wave%p wait", somSelf);
    32843284                mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    32853285                break;
     
    32983298
    32993299              //              HlpWriteToTrapLog("Midi-Time ulPlaySecs: %d\n", _ulPlaySecs);
    3300               sprintf(chrCommand,"STATUS wave%d NUMBER OF TRACKS WAIT", somSelf);
     3300              sprintf(chrCommand,"STATUS wave%p NUMBER OF TRACKS WAIT", somSelf);
    33013301              rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    33023302              if((rc & 0x0000ffff)==MCIERR_SUCCESS) {
     
    33063306
    33073307              /* close the file */
    3308               sprintf(chrCommand,"close wave%d wait", somSelf);
     3308              sprintf(chrCommand,"close wave%p wait", somSelf);
    33093309              mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
    33103310            }/* else is MMMIDI */
Note: See TracChangeset for help on using the changeset viewer.