mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
Conditionally use register keyword for backward compatibility;
remove for C++17 and later where it is not allowed.
Origin commit data
------------------
Branch: ni/coolstream
Commit: c72cdb8612
Author: Thilo Graf <dbt@novatux.de>
Date: 2024-09-02 (Mon, 02 Sep 2024)
------------------
This commit was generated by Migit
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
/*
|
|
* radiotools.c: A plugin for the Video Disk Recorder
|
|
*
|
|
* See the README file for copyright information and how to reach the author.
|
|
*
|
|
* This is a "plugin" for the Video Disk Recorder (VDR).
|
|
*
|
|
* Written by: Lars Tegeler <email@host.dom>
|
|
*
|
|
* Project's homepage: www.math.uni-paderborn.de/~tegeler/vdr
|
|
*
|
|
* Latest version available at: URL
|
|
*
|
|
* See the file COPYING for license information.
|
|
*
|
|
* Description:
|
|
*
|
|
* This Plugin display an background image while the vdr is switcht to radio channels.
|
|
*
|
|
* $Id: radiotools.cpp,v 1.1 2009/08/07 07:22:31 rhabarber1848 Exp $
|
|
|
|
*/
|
|
|
|
#include "radiotools.h"
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <sys/time.h>
|
|
|
|
unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst)
|
|
{
|
|
#if __cplusplus < 201703L
|
|
register unsigned short crc = 0xffff; // Use register for older standards
|
|
#else
|
|
unsigned short crc = 0xffff; // register keyword is not allowed in C++17 and later
|
|
#endif
|
|
|
|
if (skipfirst) daten++;
|
|
while (len--) {
|
|
crc = (crc >> 8) | (crc << 8);
|
|
crc ^= *daten++;
|
|
crc ^= (crc & 0xff) >> 4;
|
|
crc ^= (crc << 8) << 4;
|
|
crc ^= ((crc & 0xff) << 4) << 1;
|
|
}
|
|
|
|
return ~(crc);
|
|
}
|
|
|
|
char *rtrim(char *text)
|
|
{
|
|
char *s = text + strlen(text) - 1;
|
|
while (s >= text && (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r'))
|
|
*s-- = 0;
|
|
|
|
return text;
|
|
}
|
|
|
|
// --- cTimeMs ---------------------------------------------------------------
|
|
|
|
cTimeMs::cTimeMs(void)
|
|
{
|
|
Set();
|
|
}
|