bugCompact Disc Input and Control Library - Bugs: bug #28543, Invalid call to Sleep() in...

 
 

bug #28543: Invalid call to Sleep() in example/cdchange.c

Submitted by:  -Deleted Account- <lrn>
Submitted on:  Sun 10 Jan 2010 03:54:35 PM UTC  
 
Category: compilationSeverity: 5 - Average
Item Group: example programsStatus: Fixed
Privacy: PublicAssigned to: Rocky Bernstein <rocky>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 12 Feb 2010 01:14:27 AM UTC, comment #1:

I have taken your suggestion and use usleep now instead of slee

A revised cdchange.c should now be in git.

Thanks for the report, discussion and fix.

Rocky Bernstein <rocky>
Project AdministratorIn charge of this item.
Sun 10 Jan 2010 03:54:35 PM UTC, original submission:

#ifndef HAVE_SLEEP
static void
sleep(unsigned int ms)
{
#if defined(_WIN32)
Sleep(ms);
#else
#error sleep() unimplemented
#endif
}
#endif

If you intended to use http://msdn.microsoft.com/en-us/library/ms686298%28VS.85%29.aspx , then you forgot to include windows.h
Note, that
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
doesn't work, because HAVE_WINDOWS_H is only defined in config.h which is not available to an example application (and should not be - config.h is internal for the library and not the part of public API). Consider using #ifdef MSC_VER (for MSVC) and/or #ifdef (__MINGW32_) (for MinGW)

However, it is easily fixable - just use usleep() instead. At least, MinGW does have implementation of that function (and who cares about MSVC?)

-Deleted Account- <lrn>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rocky (Posted a comment)
  • -unavailable- added by lrn (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 12 Feb 2010 01:14:27 AM UTCrockyItem GroupNone=>example programs
      StatusNone=>Fixed
      Assigned toNone=>rocky
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1