src/cdrom/SDL_cdrom.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/cdrom/SDL_cdrom.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/cdrom/SDL_cdrom.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -49,12 +49,12 @@
     1.4  int SDL_numcds;
     1.5  
     1.6  int
     1.7 -SDL_CDROMInit (void)
     1.8 +SDL_CDROMInit(void)
     1.9  {
    1.10      int retval;
    1.11  
    1.12      SDL_numcds = 0;
    1.13 -    retval = SDL_SYS_CDInit ();
    1.14 +    retval = SDL_SYS_CDInit();
    1.15      if (retval == 0) {
    1.16          SDL_cdinitted = 1;
    1.17      }
    1.18 @@ -64,7 +64,7 @@
    1.19  
    1.20  /* Check to see if the CD-ROM subsystem has been initialized */
    1.21  static int
    1.22 -CheckInit (int check_cdrom, SDL_CD ** cdrom)
    1.23 +CheckInit(int check_cdrom, SDL_CD ** cdrom)
    1.24  {
    1.25      int okay;
    1.26  
    1.27 @@ -72,63 +72,63 @@
    1.28      if (check_cdrom && (*cdrom == NULL)) {
    1.29          *cdrom = default_cdrom;
    1.30          if (*cdrom == NULL) {
    1.31 -            SDL_SetError ("CD-ROM not opened");
    1.32 +            SDL_SetError("CD-ROM not opened");
    1.33              okay = 0;
    1.34          }
    1.35      }
    1.36      if (!SDL_cdinitted) {
    1.37 -        SDL_SetError ("CD-ROM subsystem not initialized");
    1.38 +        SDL_SetError("CD-ROM subsystem not initialized");
    1.39      }
    1.40      return (okay);
    1.41  }
    1.42  
    1.43  int
    1.44 -SDL_CDNumDrives (void)
    1.45 +SDL_CDNumDrives(void)
    1.46  {
    1.47 -    if (!CheckInit (0, NULL)) {
    1.48 +    if (!CheckInit(0, NULL)) {
    1.49          return (-1);
    1.50      }
    1.51      return (SDL_numcds);
    1.52  }
    1.53  
    1.54  const char *
    1.55 -SDL_CDName (int drive)
    1.56 +SDL_CDName(int drive)
    1.57  {
    1.58 -    if (!CheckInit (0, NULL)) {
    1.59 +    if (!CheckInit(0, NULL)) {
    1.60          return (NULL);
    1.61      }
    1.62      if (drive >= SDL_numcds) {
    1.63 -        SDL_SetError ("Invalid CD-ROM drive index");
    1.64 +        SDL_SetError("Invalid CD-ROM drive index");
    1.65          return (NULL);
    1.66      }
    1.67      if (SDL_CDcaps.Name) {
    1.68 -        return (SDL_CDcaps.Name (drive));
    1.69 +        return (SDL_CDcaps.Name(drive));
    1.70      } else {
    1.71          return ("");
    1.72      }
    1.73  }
    1.74  
    1.75  SDL_CD *
    1.76 -SDL_CDOpen (int drive)
    1.77 +SDL_CDOpen(int drive)
    1.78  {
    1.79      struct SDL_CD *cdrom;
    1.80  
    1.81 -    if (!CheckInit (0, NULL)) {
    1.82 +    if (!CheckInit(0, NULL)) {
    1.83          return (NULL);
    1.84      }
    1.85      if (drive >= SDL_numcds) {
    1.86 -        SDL_SetError ("Invalid CD-ROM drive index");
    1.87 +        SDL_SetError("Invalid CD-ROM drive index");
    1.88          return (NULL);
    1.89      }
    1.90 -    cdrom = (SDL_CD *) SDL_malloc (sizeof (*cdrom));
    1.91 +    cdrom = (SDL_CD *) SDL_malloc(sizeof(*cdrom));
    1.92      if (cdrom == NULL) {
    1.93 -        SDL_OutOfMemory ();
    1.94 +        SDL_OutOfMemory();
    1.95          return (NULL);
    1.96      }
    1.97 -    SDL_memset (cdrom, 0, sizeof (*cdrom));
    1.98 -    cdrom->id = SDL_CDcaps.Open (drive);
    1.99 +    SDL_memset(cdrom, 0, sizeof(*cdrom));
   1.100 +    cdrom->id = SDL_CDcaps.Open(drive);
   1.101      if (cdrom->id < 0) {
   1.102 -        SDL_free (cdrom);
   1.103 +        SDL_free(cdrom);
   1.104          return (NULL);
   1.105      }
   1.106      default_cdrom = cdrom;
   1.107 @@ -136,14 +136,14 @@
   1.108  }
   1.109  
   1.110  CDstatus
   1.111 -SDL_CDStatus (SDL_CD * cdrom)
   1.112 +SDL_CDStatus(SDL_CD * cdrom)
   1.113  {
   1.114      CDstatus status;
   1.115      int i;
   1.116      Uint32 position;
   1.117  
   1.118      /* Check if the CD-ROM subsystem has been initialized */
   1.119 -    if (!CheckInit (1, &cdrom)) {
   1.120 +    if (!CheckInit(1, &cdrom)) {
   1.121          return (CD_ERROR);
   1.122      }
   1.123  
   1.124 @@ -151,13 +151,13 @@
   1.125      cdrom->numtracks = 0;
   1.126      cdrom->cur_track = 0;
   1.127      cdrom->cur_frame = 0;
   1.128 -    status = SDL_CDcaps.Status (cdrom, &i);
   1.129 +    status = SDL_CDcaps.Status(cdrom, &i);
   1.130      position = (Uint32) i;
   1.131      cdrom->status = status;
   1.132  
   1.133      /* Get the table of contents, if there's a CD available */
   1.134 -    if (CD_INDRIVE (status)) {
   1.135 -        if (SDL_CDcaps.GetTOC (cdrom) < 0) {
   1.136 +    if (CD_INDRIVE(status)) {
   1.137 +        if (SDL_CDcaps.GetTOC(cdrom) < 0) {
   1.138              status = CD_ERROR;
   1.139          }
   1.140          /* If the drive is playing, get current play position */
   1.141 @@ -166,9 +166,9 @@
   1.142                  /* Keep looking */ ;
   1.143              }
   1.144  #ifdef DEBUG_CDROM
   1.145 -            fprintf (stderr,
   1.146 -                     "Current position: %d, track = %d (offset is %d)\n",
   1.147 -                     position, i - 1, cdrom->track[i - 1].offset);
   1.148 +            fprintf(stderr,
   1.149 +                    "Current position: %d, track = %d (offset is %d)\n",
   1.150 +                    position, i - 1, cdrom->track[i - 1].offset);
   1.151  #endif
   1.152              cdrom->cur_track = i - 1;
   1.153              position -= cdrom->track[cdrom->cur_track].offset;
   1.154 @@ -179,20 +179,20 @@
   1.155  }
   1.156  
   1.157  int
   1.158 -SDL_CDPlayTracks (SDL_CD * cdrom,
   1.159 -                  int strack, int sframe, int ntracks, int nframes)
   1.160 +SDL_CDPlayTracks(SDL_CD * cdrom,
   1.161 +                 int strack, int sframe, int ntracks, int nframes)
   1.162  {
   1.163      int etrack, eframe;
   1.164      int start, length;
   1.165  
   1.166      /* Check if the CD-ROM subsystem has been initialized */
   1.167 -    if (!CheckInit (1, &cdrom)) {
   1.168 +    if (!CheckInit(1, &cdrom)) {
   1.169          return (CD_ERROR);
   1.170      }
   1.171  
   1.172      /* Determine the starting and ending tracks */
   1.173      if ((strack < 0) || (strack >= cdrom->numtracks)) {
   1.174 -        SDL_SetError ("Invalid starting track");
   1.175 +        SDL_SetError("Invalid starting track");
   1.176          return (CD_ERROR);
   1.177      }
   1.178      if (!ntracks && !nframes) {
   1.179 @@ -207,7 +207,7 @@
   1.180          }
   1.181      }
   1.182      if (etrack > cdrom->numtracks) {
   1.183 -        SDL_SetError ("Invalid play length");
   1.184 +        SDL_SetError("Invalid play length");
   1.185          return (CD_ERROR);
   1.186      }
   1.187  
   1.188 @@ -217,7 +217,7 @@
   1.189          ++strack;
   1.190      }
   1.191      if (sframe >= (int) cdrom->track[strack].length) {
   1.192 -        SDL_SetError ("Invalid starting frame for track %d", strack);
   1.193 +        SDL_SetError("Invalid starting frame for track %d", strack);
   1.194          return (CD_ERROR);
   1.195      }
   1.196      while ((etrack > strack) &&
   1.197 @@ -225,7 +225,7 @@
   1.198          --etrack;
   1.199      }
   1.200      if (eframe > (int) cdrom->track[etrack].length) {
   1.201 -        SDL_SetError ("Invalid ending frame for track %d", etrack);
   1.202 +        SDL_SetError("Invalid ending frame for track %d", etrack);
   1.203          return (CD_ERROR);
   1.204      }
   1.205  
   1.206 @@ -242,37 +242,37 @@
   1.207  
   1.208      /* Play! */
   1.209  #ifdef DEBUG_CDROM
   1.210 -    fprintf (stderr, "Playing %d frames at offset %d\n", length, start);
   1.211 +    fprintf(stderr, "Playing %d frames at offset %d\n", length, start);
   1.212  #endif
   1.213 -    return (SDL_CDcaps.Play (cdrom, start, length));
   1.214 +    return (SDL_CDcaps.Play(cdrom, start, length));
   1.215  }
   1.216  
   1.217  int
   1.218 -SDL_CDPlay (SDL_CD * cdrom, int sframe, int length)
   1.219 +SDL_CDPlay(SDL_CD * cdrom, int sframe, int length)
   1.220  {
   1.221      /* Check if the CD-ROM subsystem has been initialized */
   1.222 -    if (!CheckInit (1, &cdrom)) {
   1.223 +    if (!CheckInit(1, &cdrom)) {
   1.224          return (CD_ERROR);
   1.225      }
   1.226  
   1.227 -    return (SDL_CDcaps.Play (cdrom, sframe, length));
   1.228 +    return (SDL_CDcaps.Play(cdrom, sframe, length));
   1.229  }
   1.230  
   1.231  int
   1.232 -SDL_CDPause (SDL_CD * cdrom)
   1.233 +SDL_CDPause(SDL_CD * cdrom)
   1.234  {
   1.235      CDstatus status;
   1.236      int retval;
   1.237  
   1.238      /* Check if the CD-ROM subsystem has been initialized */
   1.239 -    if (!CheckInit (1, &cdrom)) {
   1.240 +    if (!CheckInit(1, &cdrom)) {
   1.241          return (CD_ERROR);
   1.242      }
   1.243  
   1.244 -    status = SDL_CDcaps.Status (cdrom, NULL);
   1.245 +    status = SDL_CDcaps.Status(cdrom, NULL);
   1.246      switch (status) {
   1.247      case CD_PLAYING:
   1.248 -        retval = SDL_CDcaps.Pause (cdrom);
   1.249 +        retval = SDL_CDcaps.Pause(cdrom);
   1.250          break;
   1.251      default:
   1.252          retval = 0;
   1.253 @@ -282,20 +282,20 @@
   1.254  }
   1.255  
   1.256  int
   1.257 -SDL_CDResume (SDL_CD * cdrom)
   1.258 +SDL_CDResume(SDL_CD * cdrom)
   1.259  {
   1.260      CDstatus status;
   1.261      int retval;
   1.262  
   1.263      /* Check if the CD-ROM subsystem has been initialized */
   1.264 -    if (!CheckInit (1, &cdrom)) {
   1.265 +    if (!CheckInit(1, &cdrom)) {
   1.266          return (CD_ERROR);
   1.267      }
   1.268  
   1.269 -    status = SDL_CDcaps.Status (cdrom, NULL);
   1.270 +    status = SDL_CDcaps.Status(cdrom, NULL);
   1.271      switch (status) {
   1.272      case CD_PAUSED:
   1.273 -        retval = SDL_CDcaps.Resume (cdrom);
   1.274 +        retval = SDL_CDcaps.Resume(cdrom);
   1.275      default:
   1.276          retval = 0;
   1.277          break;
   1.278 @@ -304,21 +304,21 @@
   1.279  }
   1.280  
   1.281  int
   1.282 -SDL_CDStop (SDL_CD * cdrom)
   1.283 +SDL_CDStop(SDL_CD * cdrom)
   1.284  {
   1.285      CDstatus status;
   1.286      int retval;
   1.287  
   1.288      /* Check if the CD-ROM subsystem has been initialized */
   1.289 -    if (!CheckInit (1, &cdrom)) {
   1.290 +    if (!CheckInit(1, &cdrom)) {
   1.291          return (CD_ERROR);
   1.292      }
   1.293  
   1.294 -    status = SDL_CDcaps.Status (cdrom, NULL);
   1.295 +    status = SDL_CDcaps.Status(cdrom, NULL);
   1.296      switch (status) {
   1.297      case CD_PLAYING:
   1.298      case CD_PAUSED:
   1.299 -        retval = SDL_CDcaps.Stop (cdrom);
   1.300 +        retval = SDL_CDcaps.Stop(cdrom);
   1.301      default:
   1.302          retval = 0;
   1.303          break;
   1.304 @@ -327,31 +327,31 @@
   1.305  }
   1.306  
   1.307  int
   1.308 -SDL_CDEject (SDL_CD * cdrom)
   1.309 +SDL_CDEject(SDL_CD * cdrom)
   1.310  {
   1.311      /* Check if the CD-ROM subsystem has been initialized */
   1.312 -    if (!CheckInit (1, &cdrom)) {
   1.313 +    if (!CheckInit(1, &cdrom)) {
   1.314          return (CD_ERROR);
   1.315      }
   1.316 -    return (SDL_CDcaps.Eject (cdrom));
   1.317 +    return (SDL_CDcaps.Eject(cdrom));
   1.318  }
   1.319  
   1.320  void
   1.321 -SDL_CDClose (SDL_CD * cdrom)
   1.322 +SDL_CDClose(SDL_CD * cdrom)
   1.323  {
   1.324      /* Check if the CD-ROM subsystem has been initialized */
   1.325 -    if (!CheckInit (1, &cdrom)) {
   1.326 +    if (!CheckInit(1, &cdrom)) {
   1.327          return;
   1.328      }
   1.329 -    SDL_CDcaps.Close (cdrom);
   1.330 -    SDL_free (cdrom);
   1.331 +    SDL_CDcaps.Close(cdrom);
   1.332 +    SDL_free(cdrom);
   1.333      default_cdrom = NULL;
   1.334  }
   1.335  
   1.336  void
   1.337 -SDL_CDROMQuit (void)
   1.338 +SDL_CDROMQuit(void)
   1.339  {
   1.340 -    SDL_SYS_CDQuit ();
   1.341 +    SDL_SYS_CDQuit();
   1.342      SDL_cdinitted = 0;
   1.343  }
   1.344