alpine 3.6
obsolete weakness #55

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

libcaca/src/libcaca-0.99.beta19/caca/time.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 obsolete weakness.

 #include "config.h"

#if !defined(__KERNEL__)
#   include <stdlib.h>
#   if defined(HAVE_SYS_TIME_H)
#       include <sys/time.h>
#   endif
#   include <time.h>
#   if defined(USE_WIN32)
#       include <windows.h>
#   endif
#   if defined(HAVE_UNISTD_H)
#       include <unistd.h>
#   endif
#endif

#include "caca.h"
#include "caca_internals.h"

void _caca_sleep(int usec)
{
#if defined(HAVE_SLEEP)
    Sleep((usec + 500) / 1000);
#elif defined(HAVE_USLEEP)
    usleep(usec);
#else
    /* SLEEP */
#endif
}

int _caca_getticks(caca_timer_t *timer)
{
#if defined(USE_WIN32)
    LARGE_INTEGER tmp;
    static double freq = -1.0; /* FIXME: can this move to caca_context? */
    double seconds;
#elif defined(HAVE_GETTIMEOFDAY)
    struct timeval tv;
#endif
    int ticks = 0;
    int new_sec, new_usec;

#if defined(USE_WIN32)
    if (freq < 0.0)
    {
        if(!QueryPerformanceFrequency(&tmp))
            freq = 0.0;
        else
            freq = 1.0 / (double)tmp.QuadPart;
    } 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.