You can subscribe to this list here.
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2013 |
Jan
(8) |
Feb
(6) |
Mar
(5) |
Apr
(7) |
May
(3) |
Jun
(5) |
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(2) |
Nov
(8) |
Dec
(2) |
| 2014 |
Jan
(3) |
Feb
(2) |
Mar
(2) |
Apr
(3) |
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(4) |
Nov
(5) |
Dec
(1) |
| 2015 |
Jan
|
Feb
(6) |
Mar
(24) |
Apr
(29) |
May
(43) |
Jun
(17) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: GetAway <tux...@ne...> - 2015-05-28 14:07:42
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via d28c0857af1346b73564b00091069453db874ace (commit)
from 9f02607d0beb28e38ab4609f7bdfadad70eeb016 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d28c0857af1346b73564b00091069453db874ace
Author: [CST] Focus <foc...@gm...>
Date: Thu May 28 16:07:00 2015 +0200
UPNPDevice.cpp: change to non-blocking recv
Signed-off-by: GetAway <get...@t-...>
diff --git a/misc/libs/libupnpclient/UPNPDevice.cpp b/misc/libs/libupnpclient/UPNPDevice.cpp
index 90a85e7..00a768f 100644
--- a/misc/libs/libupnpclient/UPNPDevice.cpp
+++ b/misc/libs/libupnpclient/UPNPDevice.cpp
@@ -34,6 +34,8 @@
#include <poll.h>
#include "upnpclient.h"
#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
struct ToLower
{
@@ -433,11 +435,32 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act
commandstr = command.str();
result = send(t_socket, commandstr.c_str(), commandstr.size(), 0);
+#if 0
while ((received = recv(t_socket, buf, sizeof(buf)-1, 0)) > 0)
{
buf[received] = 0;
reply << buf;
}
+#endif
+ struct pollfd fds[1];
+ fds[0].fd = t_socket;
+ fds[0].events = POLLIN;
+ while (true) {
+ int result = poll(fds, 1, 4000);
+ if (result < 0) {
+ printf("CUPnPDevice::HTTP: poll error %s\n", strerror(errno));
+ break;
+ }
+ if (result == 0) {
+ printf("CUPnPDevice::HTTP: poll timeout\n");
+ break;
+ }
+ received = recv(t_socket, buf, sizeof(buf)-1, 0);
+ if (received <= 0)
+ break;
+ buf[received] = 0;
+ reply << buf;
+ }
close(t_socket);
return reply.str();
}
-----------------------------------------------------------------------
Summary of changes:
misc/libs/libupnpclient/UPNPDevice.cpp | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-27 17:23:12
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 9f02607d0beb28e38ab4609f7bdfadad70eeb016 (commit)
from ac59ccffb18ee5065dc215d32042ce5f8da7cb46 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9f02607d0beb28e38ab4609f7bdfadad70eeb016
Author: martii <m4...@gm...>
Date: Wed May 27 19:22:36 2015 +0200
remove widest_number definition and usage, add Font::getMaxDigitWidth() method instead
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/driver/fontrenderer.cpp b/tuxbox/neutrino/src/driver/fontrenderer.cpp
index 459f1c1..2ff0468 100644
--- a/tuxbox/neutrino/src/driver/fontrenderer.cpp
+++ b/tuxbox/neutrino/src/driver/fontrenderer.cpp
@@ -221,6 +221,8 @@ Font::Font(FBFontRenderClass *render, FTC_FaceID faceid, const int isize, const
font.height = isize;
font.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
+ maxdigitwidth = 0;
+
scaler.face_id = font.face_id;
scaler.width = isize * 64;
scaler.height = isize * 64;
@@ -283,6 +285,21 @@ int Font::getHeight(void)
return height;
}
+int Font::getMaxDigitWidth(void)
+{
+ if (maxdigitwidth < 1) {
+ char b[2];
+ b[1] = 0;
+ for (char c = '0'; c <= '9'; c++) {
+ *b = c;
+ int w = getRenderWidth(b);
+ if (w > maxdigitwidth)
+ maxdigitwidth = w;
+ }
+ }
+ return maxdigitwidth;
+}
+
int UTF8ToUnicode(const char * &text, const bool utf8_encoded) // returns -1 on error
{
int unicode_value;
diff --git a/tuxbox/neutrino/src/driver/fontrenderer.h b/tuxbox/neutrino/src/driver/fontrenderer.h
index 5239a50..3a0a013 100644
--- a/tuxbox/neutrino/src/driver/fontrenderer.h
+++ b/tuxbox/neutrino/src/driver/fontrenderer.h
@@ -52,6 +52,7 @@ class Font
// these are HACKED values, because the font metrics were unusable.
int height,ascender,descender,upper,lower;
int fontwidth;
+ int maxdigitwidth;
public:
enum fontmodifier
@@ -67,6 +68,7 @@ class Font
int getRenderWidth(const char * text, const bool utf8_encoded = false);
int getRenderWidth(const std::string & text, const bool utf8_encoded = false);
int getHeight(void);
+ int getMaxDigitWidth(void);
int getSize(){return font.width;}
int setSize(int isize);
diff --git a/tuxbox/neutrino/src/gui/channellist.cpp b/tuxbox/neutrino/src/gui/channellist.cpp
index b0b03fe..411c38e 100644
--- a/tuxbox/neutrino/src/gui/channellist.cpp
+++ b/tuxbox/neutrino/src/gui/channellist.cpp
@@ -785,7 +785,7 @@ int CChannelList::numericZap(neutrino_msg_t key)
int ox=300;
int oy=200;
- int sx = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(widest_number) + 14;
+ int sx = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getMaxDigitWidth() + 14;
int sy = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight() + 6;
char valstr[10];
int chn = CRCInput::getNumericValue(key);
diff --git a/tuxbox/neutrino/src/gui/infoviewer.cpp b/tuxbox/neutrino/src/gui/infoviewer.cpp
index 5227eef..31e43c1 100644
--- a/tuxbox/neutrino/src/gui/infoviewer.cpp
+++ b/tuxbox/neutrino/src/gui/infoviewer.cpp
@@ -126,7 +126,7 @@ void CInfoViewer::start()
2*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() +
25;
- ChanWidth = 4* g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getRenderWidth(widest_number) + 10;
+ ChanWidth = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getMaxDigitWidth() + 10;
ChanHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getHeight()*9/8;
ProgressBarHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() - 4;
@@ -134,7 +134,7 @@ void CInfoViewer::start()
aspectRatio = g_Controld->getAspectRatio();
time_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getHeight()+5;
- time_left_width = 2* g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(widest_number);
+ time_left_width = 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getMaxDigitWidth();
time_dot_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":");
time_width = time_left_width* 2+ time_dot_width;
diff --git a/tuxbox/neutrino/src/neutrino.h b/tuxbox/neutrino/src/neutrino.h
index fba89c7..2ad7a1d 100644
--- a/tuxbox/neutrino/src/neutrino.h
+++ b/tuxbox/neutrino/src/neutrino.h
@@ -50,7 +50,6 @@
#include <string>
-#define widest_number "2"
#define ANNOUNCETIME (1 * 60)
#define PLUGINDIR_VAR "/var/tuxbox/plugins"
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/driver/fontrenderer.cpp | 17 +++++++++++++++++
tuxbox/neutrino/src/driver/fontrenderer.h | 2 ++
tuxbox/neutrino/src/gui/channellist.cpp | 2 +-
tuxbox/neutrino/src/gui/infoviewer.cpp | 4 ++--
tuxbox/neutrino/src/neutrino.h | 1 -
5 files changed, 22 insertions(+), 4 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-27 16:45:48
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via ac59ccffb18ee5065dc215d32042ce5f8da7cb46 (commit)
from 76e2683e7dfb66736ec60452fae5b2195edca7eb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ac59ccffb18ee5065dc215d32042ce5f8da7cb46
Author: GetAway <get...@t-...>
Date: Wed May 27 18:43:59 2015 +0200
network: use my_system()
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/system/configure_network.cpp b/tuxbox/neutrino/src/system/configure_network.cpp
index a737347..5737647 100644
--- a/tuxbox/neutrino/src/system/configure_network.cpp
+++ b/tuxbox/neutrino/src/system/configure_network.cpp
@@ -27,10 +27,13 @@
#include <iomanip>
#include <sstream>
+#include <system/helper.h>
+
CNetworkConfig::CNetworkConfig(void)
{
netGetNameserver(nameserver);
- inet_static = getInetAttributes("eth0", automatic_start, address, netmask, broadcast, gateway);
+ ifname = "eth0";
+ inet_static = getInetAttributes(ifname, automatic_start, address, netmask, broadcast, gateway);
init_vars();
copy_to_orig();
@@ -55,7 +58,6 @@ CNetworkConfig::~CNetworkConfig()
void CNetworkConfig::init_vars(void)
{
- std::string ifname = "eth0";
unsigned char addr[6];
netGetMacAddr(ifname, addr);
@@ -98,12 +100,12 @@ void CNetworkConfig::commitConfig(void)
if (inet_static)
{
addLoopbackDevice("lo", true);
- setStaticAttributes("eth0", automatic_start, address, netmask, broadcast, gateway);
+ setStaticAttributes(ifname, automatic_start, address, netmask, broadcast, gateway);
}
else
{
addLoopbackDevice("lo", true);
- setDhcpAttributes("eth0", automatic_start);
+ setDhcpAttributes(ifname, automatic_start);
}
}
if (nameserver != orig_nameserver)
@@ -115,11 +117,15 @@ void CNetworkConfig::commitConfig(void)
void CNetworkConfig::startNetwork(void)
{
- system("ifup eth0");
+ std::string cmd = "/sbin/ifup " + ifname;
+
+ my_system(3, "/bin/sh", "-c", cmd.c_str());
}
void CNetworkConfig::stopNetwork(void)
{
- system("ifdown eth0");
+ std::string cmd = "/sbin/ifdown " + ifname;
+
+ my_system(3, "/bin/sh", "-c", cmd.c_str());
}
diff --git a/tuxbox/neutrino/src/system/configure_network.h b/tuxbox/neutrino/src/system/configure_network.h
index 7b7f6c4..13641a7 100644
--- a/tuxbox/neutrino/src/system/configure_network.h
+++ b/tuxbox/neutrino/src/system/configure_network.h
@@ -46,6 +46,7 @@ class CNetworkConfig
std::string gateway;
std::string nameserver;
std::string mac_addr;
+ std::string ifname;
bool inet_static;
CNetworkConfig();
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/system/configure_network.cpp | 18 ++++++++++++------
tuxbox/neutrino/src/system/configure_network.h | 1 +
2 files changed, 13 insertions(+), 6 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-26 15:47:30
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 76e2683e7dfb66736ec60452fae5b2195edca7eb (commit)
from ac506b8080684e05d10462dcbd89e0195cdb361f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 76e2683e7dfb66736ec60452fae5b2195edca7eb
Author: martii <m4...@gm...>
Date: Tue May 26 17:46:49 2015 +0200
driver/rcinput: let getUnicodeValue() return const char *
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/driver/rcinput.cpp b/tuxbox/neutrino/src/driver/rcinput.cpp
index 4a5b6dc..a3bd64f 100644
--- a/tuxbox/neutrino/src/driver/rcinput.cpp
+++ b/tuxbox/neutrino/src/driver/rcinput.cpp
@@ -1914,21 +1914,21 @@ unsigned int CRCInput::convertDigitToKey(const unsigned int digit)
}
/**************************************************************************
-* getUnicodeValue - return unicode value of the key or -1
+* getUnicodeValue - return unicode value of the key or \0
*
**************************************************************************/
#define UNICODE_VALUE_SIZE 58
-static const int unicode_value[UNICODE_VALUE_SIZE] = {-1 , -1 , '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', -1 , -1 ,
- 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', -1 , -1 , 'A', 'S',
- 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', -1 /* FIXME */, -1 /* FIXME */, -1 , '\\', 'Z', 'X', 'C', 'V',
- 'B', 'N', 'M', ',', '.', '/', -1, -1, -1, ' '};
+static const char unicode_value[UNICODE_VALUE_SIZE * 2] =
+ "\0\0" "\0\0" "1\0" "2\0" "3\0" "4\0" "5\0" "6\0" "7\0" "8\0" "9\0" "0\0" "-\0" "=\0" "\0\0" "\0\0"
+ "Q\0" "W\0" "E\0" "R\0" "T\0" "Y\0" "U\0" "I\0" "O\0" "P\0" "{\0" "}\0" "\0\0" "\0\0" "A\0" "S\0"
+ "D\0" "F\0" "G\0" "H\0" "J\0" "K\0" "L\0" ";\0" "'\0" "\140\0" "\0\0" "\\\0" "Z\0" "X\0" "C\0" "V\0"
+ "B\0" "N\0" "M\0" "\0\0" ".\0" "/\0" "\0\0" "\0\0" "\0\0" " ";
-int CRCInput::getUnicodeValue(const neutrino_msg_t key)
+const char *CRCInput::getUnicodeValue(const neutrino_msg_t key)
{
if (key < UNICODE_VALUE_SIZE)
- return unicode_value[key];
- else
- return -1;
+ return unicode_value + key * 2;
+ return "";
}
/**************************************************************************
@@ -2132,16 +2132,16 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key)
std::string CRCInput::getKeyName(const unsigned int key)
{
- int uc_value = getUnicodeValue(key);
- if (uc_value == -1)
- return getSpecialKeyName(key);
- else
- {
- char tmp[2];
- tmp[0] = uc_value;
- tmp[1] = 0;
- return std::string(tmp);
- }
+ std::string res(getKeyNameC(key));
+ return res;
+}
+
+const char *CRCInput::getKeyNameC(const unsigned int key)
+{
+ const char *lunicode_value = getUnicodeValue(key);
+ if (*lunicode_value)
+ return lunicode_value;
+ return getSpecialKeyName(key);
}
/**************************************************************************
diff --git a/tuxbox/neutrino/src/driver/rcinput.h b/tuxbox/neutrino/src/driver/rcinput.h
index b00b229..85c9cc2 100644
--- a/tuxbox/neutrino/src/driver/rcinput.h
+++ b/tuxbox/neutrino/src/driver/rcinput.h
@@ -360,9 +360,10 @@ class CRCInput
static bool isNumeric(const neutrino_msg_t key);
static int getNumericValue(const neutrino_msg_t key);
static unsigned int convertDigitToKey(const unsigned int digit);
- static int getUnicodeValue(const neutrino_msg_t key);
+ static const char *getUnicodeValue(const neutrino_msg_t key);
static const char * getSpecialKeyName(const unsigned int key);
+ static const char *getKeyNameC(const unsigned int key);
static std::string getKeyName(const unsigned int key);
int addTimer(unsigned long long Interval, bool oneshot= true, bool correct_time= true );
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput.cpp b/tuxbox/neutrino/src/gui/widget/stringinput.cpp
index 8d9a626..7729519 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput.cpp
@@ -362,7 +362,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
{
keyRightPressed();
}
- else if (CRCInput::getUnicodeValue(msg) != -1)
+ else if (*CRCInput::getUnicodeValue(msg))
{
NormalKeyPressed(msg);
}
@@ -611,7 +611,7 @@ void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t key)
}
else
{
- value[selected] = (char)CRCInput::getUnicodeValue(key);
+ valueString->at(selected) = *CRCInput::getUnicodeValue(key);
keyRedPressed(); /* to lower, paintChar */
keyRightPressed(); /* last_digit = -1, move to next position */
}
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
index 7db7e6b..27ebf5e 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
@@ -210,7 +210,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & )
}
}
}
- else if ((CRCInput::getUnicodeValue(msg) != -1) || (msg == CRCInput::RC_red)
+ else if ((*CRCInput::getUnicodeValue(msg)) || (msg == CRCInput::RC_red)
|| (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow)
|| (msg_repeatok == CRCInput::RC_up) || (msg_repeatok == CRCInput::RC_down))
{
@@ -365,12 +365,12 @@ int CExtendedInput_Item_Char::getCharID( char ch )
void CExtendedInput_Item_Char::keyPressed(const int key)
{
- int value = CRCInput::getUnicodeValue(key);
- if (value != -1)
+ const char *value = CRCInput::getUnicodeValue(key);
+ if (*value)
{
- if (isAllowedChar((char)value))
+ if (isAllowedChar(*value))
{
- *data = (char)value;
+ *data = *value;
g_RCInput->postMsg( CRCInput::RC_right, 0 );
}
}
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/driver/rcinput.cpp | 38 ++++++++++----------
tuxbox/neutrino/src/driver/rcinput.h | 3 +-
tuxbox/neutrino/src/gui/widget/stringinput.cpp | 4 +-
tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp | 10 +++---
4 files changed, 28 insertions(+), 27 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-26 13:11:55
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via ac506b8080684e05d10462dcbd89e0195cdb361f (commit)
from a549944c911773488fa8138adb61a39e3ebfd295 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ac506b8080684e05d10462dcbd89e0195cdb361f
Author: GetAway <get...@t-...>
Date: Tue May 26 15:11:16 2015 +0200
network: use netGetMacAddr() remove CNetAdapter class
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/gui/network_setup.cpp b/tuxbox/neutrino/src/gui/network_setup.cpp
index 2bc8054..994aeb1 100644
--- a/tuxbox/neutrino/src/gui/network_setup.cpp
+++ b/tuxbox/neutrino/src/gui/network_setup.cpp
@@ -39,8 +39,6 @@
#include <signal.h>
#include "libnet.h"
-#include <sstream>
-#include <iomanip>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -464,8 +462,7 @@ void CNetworkSetup::testNetworkSettings()
std::string defaultsite = "www.google.de", wiki_IP = "91.224.67.93", wiki_URL = "wiki.tuxbox.org";
//set physical adress
- static CNetAdapter netadapter;
- ethID = netadapter.getMacAddr();
+ std::string mac_addr = networkConfig->mac_addr;
//get www-domain testsite from /.version
CConfigFile config('\t');
@@ -491,7 +488,7 @@ void CNetworkSetup::testNetworkSettings()
}
printf("testNw IP: %s\n", our_ip.c_str());
- printf("testNw MAC-address: %s\n", ethID.c_str());
+ printf("testNw MAC-address: %s\n", mac_addr.c_str());
printf("testNw Netmask: %s\n", our_mask.c_str());
printf("testNw Broadcast: %s\n", our_broadcast.c_str());
printf("testNw Gateway: %s\n", our_gateway.c_str());
@@ -505,7 +502,7 @@ void CNetworkSetup::testNetworkSettings()
else
{
// Box
- text = "dbox (" + ethID + "):\n";
+ text = "dbox (" + mac_addr + "):\n";
text += offset + our_ip + ": " + mypinghost(our_ip) + "\n";
// Gateway
text += (std::string)g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY) + " (Router):\n";
@@ -582,66 +579,3 @@ bool CDHCPNotifier::changeNotify(const neutrino_locale_t, void * data)
toDisable[x]->setActive(CNetworkConfig::getInstance()->inet_static);
return false;
}
-
-long CNetAdapter::mac_addr_sys ( u_char *addr) //only for function getMacAddr()
-{
- struct ifreq ifr;
- struct ifreq *IFR;
- struct ifconf ifc;
- char buf[1024];
- int s, i;
- int ok = 0;
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s==-1)
- {
- return -1;
- }
-
- ifc.ifc_len = sizeof(buf);
- ifc.ifc_buf = buf;
- ioctl(s, SIOCGIFCONF, &ifc);
- IFR = ifc.ifc_req;
- for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; IFR++)
- {
- strcpy(ifr.ifr_name, IFR->ifr_name);
- if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0)
- {
- if (! (ifr.ifr_flags & IFF_LOOPBACK))
- {
- if (ioctl(s, SIOCGIFHWADDR, &ifr) == 0)
- {
- ok = 1;
- break;
- }
- }
- }
- }
- close(s);
- if (ok)
- {
- memmove(addr, ifr.ifr_hwaddr.sa_data, 6);
- }
- else
- {
- return -1;
- }
- return 0;
-}
-
-std::string CNetAdapter::getMacAddr(void)
-{
- long stat;
- u_char addr[6];
- stat = mac_addr_sys( addr);
- if (0 == stat)
- {
- std::stringstream mac_tmp;
- for(int i=0;i<6;++i)
- mac_tmp<<std::hex<<std::setfill('0')<<std::setw(2)<<(int)addr[i]<<':';
- return mac_tmp.str().substr(0,17);
- }
- else
- {
- return "not found";
- }
-}
diff --git a/tuxbox/neutrino/src/gui/network_setup.h b/tuxbox/neutrino/src/gui/network_setup.h
index 9bcfe35..f77aa30 100644
--- a/tuxbox/neutrino/src/gui/network_setup.h
+++ b/tuxbox/neutrino/src/gui/network_setup.h
@@ -110,13 +110,4 @@ class CDHCPNotifier : public CChangeObserver
CDHCPNotifier(CMenuForwarder*, CMenuForwarder*, CMenuForwarder*, CMenuForwarder*);
bool changeNotify(const neutrino_locale_t, void * data);
};
-
-class CNetAdapter
-{
- private:
- long mac_addr_sys ( u_char *addr);
- public:
- std::string getMacAddr(void);
-};
-
#endif
diff --git a/tuxbox/neutrino/src/system/configure_network.cpp b/tuxbox/neutrino/src/system/configure_network.cpp
index fb8425d..a737347 100644
--- a/tuxbox/neutrino/src/system/configure_network.cpp
+++ b/tuxbox/neutrino/src/system/configure_network.cpp
@@ -24,11 +24,15 @@
#include "network_interfaces.h" /* getInetAttributes, setInetAttributes */
#include <stdlib.h> /* system */
#include <stdio.h>
+#include <iomanip>
+#include <sstream>
CNetworkConfig::CNetworkConfig(void)
{
netGetNameserver(nameserver);
inet_static = getInetAttributes("eth0", automatic_start, address, netmask, broadcast, gateway);
+
+ init_vars();
copy_to_orig();
}
@@ -49,6 +53,20 @@ CNetworkConfig::~CNetworkConfig()
}
+void CNetworkConfig::init_vars(void)
+{
+ std::string ifname = "eth0";
+ unsigned char addr[6];
+
+ netGetMacAddr(ifname, addr);
+
+ std::stringstream mac_tmp;
+ for(int i=0;i<6;++i)
+ mac_tmp<<std::hex<<std::setfill('0')<<std::setw(2)<<(int)addr[i]<<':';
+
+ mac_addr = mac_tmp.str().substr(0,17);
+}
+
void CNetworkConfig::copy_to_orig(void)
{
orig_automatic_start = automatic_start;
diff --git a/tuxbox/neutrino/src/system/configure_network.h b/tuxbox/neutrino/src/system/configure_network.h
index 8e7844f..7b7f6c4 100644
--- a/tuxbox/neutrino/src/system/configure_network.h
+++ b/tuxbox/neutrino/src/system/configure_network.h
@@ -36,6 +36,7 @@ class CNetworkConfig
bool orig_inet_static;
void copy_to_orig(void);
+ void init_vars(void);
public:
bool automatic_start;
@@ -44,6 +45,7 @@ class CNetworkConfig
std::string broadcast;
std::string gateway;
std::string nameserver;
+ std::string mac_addr;
bool inet_static;
CNetworkConfig();
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/gui/network_setup.cpp | 72 +---------------------
tuxbox/neutrino/src/gui/network_setup.h | 9 ---
tuxbox/neutrino/src/system/configure_network.cpp | 18 ++++++
tuxbox/neutrino/src/system/configure_network.h | 2 +
4 files changed, 23 insertions(+), 78 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-26 11:22:12
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via a549944c911773488fa8138adb61a39e3ebfd295 (commit)
from b3f66515501cbd1bad8d572ca4b2f58f630a3b18 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit a549944c911773488fa8138adb61a39e3ebfd295
Author: m4...@gm... <m4...@gm...>
Date: Tue May 26 13:21:37 2015 +0200
gui/nfs: implement mac address lookup
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/data/locale/deutsch.locale b/tuxbox/neutrino/data/locale/deutsch.locale
index e9ac38d..c3834cb 100644
--- a/tuxbox/neutrino/data/locale/deutsch.locale
+++ b/tuxbox/neutrino/data/locale/deutsch.locale
@@ -1037,6 +1037,7 @@ nfs.mountnow Jetzt mounten
nfs.mountok Mount erfolgreich
nfs.mounttimeout Mount-Fehler: Timeout
nfs.password Passwort
+nfs.refresh_mac MAC-Adresse ermitteln
nfs.remount Verzeichnisse erneut mounten
nfs.type Typ
nfs.type_cifs CIFS
@@ -1213,7 +1214,7 @@ recordingmenu.sectionsd.run nicht anhalten
recordingmenu.sectionsd.stop anhalten
recordingmenu.server Server
recordingmenu.server_ip Aufnahmeserver IP
-recordingmenu.server_mac Mac Adresse
+recordingmenu.server_mac MAC-Adresse
recordingmenu.server_port Aufnahmeserver Port
recordingmenu.server_wakeup Aufnahmeserver WOL
recordingmenu.setupnow Einstellungen jetzt übernehmen
diff --git a/tuxbox/neutrino/data/locale/english.locale b/tuxbox/neutrino/data/locale/english.locale
index ff033c6..c6cf746 100644
--- a/tuxbox/neutrino/data/locale/english.locale
+++ b/tuxbox/neutrino/data/locale/english.locale
@@ -1037,6 +1037,7 @@ nfs.mountnow Mount now
nfs.mountok Mount successful
nfs.mounttimeout Mount error: timeout
nfs.password Password
+nfs.refresh_mac look up MAC address
nfs.remount Remount directories
nfs.type Type
nfs.type_cifs CIFS
@@ -1213,7 +1214,7 @@ recordingmenu.sectionsd.run don't stop
recordingmenu.sectionsd.stop stop
recordingmenu.server server
recordingmenu.server_ip Recording Server IP
-recordingmenu.server_mac MAC Address
+recordingmenu.server_mac MAC address
recordingmenu.server_port Recording Server Port
recordingmenu.server_wakeup Recording Server WOL
recordingmenu.setupnow Activate changes
diff --git a/tuxbox/neutrino/src/gui/nfs.cpp b/tuxbox/neutrino/src/gui/nfs.cpp
index be0c9c3..d58bca4 100644
--- a/tuxbox/neutrino/src/gui/nfs.cpp
+++ b/tuxbox/neutrino/src/gui/nfs.cpp
@@ -55,6 +55,8 @@
#include <zapit/client/zapittools.h>
+extern int pinghost (const std::string &hostname, std::string *ip = NULL);
+
CNFSMountGui::CNFSMountGui()
{
#warning move probing from exec() to fsmounter
@@ -107,6 +109,27 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
}
returnval = menu();
}
+ else if(actionKey.substr(0,10)=="refreshMAC")
+ {
+ int nr=atoi(actionKey.substr(10,1).c_str());
+ std::string h;
+ pinghost(g_settings.network_nfs[nr].ip, &h);
+ if (!h.empty()) {
+ FILE *arptable = fopen("/proc/net/arp", "r");
+ if (arptable) {
+ char line[120], ip[120], mac[120];
+ while (fgets(line, sizeof(line), arptable)) {
+ if (2 == sscanf(line, "%s %*s %*s %s %*[^\n]", ip, mac)) {
+ if (!strcmp(ip, h.c_str())) {
+ g_settings.network_nfs[nr].mac = std::string(mac);
+ break;
+ }
+ }
+ }
+ fclose(arptable);
+ }
+ }
+ }
else if(actionKey.substr(0,10)=="mountentry")
{
parent->hide();
@@ -217,11 +240,13 @@ int CNFSMountGui::menuEntry(int nr)
CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (g_settings.network_nfs[nr].type != (int)CFSMounter::NFS), NULL, &passInput);
CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs[nr].mac);
- CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs[nr].mac, &macInput);
+ CMenuForwarder *macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs[nr].mac, &macInput);
+
+ CMenuForwarder *refreshMAC_fwd = new CMenuForwarder(LOCALE_NFS_REFRESH_MAC, true, NULL, this, ("refreshMAC" + to_string(nr)).c_str(), CRCInput::RC_yellow);
CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs[nr].local_dir)), NULL, this, ("domount" + to_string(nr)).c_str(), CRCInput::RC_red);
- mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
+ mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
COnOffNotifier notifier(CFSMounter::NFS);
notifier.addItem(username_fwd);
notifier.addItem(password_fwd);
@@ -236,6 +261,7 @@ int CNFSMountGui::menuEntry(int nr)
mountMenuEntryW.addItem(username_fwd);
mountMenuEntryW.addItem(password_fwd);
mountMenuEntryW.addItem(macInput_fwd);
+ mountMenuEntryW.addItem(refreshMAC_fwd);
mountMenuEntryW.addItem(GenericMenuSeparatorLine);
mountMenuEntryW.addItem(mountnow_fwd);
diff --git a/tuxbox/neutrino/src/system/locals.h b/tuxbox/neutrino/src/system/locals.h
index cb1510b..2e40fe0 100644
--- a/tuxbox/neutrino/src/system/locals.h
+++ b/tuxbox/neutrino/src/system/locals.h
@@ -1064,6 +1064,7 @@ typedef enum
LOCALE_NFS_MOUNTOK,
LOCALE_NFS_MOUNTTIMEOUT,
LOCALE_NFS_PASSWORD,
+ LOCALE_NFS_REFRESH_MAC,
LOCALE_NFS_REMOUNT,
LOCALE_NFS_TYPE,
LOCALE_NFS_TYPE_CIFS,
diff --git a/tuxbox/neutrino/src/system/locals_intern.h b/tuxbox/neutrino/src/system/locals_intern.h
index 4535f7f..381b664 100644
--- a/tuxbox/neutrino/src/system/locals_intern.h
+++ b/tuxbox/neutrino/src/system/locals_intern.h
@@ -1064,6 +1064,7 @@ const char * locale_real_names[] =
"nfs.mountok",
"nfs.mounttimeout",
"nfs.password",
+ "nfs.refresh_mac",
"nfs.remount",
"nfs.type",
"nfs.type_cifs",
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/data/locale/deutsch.locale | 3 +-
tuxbox/neutrino/data/locale/english.locale | 3 +-
tuxbox/neutrino/src/gui/nfs.cpp | 30 ++++++++++++++++++++++++++-
tuxbox/neutrino/src/system/locals.h | 1 +
tuxbox/neutrino/src/system/locals_intern.h | 1 +
5 files changed, 34 insertions(+), 4 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-26 10:16:17
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via b3f66515501cbd1bad8d572ca4b2f58f630a3b18 (commit)
from f059bbcc7cab8c6e3395a7618455342dcbb47194 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b3f66515501cbd1bad8d572ca4b2f58f630a3b18
Author: m4...@gm... <m4...@gm...>
Date: Tue May 26 12:09:16 2015 +0200
convert char[...] configuration values to std::string (ping)
based on martii's code with some changes for dbox
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 5132b3f..d99b5ea 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -79,7 +79,7 @@
#include <sys/mount.h>
#include <unistd.h>
//#include <system/ping.h>
-extern "C" int pingthost ( const char *hostname, int t );
+extern int pingthost (const std::string &hostname, int t );
#define my_scandir scandir64
#define my_alphasort alphasort64
diff --git a/tuxbox/neutrino/src/gui/network_setup.cpp b/tuxbox/neutrino/src/gui/network_setup.cpp
index 50abdda..2bc8054 100644
--- a/tuxbox/neutrino/src/gui/network_setup.cpp
+++ b/tuxbox/neutrino/src/gui/network_setup.cpp
@@ -76,7 +76,7 @@
#include <system/debug.h>
-extern "C" int pinghost( const char *hostname );
+extern int pinghost (const std::string &hostname, std::string *ip = NULL);
CNetworkSetup::CNetworkSetup()
{
@@ -331,7 +331,7 @@ bool CNetworkSetup::checkForIP()
return ret;
}
-const char * CNetworkSetup::mypinghost(const char * const host)
+const char * CNetworkSetup::mypinghost(std::string &host)
{
int retvalue = pinghost(host);
switch (retvalue)
@@ -458,9 +458,10 @@ void CNetworkSetup::testNetworkSettings()
std::string ifname = "eth0";
std::string our_ip, our_mask, our_broadcast, our_gateway, our_nameserver;
- std::string text, ethID, testsite;
+ std::string text, ethID, testsite, offset = " ";
+
//set default testdomain and wiki-IP
- std::string defaultsite = "www.google.de", wiki_IP = "91.224.67.93";
+ std::string defaultsite = "www.google.de", wiki_IP = "91.224.67.93", wiki_URL = "wiki.tuxbox.org";
//set physical adress
static CNetAdapter netadapter;
@@ -496,20 +497,32 @@ void CNetworkSetup::testNetworkSettings()
printf("testNw Gateway: %s\n", our_gateway.c_str());
printf("testNw Nameserver: %s\n", our_nameserver.c_str());
printf("testNw Testsite %s\n", testsite.c_str());
-
- text = (std::string)"dbox:\n"
- + " " + our_ip + ": " + mypinghost(our_ip.c_str()) + '\n'
- + " " + "eth-ID: " + ethID + '\n'
- + g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY) + ":\n"
- + " " + our_gateway + ": " + ' ' + mypinghost(our_gateway.c_str()) + '\n'
- + g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER) + ":\n"
- + " " + our_nameserver + ": " + ' ' + mypinghost(our_nameserver.c_str()) + '\n'
- + "wiki.tuxbox.org:\n"
- + " via IP (" + wiki_IP + "): " + mypinghost(wiki_IP.c_str()) + '\n';
- if (1 == pinghost(our_nameserver.c_str())) text += (std::string)
- " via DNS: " + mypinghost("wiki.tuxbox.org") + '\n'
- + testsite + ":\n"
- + " via DNS: " + mypinghost(testsite.c_str()) + '\n';
+
+ if (our_ip.empty())
+ {
+ text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE);
+ }
+ else
+ {
+ // Box
+ text = "dbox (" + ethID + "):\n";
+ text += offset + our_ip + ": " + mypinghost(our_ip) + "\n";
+ // Gateway
+ text += (std::string)g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY) + " (Router):\n";
+ text += offset + our_gateway + ": " + " " + mypinghost(our_gateway) + "\n";
+ // Nameserver
+ text += (std::string)g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER) + ":\n";
+ text += offset + our_nameserver + ": " + " " + mypinghost(our_nameserver) + "\n";
+ // Wiki
+ text += wiki_URL + ":\n";
+ text += offset + "via IP (" + wiki_IP + "): " + mypinghost(wiki_IP) + "\n";
+ if (pinghost(our_nameserver) == 1)
+ {
+ text += offset + "via DNS: " + mypinghost(wiki_URL) + "\n";
+ text += testsite + ":\n";
+ text += offset + "via DNS: " + mypinghost(testsite) + "\n";
+ }
+ }
ShowMsgUTF(LOCALE_NETWORKMENU_TEST, text, CMessageBox::mbrBack, CMessageBox::mbBack); // UTF-8
}
diff --git a/tuxbox/neutrino/src/gui/network_setup.h b/tuxbox/neutrino/src/gui/network_setup.h
index 9137518..9bcfe35 100644
--- a/tuxbox/neutrino/src/gui/network_setup.h
+++ b/tuxbox/neutrino/src/gui/network_setup.h
@@ -69,7 +69,7 @@ class CNetworkSetup : public CMenuTarget, CChangeObserver
bool checkForIP();
bool settingsChanged();
- const char * mypinghost(const char * const host);
+ const char * mypinghost(std::string &host);
void setBroadcast(void);
public:
diff --git a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
index 683cac1..c72ebc8 100755
--- a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
+++ b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
@@ -39,7 +39,8 @@
#include <system/fsmounter.h>
#endif
//#include <system/ping.h>
-extern "C" int pingthost ( const char *hostname, int t );
+extern int pingthost (const std::string &hostname, int t );
+
#include <gui/filebrowser.h>
#include <sys/vfs.h> // for statfs
diff --git a/tuxbox/neutrino/src/system/Makefile.am b/tuxbox/neutrino/src/system/Makefile.am
index 6254b90..f3bc561 100644
--- a/tuxbox/neutrino/src/system/Makefile.am
+++ b/tuxbox/neutrino/src/system/Makefile.am
@@ -18,7 +18,7 @@ libneutrino_system_a_SOURCES = \
localize.cpp \
setting_helpers.cpp \
debug.cpp \
- ping.c \
+ ping.cpp \
flashtool.cpp \
settings.cpp \
lastchannel.cpp \
diff --git a/tuxbox/neutrino/src/system/ping.c b/tuxbox/neutrino/src/system/ping.cpp
similarity index 80%
rename from tuxbox/neutrino/src/system/ping.c
rename to tuxbox/neutrino/src/system/ping.cpp
index 8eeb242..597b42e 100644
--- a/tuxbox/neutrino/src/system/ping.c
+++ b/tuxbox/neutrino/src/system/ping.cpp
@@ -1,5 +1,4 @@
-/*
- * $Id: ping.c,v 1.8 2007/01/24 02:19:10 guenther Exp $
+/**
* PING module
*
* Copyright (C) 2001 Jeffrey Fulmer <jdf...@ar...>
@@ -19,12 +18,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * 15 Jan 2007 Guenther Change pingthost timebase from seconds to milliseconds
*/
-#include <resolv.h>
+
#include "ping.h"
+
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif /*EXIT_SUCCESS*/
@@ -39,12 +38,12 @@
#define MAXDATA (MAXPKT-HDRLEN-TIMLEN)
#define DEF_TIMEOUT 5
-int ident = 0;
-int timo = 2000; // time in ms
-int rrt;
-int sock;
+static int ident = 0;
+static int timo = 2;
+static int rrt;
+static int sock = -1;
-int
+static int
in_checksum( u_short *buf, int len )
{
register long sum = 0;
@@ -65,8 +64,7 @@ in_checksum( u_short *buf, int len )
return ( answer );
-}
-
+}
int
send_ping( const char *host, struct sockaddr_in *taddr )
@@ -81,31 +79,25 @@ send_ping( const char *host, struct sockaddr_in *taddr )
len = HDRLEN + DATALEN;
- // init resolver because otherwiese dns requests will be cached
- res_init();
-
if(( proto = getprotobyname( "icmp" )) == NULL ){
return -1;
}
if(( hp = gethostbyname( host )) != NULL ){
- memcpy( &taddr->sin_addr, hp->h_addr_list[0], sizeof( taddr->sin_addr ));
+ memmove( &taddr->sin_addr, hp->h_addr_list[0], sizeof( taddr->sin_addr ));
taddr->sin_port = 0;
taddr->sin_family = AF_INET;
}
- else {
- if( inet_aton( host, &taddr->sin_addr ) == 0 ){
- return -1;
- }
+ else if( inet_aton( host, &taddr->sin_addr ) == 0 ){
+ return -1;
}
last = ntohl( taddr->sin_addr.s_addr ) & 0xFF;
-
if(( last == 0x00 ) || ( last == 0xFF )){
return -1;
}
- if(( sock = socket( AF_INET, SOCK_RAW, proto->p_proto )) < 0 ){
+ if((sock < 0) && ( sock = socket( AF_INET, SOCK_RAW, proto->p_proto )) < 0 ){
#ifdef DEBUG
perror( "sock" );
#endif/*DEBUG*/
@@ -125,6 +117,7 @@ send_ping( const char *host, struct sockaddr_in *taddr )
perror( "sock" );
#endif/*DEBUG*/
close( sock );
+ sock = -1;
return -2;
}
if( ss != len ){
@@ -132,20 +125,21 @@ send_ping( const char *host, struct sockaddr_in *taddr )
perror( "malformed packet" );
#endif/*DEBUG*/
close( sock );
+ sock = -1;
return -2;
}
return 0;
}
-int
+static int
recv_ping( struct sockaddr_in *taddr )
{
int len;
socklen_t from;
int nf, cc;
unsigned char buf[ HDRLEN + DATALEN ];
- struct icmp *icp;
+ //struct icmp *icp;
struct sockaddr_in faddr;
struct timeval to;
fd_set readset, writeset;
@@ -161,7 +155,7 @@ recv_ping( struct sockaddr_in *taddr )
unreachable network and we'll time out here. */
if(( nf = select( sock + 1, &readset, &writeset, NULL, &to )) < 0 ){
#ifdef DEBUG
- perror( "select" );
+ perror( "select" );
#endif/*DEBUG*/
exit( EXIT_FAILURE );
}
@@ -177,7 +171,7 @@ recv_ping( struct sockaddr_in *taddr )
exit( EXIT_FAILURE );
}
- icp = (struct icmp *)(buf + HDRLEN + DATALEN );
+ //icp = (struct icmp *)(buf + HDRLEN + DATALEN );
if( faddr.sin_addr.s_addr != taddr->sin_addr.s_addr ){
return 1;
}
@@ -196,7 +190,7 @@ recv_ping( struct sockaddr_in *taddr )
* returns an int value for the difference
* between now and starttime in milliseconds.
*/
-int
+static int
elapsed_time( struct timeval *starttime ){
struct timeval *newtime;
int elapsed;
@@ -215,53 +209,60 @@ elapsed_time( struct timeval *starttime ){
}
free(newtime);
return( elapsed );
-}
+}
-// time t in ms
-int
-myping( const char *hostname, int t )
+static int
+myping(const std::string &hostname, int t, struct sockaddr_in *sa = NULL)
{
int err;
- struct sockaddr_in sa;
+ struct sockaddr_in _sa;
struct timeval mytime;
- memset(&sa, 0, sizeof(struct sockaddr_in));
+ if (!sa)
+ sa = &_sa;
+
ident = getpid() & 0xFFFF;
- if( t == 0 ) timo = 2000;
+ if( t == 0 ) timo = 2;
else timo = t;
(void) gettimeofday( &mytime, (struct timezone *)NULL);
- if(( err = send_ping( hostname, &sa )) < 0 ){
+ if(( err = send_ping( hostname.c_str(), sa )) < 0 ){
return err;
}
do{
- if(( rrt = elapsed_time( &mytime )) > timo ){
+ if(( rrt = elapsed_time( &mytime )) > timo * 1000 ){
close( sock );
+ sock = -1;
return 0;
}
- } while( recv_ping( &sa ));
+ } while( recv_ping(sa));
close( sock );
+ sock = -1;
return 1;
}
int
-pinghost( const char *hostname )
+pinghost(const std::string &hostname, std::string *ip)
{
- return myping( hostname, 0 );
+ struct sockaddr_in sa;
+ int res = myping( hostname, 0, &sa);
+ if (ip) {
+ char *p = inet_ntoa(sa.sin_addr);
+ *ip = p ? std::string(p) : "";
+ }
+ return res;
}
-
-// time t in ms
int
-pingthost( const char *hostname, int t )
+pingthost(const std::string &hostname, int t)
{
return myping( hostname, t );
}
int
-tpinghost( const char *hostname )
+tpinghost(const std::string &hostname)
{
int ret;
@@ -271,9 +272,8 @@ tpinghost( const char *hostname )
return ret;
}
-// time t in ms
int
-tpingthost( const char *hostname, int t )
+tpingthost(const std::string &hostname, int t )
{
int ret;
diff --git a/tuxbox/neutrino/src/system/ping.h b/tuxbox/neutrino/src/system/ping.h
index a49ce10..4e3b0d6 100644
--- a/tuxbox/neutrino/src/system/ping.h
+++ b/tuxbox/neutrino/src/system/ping.h
@@ -25,6 +25,7 @@
#define PING_H
#include <stdio.h>
+#include <string>
#include "ping-config.h"
@@ -74,13 +75,13 @@
# include <netinet/ip_icmp.h>
#endif /* defined(__linux__) */
-int send_ping( const char *host, struct sockaddr_in *taddr );
-int recv_ping( struct sockaddr_in *taddr );
+//int send_ping( const char *host, struct sockaddr_in *taddr );
+//int recv_ping( struct sockaddr_in *taddr );
-int pinghost ( const char *hostname );
-int pingthost ( const char *hostname, int t );
-int tpinghost ( const char *hostname );
-int tpingthost( const char *hostname, int t );
+int pinghost (const std::string &hostname, std::string *ip = NULL);
+int pingthost (const std::string &hostname, int t );
+int tpinghost (const std::string &hostname );
+int tpingthost(const std::string &hostname, int t );
#endif/*PING_H*/
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/gui/moviebrowser.cpp | 2 +-
tuxbox/neutrino/src/gui/network_setup.cpp | 49 ++++++++-----
tuxbox/neutrino/src/gui/network_setup.h | 2 +-
tuxbox/neutrino/src/gui/widget/dirchooser.cpp | 3 +-
tuxbox/neutrino/src/system/Makefile.am | 2 +-
tuxbox/neutrino/src/system/{ping.c => ping.cpp} | 88 +++++++++++-----------
tuxbox/neutrino/src/system/ping.h | 13 ++--
7 files changed, 87 insertions(+), 72 deletions(-)
rename tuxbox/neutrino/src/system/{ping.c => ping.cpp} (80%)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-26 07:02:07
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via f059bbcc7cab8c6e3395a7618455342dcbb47194 (commit)
from 1b648fcacc68c6a569bb8cb17df924a9375e8f75 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f059bbcc7cab8c6e3395a7618455342dcbb47194
Author: m4...@gm... <m4...@gm...>
Date: Mon May 25 23:34:59 2015 +0200
convert char[...] configuration values to std::string (libnet)
based on martii's code with some changes for dbox
Signed-off-by: GetAway <get...@t-...>
diff --git a/misc/libs/libnet/Makefile.am b/misc/libs/libnet/Makefile.am
index b084bd8..5f5bfcb 100644
--- a/misc/libs/libnet/Makefile.am
+++ b/misc/libs/libnet/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libtuxbox-net.la
-libtuxbox_net_la_SOURCES = libnet.c network_interfaces.cpp
+libtuxbox_net_la_SOURCES = libnet.cpp network_interfaces.cpp
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = tuxbox-net.pc
diff --git a/misc/libs/libnet/libnet.c b/misc/libs/libnet/libnet.cpp
similarity index 55%
rename from misc/libs/libnet/libnet.c
rename to misc/libs/libnet/libnet.cpp
index c7e88b7..5af7eb7 100644
--- a/misc/libs/libnet/libnet.c
+++ b/misc/libs/libnet/libnet.cpp
@@ -9,6 +9,10 @@
#include <netdb.h>
#include <linux/route.h>
+#include "libnet.h"
+
+#if 0
+//never used
static void scanip( char *str, unsigned char *to )
{
int val;
@@ -33,7 +37,7 @@ static void scanip( char *str, unsigned char *to )
sp++;
}
}
-
+
int netSetIP( char *dev, char *ip, char *mask, char *brdcast )
{
int fd;
@@ -53,24 +57,24 @@ int netSetIP( char *dev, char *ip, char *mask, char *brdcast )
scanip( brdcast, adr_brdcast );
/* init structures */
- memset(&req, 0, sizeof(req));
+ memset(&req,0,sizeof(req));
strcpy(req.ifr_name,dev);
- memset(&addr, 0, sizeof(addr));
+ memset(&addr,0,sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = *((unsigned long *) adr_ip);
- memcpy(&req.ifr_addr,&addr,sizeof(addr));
+ memmove(&req.ifr_addr,&addr,sizeof(addr));
if( ioctl(fd,SIOCSIFADDR,&req) < 0 )
goto abbruch;
addr.sin_addr.s_addr = *((unsigned long *) adr_mask);
- memcpy(&req.ifr_addr,&addr,sizeof(addr));
+ memmove(&req.ifr_addr,&addr,sizeof(addr));
if( ioctl(fd,SIOCSIFNETMASK,&req) < 0 )
goto abbruch;
addr.sin_addr.s_addr = *((unsigned long *) adr_brdcast);
- memcpy(&req.ifr_addr,&addr,sizeof(addr));
+ memmove(&req.ifr_addr,&addr,sizeof(addr));
if( ioctl(fd,SIOCSIFBRDADDR,&req) < 0 )
goto abbruch;
@@ -80,48 +84,53 @@ abbruch:
return rc;
}
-
-void netGetIP( char *dev, char *ip, char *mask, char *brdcast )
+#endif
+void netGetIP(std::string &dev, std::string &ip, std::string &mask, std::string &brdcast)
{
int fd;
struct ifreq req;
struct sockaddr_in *saddr;
unsigned char *addr;
- *ip=0;
- *mask=0;
- *brdcast=0;
+ ip = "";
+ mask = "";
+ brdcast = "";
fd=socket(AF_INET,SOCK_DGRAM,0);
if ( !fd )
return;
- memset(&req, 0, sizeof(req));
- strcpy(req.ifr_name,dev);
+ memset(&req,0,sizeof(req));
+ strncpy(req.ifr_name, dev.c_str(), sizeof(req.ifr_name));
saddr = (struct sockaddr_in *) &req.ifr_addr;
addr= (unsigned char*) &saddr->sin_addr.s_addr;
+ char tmp[80];
+
if( ioctl(fd,SIOCGIFADDR,&req) == 0 )
- sprintf(ip,"%d.%d.%d.%d",addr[0],addr[1],addr[2],addr[3]);
+ snprintf(tmp, sizeof(tmp),"%d.%d.%d.%d",addr[0],addr[1],addr[2],addr[3]);
+ ip = std::string(tmp);
if( ioctl(fd,SIOCGIFNETMASK,&req) == 0 )
- sprintf(mask,"%d.%d.%d.%d",addr[0],addr[1],addr[2],addr[3]);
+ snprintf(tmp, sizeof(tmp),"%d.%d.%d.%d",addr[0],addr[1],addr[2],addr[3]);
+ mask = std::string(tmp);
if( ioctl(fd,SIOCGIFBRDADDR,&req) == 0 )
- sprintf(brdcast,"%d.%d.%d.%d",addr[0],addr[1],addr[2],addr[3]);
+ snprintf(tmp, sizeof(tmp),"%d.%d.%d.%d",addr[0],addr[1],addr[2],addr[3]);
+ brdcast = std::string(tmp);
close(fd);
- return;
}
-
+#if 0
+//never used
void netSetDefaultRoute( char *gw )
{
struct rtentry re;
struct sockaddr_in *in_addr;
unsigned char *addr;
int fd;
- unsigned char adr_gw[4];
+ unsigned char adr_gw[4] = {0};
scanip( gw, adr_gw );
@@ -142,44 +151,48 @@ void netSetDefaultRoute( char *gw )
return;
re.rt_flags = RTF_GATEWAY | RTF_UP;
- memcpy(addr,adr_gw,4);
+ memmove(addr,adr_gw,4);
ioctl(fd,SIOCADDRT,&re);
close(fd);
return;
}
-
-void netGetDefaultRoute( char *ip )
+#endif
+void netGetDefaultRoute( std::string &ip )
{
FILE *fp;
char interface[9];
- unsigned char destination[4];
- unsigned char gateway[4];
+ uint32_t destination;
+ uint32_t gw;
+ uint8_t gateway[4];
char zeile[256];
- *ip = 0 ;
+ ip = "";
fp = fopen("/proc/net/route","r");
if (fp == NULL)
return;
- fgets(zeile,sizeof(zeile),fp);
+ fgets(zeile,sizeof(zeile),fp); /* skip header */
while(fgets(zeile,sizeof(zeile),fp))
{
- sscanf(zeile,"%8s %x %x",interface,(unsigned *) destination,(unsigned *) gateway);
- if (*(unsigned *)destination == 0)
- {
- sprintf(ip,"%d.%d.%d.%d",gateway[0],gateway[1],gateway[2],gateway[3]);
- break;
- }
+ destination = 1; /* in case sscanf fails */
+ sscanf(zeile,"%8s %x %x", interface, &destination, &gw);
+ if (destination)
+ continue;
+ /* big/little endian kernels have reversed entries, so this is correct */
+ memcpy(gateway, &gw, 4);
+ char tmp[80];
+ snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d", gateway[0], gateway[1], gateway[2], gateway[3]);
+ ip = std::string(tmp);
+ break;
}
fclose(fp);
}
+#if 0
static char dombuf[256];
-static char hostbuf[256];
static char domis=0;
-static char hostis=0;
-
+//never used
char *netGetDomainname( void )
{
if (!domis)
@@ -194,50 +207,55 @@ void netSetDomainname( char *dom )
domis=1;
setdomainname(dombuf,strlen(dombuf)+1);
}
-
-char *netGetHostname( void )
+#endif
+void netGetHostname( std::string &host )
{
- if (!hostis)
- gethostname( hostbuf, 256 );
- hostis=1;
- return hostbuf;
+ host = "";
+ char hostbuf[256];
+ if (!gethostname(hostbuf, sizeof(hostbuf)))
+ host = std::string(hostbuf);
}
-void netSetHostname( char *host )
+void netSetHostname( std::string &host )
{
- strcpy(hostbuf,host);
- hostis=1;
- sethostname(hostbuf,strlen(hostbuf)+1);
+ FILE * fp;
+
+ sethostname(host.c_str(), host.length());
+ fp = fopen("/etc/hostname", "w");
+ if(fp != NULL) {
+ fprintf(fp, "%s\n", host.c_str());
+ fclose(fp);
+ }
}
-void netSetNameserver(const char * const ip)
+void netSetNameserver(std::string &ip)
{
FILE *fp;
- char *dom;
fp = fopen("/etc/resolv.conf","w");
if (!fp)
return;
#if 0
+ char *dom;
dom=netGetDomainname();
if (dom && strlen(dom)>2)
fprintf(fp,"search %s\n",dom);
#endif
fprintf(fp, "# generated by neutrino\n");
- if ((ip != NULL) && (strlen(ip) > 0))
- fprintf(fp,"nameserver %s\n",ip);
+ if (!ip.empty())
+ fprintf(fp,"nameserver %s\n",ip.c_str());
fclose(fp);
}
-void netGetNameserver( char *ip )
+void netGetNameserver( std::string &ip )
{
FILE *fp;
char zeile[256];
- char *index;
+ char *indexLocal;
unsigned zaehler;
- *ip = 0;
+ ip = "";
fp = fopen("/etc/resolv.conf","r");
if (!fp)
return;
@@ -246,15 +264,36 @@ void netGetNameserver( char *ip )
{
if (!strncasecmp(zeile,"nameserver",10))
{
- index = zeile + 10;
- while ( (*index == ' ') || (*index == '\t') )
- index++;
+ char tmp[20];
+ indexLocal = zeile + 10;
+ while ( (*indexLocal == ' ') || (*indexLocal == '\t') )
+ indexLocal++;
zaehler = 0;
- while ( (zaehler < 15) && ( ((*index >= '0') && (*index <= '9')) || (*index == '.')))
- ip[zaehler++] = *(index++);
- ip[zaehler] = 0;
+ while ( (zaehler < 15) && ( ((*indexLocal >= '0') && (*indexLocal <= '9')) || (*indexLocal == '.')))
+ tmp[zaehler++] = *(indexLocal++);
+ tmp[zaehler] = 0;
+ ip = std::string(tmp);
break;
}
}
fclose(fp);
}
+
+void netGetMacAddr(std::string &ifname, unsigned char *mac)
+{
+ int fd;
+ struct ifreq ifr;
+
+ memset(mac, 0, 6);
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if(fd < 0)
+ return;
+
+ ifr.ifr_addr.sa_family = AF_INET;
+ strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name));
+
+ if(ioctl(fd, SIOCGIFHWADDR, &ifr) < 0)
+ return;
+
+ memmove(mac, ifr.ifr_hwaddr.sa_data, 6);
+}
diff --git a/misc/libs/libnet/libnet.h b/misc/libs/libnet/libnet.h
index a1ddad9..37b1794 100644
--- a/misc/libs/libnet/libnet.h
+++ b/misc/libs/libnet/libnet.h
@@ -1,27 +1,18 @@
#ifndef __libnet__
#define __libnet__
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-extern int netSetIP( char *dev, char *ip, char *mask, char *brdcast );
-extern void netGetIP( char *dev, char *ip, char *mask, char *brdcast );
-extern void netSetDefaultRoute( char *gw );
-extern void netGetDefaultRoute( char *ip );
-extern char *netGetDomainname( void );
-extern void netSetDomainname( char *dom );
-extern char *netGetHostname( void );
-extern void netSetHostname( char *host );
-extern void netSetNameserver(const char *ip);
-extern void netGetNameserver( char *ip );
-
-
-#ifdef __cplusplus
-}
-#endif
+#include <string>
+int netSetIP(std::string &dev, std::string &ip, std::string &mask, std::string &brdcast );
+void netGetIP(std::string &dev, std::string &ip, std::string &mask, std::string &brdcast );
+void netSetDefaultRoute( std::string &gw );
+void netGetDefaultRoute( std::string &ip );
+void netGetDomainname( std::string &dom );
+void netSetDomainname( std::string &dom );
+void netGetHostname( std::string &host );
+void netSetHostname( std::string &host );
+void netSetNameserver(std::string &ip);
+void netGetNameserver( std::string &ip );
+void netGetMacAddr(std::string & ifname, unsigned char *);
#endif
diff --git a/tuxbox/neutrino/src/gui/network_setup.cpp b/tuxbox/neutrino/src/gui/network_setup.cpp
index f4906aa..50abdda 100644
--- a/tuxbox/neutrino/src/gui/network_setup.cpp
+++ b/tuxbox/neutrino/src/gui/network_setup.cpp
@@ -455,11 +455,9 @@ void CNetworkSetup::restoreNetworkSettings(bool show_message)
void CNetworkSetup::testNetworkSettings()
{
- char our_ip[16];
- char our_mask[16];
- char our_broadcast[16];
- char our_gateway[16];
- char our_nameserver[16];
+ std::string ifname = "eth0";
+ std::string our_ip, our_mask, our_broadcast, our_gateway, our_nameserver;
+
std::string text, ethID, testsite;
//set default testdomain and wiki-IP
std::string defaultsite = "www.google.de", wiki_IP = "91.224.67.93";
@@ -479,36 +477,36 @@ void CNetworkSetup::testNetworkSettings()
testsite = defaultsite;
if (networkConfig->inet_static) {
- strcpy(our_ip, networkConfig->address.c_str());
- strcpy(our_mask, networkConfig->netmask.c_str());
- strcpy(our_broadcast, networkConfig->broadcast.c_str());
- strcpy(our_gateway, networkConfig->gateway.c_str());
- strcpy(our_nameserver, networkConfig->nameserver.c_str());
+ our_ip = networkConfig->address;
+ our_mask = networkConfig->netmask;
+ our_broadcast = networkConfig->broadcast;
+ our_gateway = networkConfig->gateway;
+ our_nameserver = networkConfig->nameserver;
}
else {
- netGetIP("eth0", our_ip, our_mask, our_broadcast);
+ netGetIP(ifname, our_ip, our_mask, our_broadcast);
netGetDefaultRoute(our_gateway);
netGetNameserver(our_nameserver);
}
- printf("testNw IP: %s\n", our_ip);
+ printf("testNw IP: %s\n", our_ip.c_str());
printf("testNw MAC-address: %s\n", ethID.c_str());
- printf("testNw Netmask: %s\n", our_mask);
- printf("testNw Broadcast: %s\n", our_broadcast);
- printf("testNw Gateway: %s\n", our_gateway);
- printf("testNw Nameserver: %s\n", our_nameserver);
+ printf("testNw Netmask: %s\n", our_mask.c_str());
+ printf("testNw Broadcast: %s\n", our_broadcast.c_str());
+ printf("testNw Gateway: %s\n", our_gateway.c_str());
+ printf("testNw Nameserver: %s\n", our_nameserver.c_str());
printf("testNw Testsite %s\n", testsite.c_str());
text = (std::string)"dbox:\n"
- + " " + our_ip + ": " + mypinghost(our_ip) + '\n'
+ + " " + our_ip + ": " + mypinghost(our_ip.c_str()) + '\n'
+ " " + "eth-ID: " + ethID + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY) + ":\n"
- + " " + our_gateway + ": " + ' ' + mypinghost(our_gateway) + '\n'
+ + " " + our_gateway + ": " + ' ' + mypinghost(our_gateway.c_str()) + '\n'
+ g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER) + ":\n"
- + " " + our_nameserver + ": " + ' ' + mypinghost(our_nameserver) + '\n'
+ + " " + our_nameserver + ": " + ' ' + mypinghost(our_nameserver.c_str()) + '\n'
+ "wiki.tuxbox.org:\n"
+ " via IP (" + wiki_IP + "): " + mypinghost(wiki_IP.c_str()) + '\n';
- if (1 == pinghost(our_nameserver)) text += (std::string)
+ if (1 == pinghost(our_nameserver.c_str())) text += (std::string)
" via DNS: " + mypinghost("wiki.tuxbox.org") + '\n'
+ testsite + ":\n"
+ " via DNS: " + mypinghost(testsite.c_str()) + '\n';
@@ -518,15 +516,11 @@ void CNetworkSetup::testNetworkSettings()
void CNetworkSetup::showCurrentNetworkSettings()
{
- char ip[16];
- char mask[16];
- char broadcast[16];
- char router[16];
- char nameserver[16];
- std::string text;
-
- netGetIP("eth0", ip, mask, broadcast);
- if (ip[0] == 0) {
+ std::string ifname = "eth0";
+ std::string ip, mask, broadcast, router, nameserver, text;
+ netGetIP(ifname, ip, mask, broadcast);
+
+ if (ip.empty()) {
text = g_Locale->getText(LOCALE_NETWORKMENU_INACTIVE);
}
else {
diff --git a/tuxbox/neutrino/src/system/Makefile.am b/tuxbox/neutrino/src/system/Makefile.am
index 6949593..6254b90 100644
--- a/tuxbox/neutrino/src/system/Makefile.am
+++ b/tuxbox/neutrino/src/system/Makefile.am
@@ -15,10 +15,15 @@ endif
noinst_LIBRARIES = libneutrino_system.a
libneutrino_system_a_SOURCES = \
- localize.cpp setting_helpers.cpp debug.cpp \
- ping.c flashtool.cpp \
- settings.cpp lastchannel.cpp \
- configure_network.cpp helper.cpp
+ localize.cpp \
+ setting_helpers.cpp \
+ debug.cpp \
+ ping.c \
+ flashtool.cpp \
+ settings.cpp \
+ lastchannel.cpp \
+ configure_network.cpp \
+ helper.cpp
if !DISABLE_INTERNET_UPDATE
libneutrino_system_a_SOURCES += httptool.cpp
diff --git a/tuxbox/neutrino/src/system/configure_network.cpp b/tuxbox/neutrino/src/system/configure_network.cpp
index 88314a8..fb8425d 100644
--- a/tuxbox/neutrino/src/system/configure_network.cpp
+++ b/tuxbox/neutrino/src/system/configure_network.cpp
@@ -27,9 +27,7 @@
CNetworkConfig::CNetworkConfig(void)
{
- char our_nameserver[16];
- netGetNameserver(our_nameserver);
- nameserver = our_nameserver;
+ netGetNameserver(nameserver);
inet_static = getInetAttributes("eth0", automatic_start, address, netmask, broadcast, gateway);
copy_to_orig();
}
@@ -93,7 +91,7 @@ void CNetworkConfig::commitConfig(void)
if (nameserver != orig_nameserver)
{
orig_nameserver = nameserver;
- netSetNameserver(nameserver.c_str());
+ netSetNameserver(nameserver);
}
}
diff --git a/tuxbox/neutrino/src/system/setting_helpers.cpp b/tuxbox/neutrino/src/system/setting_helpers.cpp
index 55a78af..538356c 100644
--- a/tuxbox/neutrino/src/system/setting_helpers.cpp
+++ b/tuxbox/neutrino/src/system/setting_helpers.cpp
@@ -241,22 +241,18 @@ std::string getPidof(const std::string& process_name)
//returns interface
std::string getInterface()
{
- char ret[19];
- char ip[3][16];
- char our_ip[3][16];
+ std::string ifname = "eth0";
+ std::string our_ip, our_mask, our_broadcast;
CNetworkConfig *network = CNetworkConfig::getInstance();
if (network->inet_static)
{
- sprintf(ip[0], "%s", network->address.c_str());
- strcpy(our_ip[0], ip[0]);
+ our_ip = network->address;
}
else //Note: netGetIP returns also mask and broadcast, but not needed here
- netGetIP("eth0", our_ip[0]/*IP*/, our_ip[1]/*MASK*/, our_ip[2]/*BROADCAST*/);
-
- sprintf(ret, "%s/24", our_ip[0]);
+ netGetIP(ifname, our_ip, our_mask, our_broadcast);
- return ret;
+ return our_ip + "/24";
}
-----------------------------------------------------------------------
Summary of changes:
misc/libs/libnet/Makefile.am | 2 +-
misc/libs/libnet/{libnet.c => libnet.cpp} | 155 ++++++++++++++--------
misc/libs/libnet/libnet.h | 33 ++---
tuxbox/neutrino/src/gui/network_setup.cpp | 52 ++++----
tuxbox/neutrino/src/system/Makefile.am | 13 ++-
tuxbox/neutrino/src/system/configure_network.cpp | 6 +-
tuxbox/neutrino/src/system/setting_helpers.cpp | 14 +--
7 files changed, 149 insertions(+), 126 deletions(-)
rename misc/libs/libnet/{libnet.c => libnet.cpp} (55%)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-25 18:58:06
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 1b648fcacc68c6a569bb8cb17df924a9375e8f75 (commit)
from c931c9eb31c78842af8b13cfb615daed6635aaf7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1b648fcacc68c6a569bb8cb17df924a9375e8f75
Author: GetAway <get...@t-...>
Date: Mon May 25 20:57:14 2015 +0200
neutrino: fix load mac-address
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp
index 451a06e..31a7707 100644
--- a/tuxbox/neutrino/src/neutrino.cpp
+++ b/tuxbox/neutrino/src/neutrino.cpp
@@ -459,7 +459,7 @@ int CNeutrinoApp::loadSetup()
g_settings.network_nfs[i].password = configfile.getString("network_nfs_password_" + i_str, "");
g_settings.network_nfs[i].mount_options1 = configfile.getString("network_nfs_mount_options1_" + i_str, "ro,soft,udp" );
g_settings.network_nfs[i].mount_options2 = configfile.getString("network_nfs_mount_options2_" + i_str, "nolock,rsize=8192,wsize=8192" );
- g_settings.network_nfs[i].mac = configfile.getString("network_nfs_mac" + i_str, "11:22:33:44:55:66");
+ g_settings.network_nfs[i].mac = configfile.getString("network_nfs_mac_" + i_str, "11:22:33:44:55:66");
}
g_settings.filesystem_is_utf8 = configfile.getBool("filesystem_is_utf8" , true );
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/neutrino.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-25 17:49:51
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via c931c9eb31c78842af8b13cfb615daed6635aaf7 (commit)
from 0f0e7bf3f426d9beb188d921db1afa4b581fa4b9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c931c9eb31c78842af8b13cfb615daed6635aaf7
Author: m4...@gm... <m4...@gm...>
Date: Mon May 25 19:48:46 2015 +0200
convert most char[...] configuration values to std::string
based on martii's code with some changes for dbox
use struct for network_nfs stuff
remove deprecated support for smbfs mount
fix MAC editing if saved char is 'A-F'
and first keypress is keydown
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 1d40283..5132b3f 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -962,8 +962,8 @@ int CMovieBrowser::exec(const char* path, const int playstate)
//umount automount dirs
for(int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- if(g_settings.network_nfs_automount[i])
- umount2(g_settings.network_nfs_local_dir[i],MNT_FORCE);
+ if(g_settings.network_nfs[i].automount)
+ umount2(g_settings.network_nfs[i].local_dir.c_str(), MNT_FORCE);
}
#ifdef ENABLE_GUI_MOUNT
CFSMounter::automount();
@@ -3771,9 +3771,9 @@ CDirMenu::CDirMenu(std::vector<MB_DIR>* dir_list)
{
for(int nfs = 0; nfs < NETWORK_NFS_NR_OF_ENTRIES; nfs++)
{
- if(g_settings.network_nfs_local_dir[nfs][0] != 0)
+ if(!g_settings.network_nfs[nfs].local_dir.empty())
{
- std::string tmp = g_settings.network_nfs_local_dir[nfs];
+ std::string tmp = g_settings.network_nfs[nfs].local_dir;
int result = (*dirList)[i].name.compare( 0,tmp.size(),tmp) ;
//printf("[CDirMenu] (nfs%d) %s == (mb%d) %s (%d)\n",nfs,g_settings.network_nfs_local_dir[nfs],i,(*dirList)[i].name.c_str(),result);
@@ -3809,27 +3809,25 @@ int CDirMenu::exec(CMenuTarget* parent, const std::string & actionKey)
{
if(dirState[number] == DIR_STATE_SERVER_DOWN)
{
- std::string command = "ether-wake ";
- command += g_settings.network_nfs_mac[dirNfsMountNr[number]];
- printf("try to start server: %s\n",command.c_str());
- if(system(command.c_str()) != 0)
+ printf("try to start server: %s %s\n","ether-wake", g_settings.network_nfs[dirNfsMountNr[number]].mac.c_str());
+ if (my_system(2, "ether-wake", g_settings.network_nfs[dirNfsMountNr[number]].mac.c_str()) != 0)
perror("ether-wake failed");
- dirOptionText[number]="STARTE SERVER";
+ dirOptionText[number] = "STARTE SERVER";
}
#ifdef ENABLE_GUI_MOUNT
else if(dirState[number] == DIR_STATE_NOT_MOUNTED)
{
printf("[CDirMenu] try to mount %d,%d\n",number,dirNfsMountNr[number]);
CFSMounter::MountRes res;
- res = CFSMounter::mount( g_settings.network_nfs_ip[dirNfsMountNr[number]].c_str(),
- g_settings.network_nfs_dir[dirNfsMountNr[number]] ,
- g_settings.network_nfs_local_dir[dirNfsMountNr[number]] ,
- (CFSMounter::FSType)g_settings.network_nfs_type[dirNfsMountNr[number]] ,
- g_settings.network_nfs_username[dirNfsMountNr[number]] ,
- g_settings.network_nfs_password[dirNfsMountNr[number]] ,
- g_settings.network_nfs_mount_options1[dirNfsMountNr[number]] ,
- g_settings.network_nfs_mount_options2[dirNfsMountNr[number]] );
+ res = CFSMounter::mount (g_settings.network_nfs[dirNfsMountNr[number]].ip,
+ g_settings.network_nfs[dirNfsMountNr[number]].dir,
+ g_settings.network_nfs[dirNfsMountNr[number]].local_dir,
+ (CFSMounter::FSType)g_settings.network_nfs[dirNfsMountNr[number]].type,
+ g_settings.network_nfs[dirNfsMountNr[number]].username,
+ g_settings.network_nfs[dirNfsMountNr[number]].password,
+ g_settings.network_nfs[dirNfsMountNr[number]].mount_options1,
+ g_settings.network_nfs[dirNfsMountNr[number]].mount_options2 );
if(res == CFSMounter::MRES_OK) // if mount is successful we set the state to active in any case
{
*(*dirList)[number].used = true;
@@ -3872,7 +3870,7 @@ void CDirMenu::updateDirState(void)
// 1st ping server
if(dirNfsMountNr[i] != -1)
{
- int retvalue = pingthost(g_settings.network_nfs_ip[dirNfsMountNr[i]].c_str(), 500); // get ping for 60ms - increased
+ int retvalue = pingthost(g_settings.network_nfs[dirNfsMountNr[i]].ip.c_str(), 500); // get ping for 60ms - increased
if (retvalue == 0)//LOCALE_PING_UNREACHABLE
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_SERVER_DOWN);
@@ -3881,7 +3879,7 @@ void CDirMenu::updateDirState(void)
#ifdef ENABLE_GUI_MOUNT
else if (retvalue == 1)//LOCALE_PING_OK
{
- if(CFSMounter::isMounted (g_settings.network_nfs_local_dir[dirNfsMountNr[i]]) == 0)
+ if(CFSMounter::isMounted (g_settings.network_nfs[dirNfsMountNr[i]].local_dir))
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_NOT_MOUNTED);
dirState[i] = DIR_STATE_NOT_MOUNTED;
diff --git a/tuxbox/neutrino/src/gui/nfs.cpp b/tuxbox/neutrino/src/gui/nfs.cpp
index 0f0cb61..be0c9c3 100644
--- a/tuxbox/neutrino/src/gui/nfs.cpp
+++ b/tuxbox/neutrino/src/gui/nfs.cpp
@@ -61,19 +61,26 @@ CNFSMountGui::CNFSMountGui()
m_nfs_sup = CFSMounter::FS_UNPROBED;
m_cifs_sup = CFSMounter::FS_UNPROBED;
m_lufs_sup = CFSMounter::FS_UNPROBED;
- m_smbfs_sup = CFSMounter::FS_UNPROBED;
-
}
-
-const char * nfs_entry_printf_string[4] =
+std::string CNFSMountGui::getEntryString(int i)
{
- "NFS %s:%s -> %s auto: %4s",
- "CIFS //%s/%s -> %s auto: %4s",
- "FTPFS %s/%s -> %s auto: %4s",
- "SMBFS //%s%s -> %s auto: %4s"
-};
-
+ std::string res;
+ switch(g_settings.network_nfs[i].type) {
+ case CFSMounter::NFS: res = "NFS " + g_settings.network_nfs[i].ip + ":"; break;
+ case CFSMounter::CIFS: res = "CIFS //" + g_settings.network_nfs[i].ip + "/"; break;
+ case CFSMounter::LUFS: res = "FTPS " + g_settings.network_nfs[i].ip + "/"; break;
+ }
+ if (g_settings.network_nfs[i].dir.empty() || g_settings.network_nfs[i].local_dir.empty() || g_settings.network_nfs[i].ip.empty())
+ return "";
+ return res
+ + FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs[i].dir.c_str())
+ + " -> "
+ + FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs[i].local_dir.c_str())
+ + " (auto: "
+ + g_Locale->getText(g_settings.network_nfs[i].automount ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO)
+ + ")";
+}
int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
{
@@ -89,22 +96,14 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
if (m_lufs_sup == CFSMounter::FS_UNPROBED)
m_lufs_sup = CFSMounter::fsSupported(CFSMounter::LUFS);
- if (m_smbfs_sup == CFSMounter::FS_UNPROBED)
- m_smbfs_sup = CFSMounter::fsSupported(CFSMounter::SMBFS);
-
- printf("SUPPORT: NFS: %d, CIFS: %d, LUFS: %d, SMBFS: %d\n", m_nfs_sup, m_cifs_sup, m_lufs_sup, m_smbfs_sup);
+ printf("SUPPORT: NFS: %d, CIFS: %d, LUFS: %d\n", m_nfs_sup, m_cifs_sup, m_lufs_sup);
if (actionKey.empty())
{
parent->hide();
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- sprintf(m_entry[i],
- nfs_entry_printf_string[(g_settings.network_nfs_type[i] == (int) CFSMounter::NFS) ? 0 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::CIFS) ? 1 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::SMBFS) ? 3 : 2))],
- g_settings.network_nfs_ip[i].c_str(),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_dir[i]),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_local_dir[i]),
- g_Locale->getText(g_settings.network_nfs_automount[i] ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO));
+ m_entry[i] = getEntryString(i);
}
returnval = menu();
}
@@ -114,23 +113,18 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
returnval = menuEntry(actionKey[10]-'0');
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- sprintf(m_entry[i],
- nfs_entry_printf_string[(g_settings.network_nfs_type[i] == (int) CFSMounter::NFS) ? 0 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::CIFS) ? 1 : ((g_settings.network_nfs_type[i] == (int) CFSMounter::SMBFS) ? 3 : 2))],
- g_settings.network_nfs_ip[i].c_str(),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_dir[i]),
- FILESYSTEM_ENCODING_TO_UTF8(g_settings.network_nfs_local_dir[i]),
- g_Locale->getText(g_settings.network_nfs_automount[i] ? LOCALE_MESSAGEBOX_YES : LOCALE_MESSAGEBOX_NO));
- sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
+ m_entry[i] = getEntryString(i);
+ ISO_8859_1_entry[i] = ZapitTools::UTF8_to_Latin1(m_entry[i].c_str());
}
}
else if(actionKey.substr(0,7)=="domount")
{
int nr=atoi(actionKey.substr(7,1).c_str());
CFSMounter::MountRes mres = CFSMounter::mount(
- g_settings.network_nfs_ip[nr].c_str(), g_settings.network_nfs_dir[nr],
- g_settings.network_nfs_local_dir[nr], (CFSMounter::FSType) g_settings.network_nfs_type[nr],
- g_settings.network_nfs_username[nr], g_settings.network_nfs_password[nr],
- g_settings.network_nfs_mount_options1[nr], g_settings.network_nfs_mount_options2[nr]);
+ g_settings.network_nfs[nr].ip, g_settings.network_nfs[nr].dir,
+ g_settings.network_nfs[nr].local_dir, (CFSMounter::FSType) g_settings.network_nfs[nr].type,
+ g_settings.network_nfs[nr].username, g_settings.network_nfs[nr].password,
+ g_settings.network_nfs[nr].mount_options1, g_settings.network_nfs[nr].mount_options2);
if (mres == CFSMounter::MRES_OK || mres == CFSMounter::MRES_FS_ALREADY_MOUNTED)
mountMenuEntry[nr]->iconName = NEUTRINO_ICON_MOUNTED;
else
@@ -145,8 +139,8 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
CFileBrowser b;
b.Dir_Mode=true;
- if (b.exec(g_settings.network_nfs_local_dir[nr]))
- strcpy(g_settings.network_nfs_local_dir[nr], b.getSelectedFile()->Name.c_str());
+ if (b.exec(g_settings.network_nfs[nr].local_dir.c_str()))
+ g_settings.network_nfs[nr].local_dir = b.getSelectedFile()->Name;
returnval = menu_return::RETURN_REPAINT;
}
@@ -161,9 +155,9 @@ int CNFSMountGui::menu()
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
std::string s2 = "mountentry" + to_string(i);
- sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
+ ISO_8859_1_entry[i] = ZapitTools::UTF8_to_Latin1(m_entry[i].c_str());
mountMenuEntry[i] = new CMenuForwarder("", true, ISO_8859_1_entry[i], this, s2.c_str());
- if (CFSMounter::isMounted(g_settings.network_nfs_local_dir[i]))
+ if (CFSMounter::isMounted(g_settings.network_nfs[i].local_dir))
mountMenuEntry[i]->iconName = NEUTRINO_ICON_MOUNTED;
else
mountMenuEntry[i]->iconName = NEUTRINO_ICON_NOT_MOUNTED;
@@ -185,78 +179,64 @@ const CMenuOptionChooser::keyval NFS_TYPE_OPTIONS[NFS_TYPE_OPTION_COUNT] =
{
{ CFSMounter::NFS , LOCALE_NFS_TYPE_NFS },
{ CFSMounter::CIFS, LOCALE_NFS_TYPE_CIFS },
- { CFSMounter::LUFS, LOCALE_NFS_TYPE_LUFS },
- { CFSMounter::SMBFS, LOCALE_NFS_TYPE_SMBFS }
+ { CFSMounter::LUFS, LOCALE_NFS_TYPE_LUFS }
};
int CNFSMountGui::menuEntry(int nr)
{
- char *dir,*local_dir, *username, *password, *options1, *options2, *mac;
- int* automount;
- int* type;
- std::string cmd = "domount" + to_string(nr);
- std::string cmd2 = "dir" + to_string(nr);
-
- dir = g_settings.network_nfs_dir[nr];
- local_dir = g_settings.network_nfs_local_dir[nr];
- username = g_settings.network_nfs_username[nr];
- password = g_settings.network_nfs_password[nr];
- automount = &g_settings.network_nfs_automount[nr];
- type = &g_settings.network_nfs_type[nr];
- options1 = g_settings.network_nfs_mount_options1[nr];
- options2 = g_settings.network_nfs_mount_options2[nr];
- mac = g_settings.network_nfs_mac[nr];
-
- /* rewrite fstype in new entries */
- if(strlen(local_dir)==0)
- {
- if(m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_lufs_sup == CFSMounter::FS_UNSUPPORTED && m_smbfs_sup == CFSMounter::FS_UNSUPPORTED)
- *type = (int) CFSMounter::CIFS;
-
- else if(m_lufs_sup != CFSMounter::FS_UNSUPPORTED && m_cifs_sup == CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_smbfs_sup == CFSMounter::FS_UNSUPPORTED)
- *type = (int) CFSMounter::LUFS;
-
- else if(m_smbfs_sup != CFSMounter::FS_UNSUPPORTED && m_cifs_sup == CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_lufs_sup == CFSMounter::FS_UNSUPPORTED)
- *type = (int) CFSMounter::SMBFS;
- }
- bool typeEnabled = (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup != CFSMounter::FS_UNSUPPORTED && m_lufs_sup != CFSMounter::FS_UNSUPPORTED && m_smbfs_sup != CFSMounter::FS_UNSUPPORTED) ||
- (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::CIFS) ||
- (m_nfs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::NFS) ||
- (m_lufs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::LUFS) ||
- (m_smbfs_sup != CFSMounter::FS_UNSUPPORTED && *type != (int)CFSMounter::SMBFS);
+ /* rewrite fstype in new entries */
+ if(g_settings.network_nfs[nr].local_dir.empty()) {
+ if(m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED && m_lufs_sup == CFSMounter::FS_UNSUPPORTED)
+ g_settings.network_nfs[nr].type = (int) CFSMounter::CIFS;
+ else if(m_lufs_sup != CFSMounter::FS_UNSUPPORTED && m_cifs_sup == CFSMounter::FS_UNSUPPORTED && m_nfs_sup == CFSMounter::FS_UNSUPPORTED)
+ g_settings.network_nfs[nr].type = (int) CFSMounter::LUFS;
+ }
+ bool typeEnabled = (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && m_nfs_sup != CFSMounter::FS_UNSUPPORTED && m_lufs_sup != CFSMounter::FS_UNSUPPORTED) ||
+ (m_cifs_sup != CFSMounter::FS_UNSUPPORTED && g_settings.network_nfs[nr].type != (int)CFSMounter::CIFS) ||
+ (m_nfs_sup != CFSMounter::FS_UNSUPPORTED && g_settings.network_nfs[nr].type != (int)CFSMounter::NFS) ||
+ (m_lufs_sup != CFSMounter::FS_UNSUPPORTED && g_settings.network_nfs[nr].type != (int)CFSMounter::LUFS);
CMenuWidget mountMenuEntryW(LOCALE_NFS_MOUNT, NEUTRINO_ICON_STREAMING,720);
mountMenuEntryW.addIntroItems();
- CIPInput ipInput(LOCALE_NFS_IP, g_settings.network_nfs_ip[nr]);
- CStringInputSMS dirInput(LOCALE_NFS_DIR, dir, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE,"abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuOptionChooser *automountInput= new CMenuOptionChooser(LOCALE_NFS_AUTOMOUNT, automount, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
- CStringInputSMS options1Input(LOCALE_NFS_MOUNT_OPTIONS, options1, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
- CMenuForwarder *options1_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, options1, &options1Input);
- CStringInputSMS options2Input(LOCALE_NFS_MOUNT_OPTIONS, options2, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
- CMenuForwarder *options2_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, options2, &options2Input);
- CStringInputSMS userInput(LOCALE_NFS_USERNAME, username, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (*type != (int)CFSMounter::NFS), username, &userInput);
- CStringInputSMS passInput(LOCALE_NFS_PASSWORD, password, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (*type != (int)CFSMounter::NFS), NULL, &passInput);
- CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs_mac[nr]);
- CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs_mac[nr], &macInput);
- CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs_local_dir[nr])), NULL, this, cmd.c_str());
+
+ CIPInput ipInput(LOCALE_NFS_IP, g_settings.network_nfs[nr].ip);
+ CStringInputSMS dirInput(LOCALE_NFS_DIR, &g_settings.network_nfs[nr].dir, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE,"abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
+
+ CMenuOptionChooser *automountInput= new CMenuOptionChooser(LOCALE_NFS_AUTOMOUNT, &g_settings.network_nfs[nr].automount, MESSAGEBOX_NO_YES_OPTIONS, MESSAGEBOX_NO_YES_OPTION_COUNT, true);
+
+ CStringInputSMS options1Input(LOCALE_NFS_MOUNT_OPTIONS, &g_settings.network_nfs[nr].mount_options1, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
+ CMenuForwarder *options1_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, g_settings.network_nfs[nr].mount_options1, &options1Input);
+
+ CStringInputSMS options2Input(LOCALE_NFS_MOUNT_OPTIONS, &g_settings.network_nfs[nr].mount_options2, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
+ CMenuForwarder *options2_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, g_settings.network_nfs[nr].mount_options2, &options2Input);
+
+ CStringInputSMS userInput(LOCALE_NFS_USERNAME, &g_settings.network_nfs[nr].username, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
+ CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (g_settings.network_nfs[nr].type != (int)CFSMounter::NFS), NULL, &userInput);
+
+ CStringInputSMS passInput(LOCALE_NFS_PASSWORD, &g_settings.network_nfs[nr].password, 30, false, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
+ CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (g_settings.network_nfs[nr].type != (int)CFSMounter::NFS), NULL, &passInput);
+
+ CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs[nr].mac);
+ CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs[nr].mac, &macInput);
+
+ CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs[nr].local_dir)), NULL, this, ("domount" + to_string(nr)).c_str(), CRCInput::RC_red);
mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
COnOffNotifier notifier(CFSMounter::NFS);
notifier.addItem(username_fwd);
notifier.addItem(password_fwd);
- mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, ¬ifier));
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs_ip[nr], &ipInput ));
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_DIR , true, dir , &dirInput ));
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_LOCALDIR, true, local_dir , this , cmd2.c_str()));
+ mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, &g_settings.network_nfs[nr].type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, ¬ifier ));
+ mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs[nr].ip, &ipInput ));
+ mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_DIR , true, g_settings.network_nfs[nr].dir, &dirInput ));
+ mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_LOCALDIR, true, g_settings.network_nfs[nr].local_dir, this, ("dir" + to_string(nr)).c_str() ));
mountMenuEntryW.addItem(automountInput);
mountMenuEntryW.addItem(options1_fwd);
mountMenuEntryW.addItem(options2_fwd);
mountMenuEntryW.addItem(username_fwd);
mountMenuEntryW.addItem(password_fwd);
mountMenuEntryW.addItem(macInput_fwd);
+ mountMenuEntryW.addItem(GenericMenuSeparatorLine);
mountMenuEntryW.addItem(mountnow_fwd);
int ret = mountMenuEntryW.exec(this,"");
@@ -293,7 +273,7 @@ int CNFSUmountGui::menu()
for (CFSMounter::MountInfos::const_iterator it = infos.begin();
it != infos.end(); ++it)
{
- if(it->type == "nfs" || it->type == "cifs" || it->type == "lufs" || it->type == "smbfs")
+ if(it->type == "nfs" || it->type == "cifs" || it->type == "lufs")
{
count++;
std::string s1 = it->device;
@@ -334,8 +314,8 @@ int CNFSSmallMenu::exec( CMenuTarget* parent, const std::string & actionKey )
//umount automount dirs
for(int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- if(g_settings.network_nfs_automount[i])
- umount2(g_settings.network_nfs_local_dir[i],MNT_FORCE);
+ if(g_settings.network_nfs[i].automount)
+ umount2(g_settings.network_nfs[i].local_dir.c_str(), MNT_FORCE);
}
CFSMounter::automount();
return menu_return::RETURN_REPAINT;
diff --git a/tuxbox/neutrino/src/gui/nfs.h b/tuxbox/neutrino/src/gui/nfs.h
index ea2c343..d8e0ddb 100644
--- a/tuxbox/neutrino/src/gui/nfs.h
+++ b/tuxbox/neutrino/src/gui/nfs.h
@@ -45,15 +45,16 @@ class CNFSMountGui : public CMenuTarget
int menu();
int menuEntry(int nr);
- char m_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
- char ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
+ std::string m_entry[NETWORK_NFS_NR_OF_ENTRIES];
+ std::string ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES];
+
+ std::string getEntryString(int i);
CMenuForwarder* mountMenuEntry[NETWORK_NFS_NR_OF_ENTRIES];
CFSMounter::FS_Support m_nfs_sup;
CFSMounter::FS_Support m_cifs_sup;
CFSMounter::FS_Support m_lufs_sup;
- CFSMounter::FS_Support m_smbfs_sup;
public:
CNFSMountGui();
diff --git a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
index 8582903..683cac1 100755
--- a/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
+++ b/tuxbox/neutrino/src/gui/widget/dirchooser.cpp
@@ -166,7 +166,7 @@ void CRecDirChooser::initMenu(void)
//printf("dir %d = nfs: %d\n",i,nfsIndex[i]);
if( nfsIndex[i] != -1)
{
- int retvalue = pingthost(g_settings.network_nfs_ip[nfsIndex[i]].c_str(),60); // send ping and wait 60ms
+ int retvalue = pingthost(g_settings.network_nfs[nfsIndex[i]].ip.c_str(),60); // send ping and wait 60ms
if (retvalue == 0)//LOCALE_PING_UNREACHABLE
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_SERVER_DOWN);
@@ -176,7 +176,7 @@ void CRecDirChooser::initMenu(void)
else if (retvalue == 1)//LOCALE_PING_OK
{
// check if we can get more dir informations
- if( CFSMounter::isMounted (g_settings.network_nfs_local_dir[nfsIndex[i]]) == 0)
+ if (CFSMounter::isMounted (g_settings.network_nfs[nfsIndex[i]].local_dir))
{
dirOptionText[i] = g_Locale->getText(LOCALE_RECDIRCHOOSER_NOT_MOUNTED);
get_size = false;
@@ -288,8 +288,8 @@ int getNFSIDOfDir(const char * dir)
bool loop = true;
for (int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES && loop; i++)
{
- if (g_settings.network_nfs_local_dir[i][0] != 0 &&
- strstr(dir,g_settings.network_nfs_local_dir[i]) == dir)
+ if (g_settings.network_nfs[i].local_dir[0] != 0 &&
+ g_settings.network_nfs[i].local_dir == dir)
{
result = i;
loop = false;
@@ -330,7 +330,7 @@ int getFirstFreeRecDirNr(int min_free_gb)
if( nfs_id != -1 )
{
printf("NFS%d", nfs_id);
- int retvalue = pingthost(g_settings.network_nfs_ip[nfs_id].c_str(),60); // ping for 60 ms
+ int retvalue = pingthost(g_settings.network_nfs[nfs_id].ip.c_str(), 60); // ping for 60 ms
if (retvalue == 0) //LOCALE_PING_UNREACHABLE
{
printf(",Server down ");
@@ -338,16 +338,16 @@ int getFirstFreeRecDirNr(int min_free_gb)
#ifdef ENABLE_GUI_MOUNT
else if (retvalue == 1) //LOCALE_PING_OK
{
- if(CFSMounter::isMounted (g_settings.network_nfs_local_dir[nfs_id]) == 0)
+ if (CFSMounter::isMounted (g_settings.network_nfs[nfs_id].local_dir))
{
- CFSMounter::MountRes mres = CFSMounter::mount(g_settings.network_nfs_ip[nfs_id].c_str(),
- g_settings.network_nfs_dir[nfs_id],
- g_settings.network_nfs_local_dir[nfs_id],
- (CFSMounter::FSType) g_settings.network_nfs_type[nfs_id],
- g_settings.network_nfs_username[nfs_id],
- g_settings.network_nfs_password[nfs_id],
- g_settings.network_nfs_mount_options1[nfs_id],
- g_settings.network_nfs_mount_options2[nfs_id]);
+ CFSMounter::MountRes mres = CFSMounter::mount(g_settings.network_nfs[nfs_id].ip,
+ g_settings.network_nfs[nfs_id].dir,
+ g_settings.network_nfs[nfs_id].local_dir,
+ (CFSMounter::FSType) g_settings.network_nfs[nfs_id].type,
+ g_settings.network_nfs[nfs_id].username,
+ g_settings.network_nfs[nfs_id].password,
+ g_settings.network_nfs[nfs_id].mount_options1,
+ g_settings.network_nfs[nfs_id].mount_options2 );
if (mres != CFSMounter::MRES_OK)
{
printf(",mount failed");
diff --git a/tuxbox/neutrino/src/gui/widget/mountchooser.cpp b/tuxbox/neutrino/src/gui/widget/mountchooser.cpp
index deb9c87..1f29061 100644
--- a/tuxbox/neutrino/src/gui/widget/mountchooser.cpp
+++ b/tuxbox/neutrino/src/gui/widget/mountchooser.cpp
@@ -48,21 +48,20 @@ CMountChooser::CMountChooser(const neutrino_locale_t Name, const std::string & I
char indexStr[2];
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- if (g_settings.network_nfs_local_dir[i] != NULL &&
- strcmp(g_settings.network_nfs_local_dir[i],"") != 0 &&
- (strstr(g_settings.network_nfs_mount_options1[i],"rw") != NULL ||
- strstr(g_settings.network_nfs_mount_options2[i],"rw") != NULL))
+ if (!g_settings.network_nfs[i].local_dir.empty() &&
+ (g_settings.network_nfs[i].mount_options1.find("rw") != string::npos ||
+ g_settings.network_nfs[i].mount_options2.find("rw") != string::npos))
{
- std::string s(g_settings.network_nfs_local_dir[i]);
+ std::string s(g_settings.network_nfs[i].local_dir);
s += " (";
- s += g_settings.network_nfs_ip[i];
+ s += g_settings.network_nfs[i].ip;
s += ":";
- s += g_settings.network_nfs_dir[i];
+ s += g_settings.network_nfs[i].dir;
s +=")";
snprintf(indexStr,2,"%d",i);
CMenuForwarder* fw = new CMenuForwarder(s.c_str(), true, NULL, this, (std::string("MID:") + std::string(indexStr)).c_str());
fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
- addItem(fw, (strcmp(selectedLocalDir, g_settings.network_nfs_local_dir[i]) == 0));
+ addItem(fw, selectedLocalDir == g_settings.network_nfs[i].local_dir);
}
}
}
@@ -80,8 +79,9 @@ int CMountChooser::exec(CMenuTarget* parent, const std::string & actionKey)
{
if (index)
*index = mount_id;
- if (localDir)
- strcpy(localDir,g_settings.network_nfs_local_dir[mount_id]);
+
+ if (localDir.empty()) // ???
+ localDir = g_settings.network_nfs[mount_id].local_dir;
}
hide();
return menu_return::RETURN_EXIT;
diff --git a/tuxbox/neutrino/src/gui/widget/mountchooser.h b/tuxbox/neutrino/src/gui/widget/mountchooser.h
index da7a030..d22dd07 100644
--- a/tuxbox/neutrino/src/gui/widget/mountchooser.h
+++ b/tuxbox/neutrino/src/gui/widget/mountchooser.h
@@ -52,7 +52,7 @@ class CMountChooser : public CMenuWidget
{
private:
int * index;
- char * localDir;
+ std::string localDir;
public:
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
index 74c6bdc..7db7e6b 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
@@ -537,40 +537,41 @@ void CDateInput::onAfterExec()
}
//-----------------------------#################################-------------------------------------------------------
-CMACInput::CMACInput(const neutrino_locale_t Name, char* Value, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, CChangeObserver* Observ)
- : CExtendedInput(Name, Value, Hint_1, Hint_2, Observ)
+CMACInput::CMACInput(const neutrino_locale_t Name, std::string & Value, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, CChangeObserver* Observ)
+ : CExtendedInput(Name, MAC, Hint_1, Hint_2, Observ)
{
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ mac = &Value;
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_Spacer(20) );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
- addInputField( new CExtendedInput_Item_Char("0123456789ABCDEF") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
+ addInputField( new CExtendedInput_Item_Char("0123456789abcdef") );
addInputField( new CExtendedInput_Item_newLiner(30) );
calculateDialog();
}
void CMACInput::onBeforeExec()
{
- if (value[0] == 0) /* strcmp(value, "") == 0 */
+ if (mac->empty())
{
strcpy(value, "00:00:00:00:00:00");
//printf("[neutrino] value-before(2): %s\n", value);
return;
}
int _mac[6];
- sscanf( value, "%x:%x:%x:%x:%x:%x", &_mac[0], &_mac[1], &_mac[2], &_mac[3], &_mac[4], &_mac[5] );
+ sscanf( mac->c_str(), "%x:%x:%x:%x:%x:%x", &_mac[0], &_mac[1], &_mac[2], &_mac[3], &_mac[4], &_mac[5] );
snprintf(value, 20, "%02x:%02x:%02x:%02x:%02x:%02x", _mac[0], _mac[1], _mac[2], _mac[3], _mac[4], _mac[5]);
}
@@ -580,7 +581,11 @@ void CMACInput::onAfterExec()
sscanf( value, "%x:%x:%x:%x:%x:%x", &_mac[0], &_mac[1], &_mac[2], &_mac[3], &_mac[4], &_mac[5] );
snprintf(value, 20, "%02x:%02x:%02x:%02x:%02x:%02x", _mac[0], _mac[1], _mac[2], _mac[3], _mac[4], _mac[5]);
if(strcmp(value,"00:00:00:00:00:00")==0)
- value[0] = 0; /* strcpy(value, ""); */
+ {
+ (*mac) = "";
+ }
+ else
+ (*mac) = value;
}
//-----------------------------#################################-------------------------------------------------------
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.h b/tuxbox/neutrino/src/gui/widget/stringinput_ext.h
index 5d281d3..d280dcb 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.h
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.h
@@ -181,12 +181,15 @@ class CDateInput : public CExtendedInput
class CMACInput : public CExtendedInput
{
+ char MAC[32];
+ std::string * mac;
+
protected:
virtual void onBeforeExec();
virtual void onAfterExec();
public:
- CMACInput(const neutrino_locale_t Name, char* Value, const neutrino_locale_t Hint_1 = LOCALE_IPSETUP_HINT_1, const neutrino_locale_t Hint_2 = LOCALE_IPSETUP_HINT_2, CChangeObserver* Observ = NULL);
+ CMACInput(const neutrino_locale_t Name, std::string & Value, const neutrino_locale_t Hint_1 = LOCALE_IPSETUP_HINT_1, const neutrino_locale_t Hint_2 = LOCALE_IPSETUP_HINT_2, CChangeObserver* Observ = NULL);
};
//----------------------------------------------------------------------------------------------------
diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp
index 852fb75..451a06e 100644
--- a/tuxbox/neutrino/src/neutrino.cpp
+++ b/tuxbox/neutrino/src/neutrino.cpp
@@ -450,16 +450,16 @@ int CNeutrinoApp::loadSetup()
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
std::string i_str(to_string(i));
- g_settings.network_nfs_ip[i] = configfile.getString("network_nfs_ip_" + i_str, "");
- strcpy( g_settings.network_nfs_dir[i] , configfile.getString("network_nfs_dir_" + i_str, "").c_str() );
- strcpy( g_settings.network_nfs_local_dir[i] , configfile.getString("network_nfs_local_dir_" + i_str, "").c_str() );
- g_settings.network_nfs_automount[i] = configfile.getInt32 ("network_nfs_automount_" + i_str, 0);
- g_settings.network_nfs_type[i] = configfile.getInt32 ("network_nfs_type_" + i_str, 0);
- strcpy( g_settings.network_nfs_username[i] , configfile.getString("network_nfs_username_" + i_str, "").c_str() );
- strcpy( g_settings.network_nfs_password[i] , configfile.getString("network_nfs_password_" + i_str, "").c_str() );
- strcpy( g_settings.network_nfs_mount_options1[i], configfile.getString("network_nfs_mount_options1_" + i_str, "ro,soft,udp" ).c_str() );
- strcpy( g_settings.network_nfs_mount_options2[i], configfile.getString("network_nfs_mount_options2_" + i_str, "nolock,rsize=8192,wsize=8192" ).c_str() );
- strcpy( g_settings.network_nfs_mac[i] , configfile.getString("network_nfs_mac" + i_str, "11:22:33:44:55:66").c_str() );
+ g_settings.network_nfs[i].ip = configfile.getString("network_nfs_ip_" + i_str, "");
+ g_settings.network_nfs[i].dir = configfile.getString("network_nfs_dir_" + i_str, "");
+ g_settings.network_nfs[i].local_dir = configfile.getString("network_nfs_local_dir_" + i_str, "");
+ g_settings.network_nfs[i].automount = configfile.getInt32 ("network_nfs_automount_" + i_str, 0);
+ g_settings.network_nfs[i].type = configfile.getInt32 ("network_nfs_type_" + i_str, 0);
+ g_settings.network_nfs[i].username = configfile.getString("network_nfs_username_" + i_str, "");
+ g_settings.network_nfs[i].password = configfile.getString("network_nfs_password_" + i_str, "");
+ g_settings.network_nfs[i].mount_options1 = configfile.getString("network_nfs_mount_options1_" + i_str, "ro,soft,udp" );
+ g_settings.network_nfs[i].mount_options2 = configfile.getString("network_nfs_mount_options2_" + i_str, "nolock,rsize=8192,wsize=8192" );
+ g_settings.network_nfs[i].mac = configfile.getString("network_nfs_mac" + i_str, "11:22:33:44:55:66");
}
g_settings.filesystem_is_utf8 = configfile.getBool("filesystem_is_utf8" , true );
@@ -542,7 +542,7 @@ int CNeutrinoApp::loadSetup()
g_settings.recording_server_ip = configfile.getString("recording_server_ip", "10.10.10.10");
strcpy( g_settings.recording_server_port, configfile.getString( "recording_server_port", "4000").c_str() );
g_settings.recording_server_wakeup = configfile.getInt32( "recording_server_wakeup", 0 );
- strcpy( g_settings.recording_server_mac, configfile.getString( "recording_server_mac", "11:22:33:44:55:66").c_str() );
+ g_settings.recording_server_mac = configfile.getString("recording_server_mac", "11:22:33:44:55:66");
g_settings.recording_vcr_no_scart = configfile.getInt32( "recording_vcr_no_scart", false);
g_settings.recording_max_rectime = configfile.getInt32( "recording_max_rectime", 4 );
strcpy( g_settings.recording_splitsize_default, configfile.getString( "recording_splitsize_default", "2048").c_str() );
@@ -981,16 +981,16 @@ void CNeutrinoApp::saveSetup()
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
std::string i_str(to_string(i));
- configfile.setString("network_nfs_ip_" + i_str , g_settings.network_nfs_ip[i] );
- configfile.setString("network_nfs_dir_" + i_str , g_settings.network_nfs_dir[i] );
- configfile.setString("network_nfs_local_dir_" + i_str , g_settings.network_nfs_local_dir[i] );
- configfile.setInt32 ("network_nfs_automount_" + i_str , g_settings.network_nfs_automount[i]);
- configfile.setInt32 ("network_nfs_type_" + i_str , g_settings.network_nfs_type[i]);
- configfile.setString("network_nfs_username_" + i_str , g_settings.network_nfs_username[i] );
- configfile.setString("network_nfs_password_" + i_str , g_settings.network_nfs_password[i] );
- configfile.setString("network_nfs_mount_options1_" + i_str, g_settings.network_nfs_mount_options1[i]);
- configfile.setString("network_nfs_mount_options2_" + i_str, g_settings.network_nfs_mount_options2[i]);
- configfile.setString("network_nfs_mac_" + i_str , g_settings.network_nfs_mac[i]);
+ configfile.setString("network_nfs_ip_" + i_str , g_settings.network_nfs[i].ip );
+ configfile.setString("network_nfs_dir_" + i_str , g_settings.network_nfs[i].dir );
+ configfile.setString("network_nfs_local_dir_" + i_str , g_settings.network_nfs[i].local_dir );
+ configfile.setInt32 ("network_nfs_automount_" + i_str , g_settings.network_nfs[i].automount );
+ configfile.setInt32 ("network_nfs_type_" + i_str , g_settings.network_nfs[i].type );
+ configfile.setString("network_nfs_username_" + i_str , g_settings.network_nfs[i].username );
+ configfile.setString("network_nfs_password_" + i_str , g_settings.network_nfs[i].password );
+ configfile.setString("network_nfs_mount_options1_" + i_str, g_settings.network_nfs[i].mount_options1 );
+ configfile.setString("network_nfs_mount_options2_" + i_str, g_settings.network_nfs[i].mount_options2 );
+ configfile.setString("network_nfs_mac_" + i_str , g_settings.network_nfs[i].mac );
}
configfile.setBool ( "filesystem_is_utf8" , g_settings.filesystem_is_utf8);
#ifdef ENABLE_SAMBASERVER
@@ -1752,24 +1752,24 @@ bool CNeutrinoApp::doGuiRecord(char * preselectedDir, bool addTimer, char * file
int nfs_nr = getNFSIDOfDir(recDir.c_str());
if(nfs_nr != -1)
{
- recDir = g_settings.network_nfs_local_dir[nfs_nr];
+ recDir = g_settings.network_nfs[nfs_nr].local_dir;
#ifdef ENABLE_GUI_MOUNT
- if (!CFSMounter::isMounted(g_settings.network_nfs_local_dir[nfs_nr]))
+ if (!CFSMounter::isMounted(g_settings.network_nfs[nfs_nr].local_dir))
{
printf("not mounted, try to mount: %d\n",nfs_nr);
CFSMounter::MountRes mres =
- CFSMounter::mount(g_settings.network_nfs_ip[nfs_nr].c_str(),
- g_settings.network_nfs_dir[nfs_nr],
- g_settings.network_nfs_local_dir[nfs_nr],
- (CFSMounter::FSType) g_settings.network_nfs_type[nfs_nr],
- g_settings.network_nfs_username[nfs_nr],
- g_settings.network_nfs_password[nfs_nr],
- g_settings.network_nfs_mount_options1[nfs_nr],
- g_settings.network_nfs_mount_options2[nfs_nr]);
+ CFSMounter::mount(g_settings.network_nfs[nfs_nr].ip,
+ g_settings.network_nfs[nfs_nr].dir,
+ g_settings.network_nfs[nfs_nr].local_dir,
+ (CFSMounter::FSType) g_settings.network_nfs[nfs_nr].type,
+ g_settings.network_nfs[nfs_nr].username,
+ g_settings.network_nfs[nfs_nr].password,
+ g_settings.network_nfs[nfs_nr].mount_options1,
+ g_settings.network_nfs[nfs_nr].mount_options2);
if (mres != CFSMounter::MRES_OK)
{
doRecord = false;
- std::string msg = mntRes2Str(mres) + "\nDir: " + g_settings.network_nfs_local_dir[nfs_nr];
+ std::string msg = mntRes2Str(mres) + "\nDir: " + g_settings.network_nfs[nfs_nr].local_dir;
ShowMsgUTF(LOCALE_MESSAGEBOX_ERROR, msg.c_str(),
CMessageBox::mbrBack, CMessageBox::mbBack,NEUTRINO_ICON_ERROR, 450, 10); // UTF-8
}
@@ -2969,7 +2969,8 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data)
if( g_settings.recording_server_wakeup )
{
- if (my_system(2, "ether-wake", g_settings.recording_server_mac) != 0)
+ printf("[neutrino] waking up %s (rec-server)\n", g_settings.recording_server_mac.c_str());
+ if (my_system(2, "ether-wake", g_settings.recording_server_mac.c_str()) != 0)
perror("ether-wake failed");
}
if (g_settings.recording_type == RECORDING_FILE)
@@ -2977,10 +2978,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data)
char * recDir = eventinfo->recordingDir;
for (int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- if (strcmp(g_settings.network_nfs_local_dir[i],recDir) == 0)
+ if (g_settings.network_nfs[i].local_dir == recDir)
{
- printf("[neutrino] waking up %s (%s)\n",g_settings.network_nfs_ip[i].c_str(),recDir);
- if (my_system(2, "ether-wake", g_settings.network_nfs_mac[i]) != 0)
+ printf("[neutrino] waking up %s (%s)\n", g_settings.network_nfs[i].ip.c_str(), recDir);
+ if (my_system(2, "ether-wake", g_settings.network_nfs[i].mac.c_str()) != 0)
perror("ether-wake failed");
break;
}
@@ -3897,13 +3898,13 @@ void CNeutrinoApp::startNextRecording()
printf("[neutrino.cpp] trying to mount %s\n",recDir);
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- if (strcmp(g_settings.network_nfs_local_dir[i],recDir) == 0)
+ if (g_settings.network_nfs[i].local_dir == recDir)
{
CFSMounter::MountRes mres =
- CFSMounter::mount(g_settings.network_nfs_ip[i].c_str(), g_settings.network_nfs_dir[i],
- g_settings.network_nfs_local_dir[i], (CFSMounter::FSType) g_settings.network_nfs_type[i],
- g_settings.network_nfs_username[i], g_settings.network_nfs_password[i],
- g_settings.network_nfs_mount_options1[i], g_settings.network_nfs_mount_options2[i]);
+ CFSMounter::mount(g_settings.network_nfs[i].ip, g_settings.network_nfs[i].dir,
+ g_settings.network_nfs[i].local_dir, (CFSMounter::FSType) g_settings.network_nfs[i].type,
+ g_settings.network_nfs[i].username, g_settings.network_nfs[i].password,
+ g_settings.network_nfs[i].mount_options1, g_settings.network_nfs[i].mount_options2);
if (mres == CFSMounter::MRES_OK)
{
printf("[neutrino.cpp] mount successful\n");
diff --git a/tuxbox/neutrino/src/system/fsmounter.cpp b/tuxbox/neutrino/src/system/fsmounter.cpp
index 334d492..c612e02 100644
--- a/tuxbox/neutrino/src/system/fsmounter.cpp
+++ b/tuxbox/neutrino/src/system/fsmounter.cpp
@@ -104,8 +104,6 @@ bool insert_modules(const CFSMounter::FSType fstype)
return (system("insmod cifs") == 0);
else if (fstype == CFSMounter::LUFS)
return (system("insmod lufs") == 0);
- else if (fstype == CFSMounter::SMBFS)
- return (system("insmod smbfs") == 0);
return false;
}
@@ -121,8 +119,6 @@ bool remove_modules(const CFSMounter::FSType fstype)
return (system("rmmod cifs") == 0);
else if (fstype == CFSMounter::LUFS)
return (system("rmmod lufs") == 0);
- else if (fstype == CFSMounter::SMBFS)
- return (system("rmmod smbfs") == 0);
return false;
}
@@ -136,8 +132,6 @@ CFSMounter::FS_Support CFSMounter::fsSupported(const CFSMounter::FSType fstype,
fsname = "cifs";
else if (fstype == CFSMounter::LUFS)
fsname = "lufs";
- else if (fstype == CFSMounter::SMBFS)
- fsname = "smbfs";
if (in_proc_filesystems(fsname))
return CFSMounter::FS_READY;
@@ -163,10 +157,10 @@ CFSMounter::FS_Support CFSMounter::fsSupported(const CFSMounter::FSType fstype,
return CFSMounter::FS_UNSUPPORTED;
}
-bool CFSMounter::isMounted(const char * const local_dir)
+bool CFSMounter::isMounted(const std::string &local_dir)
{
std::ifstream in;
- if (local_dir == NULL)
+ if (local_dir.empty())
return false;
#ifdef PATH_MAX
@@ -174,8 +168,8 @@ bool CFSMounter::isMounted(const char * const local_dir)
#else
char mount_point[4096];
#endif
- if (realpath(local_dir, mount_point) == NULL) {
- printf("[CFSMounter] could not resolve dir: %s: %s\n",local_dir, strerror(errno));
+ if (realpath(local_dir.c_str(), mount_point) == NULL) {
+ printf("[CFSMounter] could not resolve dir: %s: %s\n", local_dir.c_str(), strerror(errno));
return false;
}
in.open("/proc/mounts", std::ifstream::in);
@@ -192,11 +186,11 @@ bool CFSMounter::isMounted(const char * const local_dir)
return false;
}
-CFSMounter::MountRes CFSMounter::mount(const char * const ip, const char * const dir, const char * const local_dir,
- const FSType fstype, const char * const username, const char * const password,
- char * options1, char * options2)
+CFSMounter::MountRes CFSMounter::mount(const std::string &ip, const std::string &dir, const std::string &local_dir,
+ const FSType fstype, const std::string &username, const std::string &password,
+ std::string options1, std::string options2)
{
- std::stringstream cmd;
+ std::string cmd;
pthread_mutex_init(&g_mut, NULL);
pthread_cond_init(&g_cond, NULL);
g_mntstatus=-1;
@@ -209,70 +203,92 @@ CFSMounter::MountRes CFSMounter::mount(const char * const ip, const char * const
return MRES_FS_NOT_SUPPORTED;
}
- printf("[CFSMounter] Mount(%d) %s:%s -> %s\n", (int) fstype, ip, dir, local_dir);
+ printf("[CFSMounter] Mount(%d) %s:%s -> %s\n", (int) fstype, ip.c_str(), dir.c_str(), local_dir.c_str());
if (isMounted(local_dir))
{
- printf("[CFSMounter] FS mount error %s already mounted\n", local_dir);
+ printf("[CFSMounter] FS mount error %s already mounted\n", local_dir.c_str());
return MRES_FS_ALREADY_MOUNTED;
}
- if(options1[0] == '\0')
+ if(options1.empty())
{
- strcpy(options1,options2);
- options2[0] = '\0';
+ options1 = options2;
+ options2 = "";
}
-
- if((options1[0] == '\0') && (options2[0] == '\0'))
+
+ if(options1.empty() && options2.empty())
{
if(fstype == NFS)
{
- strcpy(options1,"ro,soft,udp");
- strcpy(options2,"nolock,rsize=8192,wsize=8192");
+ options1 = "ro,soft,udp";
+ options2 = "nolock,rsize=8192,wsize=8192";
}
else if(fstype == CIFS)
{
- strcpy(options1,"ro");
- strcpy(options2,"");
+ options1 = "ro";
+ options2 = "";
}
else if(fstype == LUFS)
{
- strcpy(options1,"");
- strcpy(options2,"");
- }
- else if(fstype == SMBFS)
- {
- strcpy(options1,"");
- strcpy(options2,"");
+ options1 = "";
+ options2 = "";
}
}
if(fstype == NFS)
{
- cmd << "mount -t nfs " << ip << ":" << dir << " " << local_dir << " -o " << options1;
+ cmd = "mount -t nfs ";
+ cmd += ip;
+ cmd += ':';
+ cmd += dir;
+ cmd += ' ';
+ cmd += local_dir;
+ cmd += " -o ";
+ cmd += options1;
}
else if(fstype == CIFS)
{
- cmd << "mount -t cifs " << ip << "/" << dir << " " << local_dir << " -o username=" << username
- << ",password=" << password << ",unc=//" << ip << "/" << dir << "," << options1;
- }
- else if(fstype == SMBFS)
- {
- cmd << "smbmount //" << ip << "/" << dir << " " << password << " " << "-I" << " " << ip << " "
- << "-U" << " " << username << " " << "-c \"mount " << local_dir << "\"" << " ";
+ cmd = "mount -t cifs //";
+ cmd += ip;
+ cmd += '/';
+ cmd += dir;
+ cmd += ' ';
+ cmd += local_dir;
+ cmd += " -o username=";
+ cmd += username;
+ cmd += ",password=";
+ cmd += password;
+ //cmd += ",unc=//"; for whats needed?
+ //cmd += ip;
+ //cmd += '/';
+ //cmd += dir;
+ //cmd += ',';
+ //cmd += options1;
}
else
{
- cmd << "lufsd none " << local_dir << " -o fs=ftpfs,username=" << username
- << ",password=" << password << ",host=" << ip << ",root=/" << dir << "," << options1;
+ cmd = "lufsd none ";
+ cmd += local_dir;
+ cmd += " -o fs=ftpfs,username=";
+ cmd += username;
+ cmd += ",password=";
+ cmd += password;
+ cmd += ",host=";
+ cmd += ip;
+ cmd += ",root=/";
+ cmd += dir;
+ cmd += ',';
+ cmd += options1;
}
- if (options2[0] !='\0')
+ if (!options2.empty())
{
- cmd << "," << options2;
+ cmd += ',';
+ cmd += options2;
}
- pthread_create(&g_mnt, 0, mount_thread, (void *) cmd.str().c_str());
+ pthread_create(&g_mnt, 0, mount_thread, (void *) cmd.c_str());
struct timespec timeout;
int retcode;
@@ -286,10 +302,11 @@ CFSMounter::MountRes CFSMounter::mount(const char * const ip, const char * const
pthread_cancel(g_mnt);
}
pthread_mutex_unlock(&g_mut);
+ pthread_join(g_mnt, NULL);
if ( g_mntstatus != 0 )
{
- printf("[CFSMounter] FS mount error: \"%s\"\n", cmd.str().c_str());
+ printf("[CFSMounter] FS mount error: \"%s\"\n", cmd.c_str());
return (retcode == ETIMEDOUT) ? MRES_TIMEOUT : MRES_UNKNOWN;
}
return MRES_OK;
@@ -301,12 +318,12 @@ bool CFSMounter::automount()
bool res = true;
for(int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES; i++)
{
- if(g_settings.network_nfs_automount[i])
+ if(g_settings.network_nfs[i].automount)
{
- res = (MRES_OK == mount(g_settings.network_nfs_ip[i].c_str(), g_settings.network_nfs_dir[i], g_settings.network_nfs_local_dir[i],
- (FSType) g_settings.network_nfs_type[i], g_settings.network_nfs_username[i],
- g_settings.network_nfs_password[i], g_settings.network_nfs_mount_options1[i],
- g_settings.network_nfs_mount_options2[i])) && res;
+ res = (MRES_OK == mount(g_settings.network_nfs[i].ip, g_settings.network_nfs[i].dir, g_settings.network_nfs[i].local_dir,
+ (FSType) g_settings.network_nfs[i].type, g_settings.network_nfs[i].username,
+ g_settings.network_nfs[i].password, g_settings.network_nfs[i].mount_options1,
+ g_settings.network_nfs[i].mount_options2)) && res;
}
}
return res;
@@ -357,8 +374,7 @@ void CFSMounter::getMountedFS(MountInfos& info)
in.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
if (mi.type == "nfs" ||
mi.type == "cifs" ||
- mi.type == "lufs" ||
- mi.type == "smbfs")
+ mi.type == "lufs" )
{
info.push_back(mi);
printf("[CFSMounter] mounted fs: dev: %s, mp: %s, type: %s\n",
diff --git a/tuxbox/neutrino/src/system/fsmounter.h b/tuxbox/neutrino/src/system/fsmounter.h
index 986ce5a..4f51534 100644
--- a/tuxbox/neutrino/src/system/fsmounter.h
+++ b/tuxbox/neutrino/src/system/fsmounter.h
@@ -60,8 +60,7 @@ class CFSMounter
{
NFS = 0,
CIFS = 1,
- LUFS = 2,
- SMBFS = 3
+ LUFS = 2
};
enum MountRes
@@ -96,10 +95,10 @@ class CFSMounter
*/
public:
CFSMounter();
- static bool isMounted(const char * const local_dir);
- static CFSMounter::MountRes mount(const char * const ip, const char * const dir, const char * const local_dir,
- const FSType fstype, const char * const username, const char * const password,
- char * options1, char * options2);
+ static bool isMounted(const std::string &local_dir);
+ static CFSMounter::MountRes mount(const std::string &ip, const std::string &dir, const std::string &local_dir,
+ const FSType fstype, const std::string &username, const std::string &password,
+ std::string options1, std::string options2);
static bool automount();
static CFSMounter::UMountRes umount(const char * const dir = NULL);
static void getMountedFS(MountInfos& fs);
diff --git a/tuxbox/neutrino/src/system/settings.h b/tuxbox/neutrino/src/system/settings.h
index 17e1ca4..a8e37b9 100644
--- a/tuxbox/neutrino/src/system/settings.h
+++ b/tuxbox/neutrino/src/system/settings.h
@@ -192,16 +192,18 @@ struct SNeutrinoSettings
//network
#define NETWORK_NFS_NR_OF_ENTRIES 8
- std::string network_nfs_ip[NETWORK_NFS_NR_OF_ENTRIES];
- char network_nfs_mac[NETWORK_NFS_NR_OF_ENTRIES][31];
- char network_nfs_local_dir[NETWORK_NFS_NR_OF_ENTRIES][100];
- char network_nfs_dir[NETWORK_NFS_NR_OF_ENTRIES][100];
- int network_nfs_automount[NETWORK_NFS_NR_OF_ENTRIES];
- char network_nfs_mount_options1[NETWORK_NFS_NR_OF_ENTRIES][31];
- char network_nfs_mount_options2[NETWORK_NFS_NR_OF_ENTRIES][31];
- int network_nfs_type[NETWORK_NFS_NR_OF_ENTRIES];
- char network_nfs_username[NETWORK_NFS_NR_OF_ENTRIES][31];
- char network_nfs_password[NETWORK_NFS_NR_OF_ENTRIES][31];
+struct {
+ std::string ip;
+ std::string mac;
+ std::string local_dir;
+ std::string dir;
+ int automount;
+ std::string mount_options1;
+ std::string mount_options2;
+ int type;
+ std::string username;
+ std::string password;
+} network_nfs[NETWORK_NFS_NR_OF_ENTRIES];
//personalization
int personalize_pinstatus;
@@ -261,7 +263,7 @@ struct SNeutrinoSettings
std::string recording_server_ip;
char recording_server_port[10];
int recording_server_wakeup;
- char recording_server_mac[31];
+ std::string recording_server_mac;
int recording_vcr_no_scart;
int recording_max_rectime;
char recording_splitsize_default[10];
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/gui/moviebrowser.cpp | 36 ++---
tuxbox/neutrino/src/gui/nfs.cpp | 162 +++++++++-----------
tuxbox/neutrino/src/gui/nfs.h | 7 +-
tuxbox/neutrino/src/gui/widget/dirchooser.cpp | 28 ++--
tuxbox/neutrino/src/gui/widget/mountchooser.cpp | 20 ++--
tuxbox/neutrino/src/gui/widget/mountchooser.h | 2 +-
tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp | 39 +++--
tuxbox/neutrino/src/gui/widget/stringinput_ext.h | 5 +-
tuxbox/neutrino/src/neutrino.cpp | 83 +++++-----
tuxbox/neutrino/src/system/fsmounter.cpp | 122 +++++++++-------
tuxbox/neutrino/src/system/fsmounter.h | 11 +-
tuxbox/neutrino/src/system/settings.h | 24 ++--
12 files changed, 272 insertions(+), 267 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-23 15:39:58
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 0f0e7bf3f426d9beb188d921db1afa4b581fa4b9 (commit)
from 269f491b571a837eb6efd6a2647a570878bc4ef3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0f0e7bf3f426d9beb188d921db1afa4b581fa4b9
Author: GetAway <get...@t-...>
Date: Sat May 23 17:37:19 2015 +0200
neutrino: use more to_string()
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/gui/alphasetup.cpp b/tuxbox/neutrino/src/gui/alphasetup.cpp
index 2fe47ab..0da2344 100644
--- a/tuxbox/neutrino/src/gui/alphasetup.cpp
+++ b/tuxbox/neutrino/src/gui/alphasetup.cpp
@@ -41,6 +41,7 @@
#include <gui/color.h>
#include <gui/widget/messagebox.h>
+#include <system/helper.h>
#include <fcntl.h>
#include <stdio.h>
@@ -253,7 +254,6 @@ void CAlphaSetup::paint()
void CAlphaSetup::paintSlider(const int _x, const int _y, const unsigned char * const spos, const neutrino_locale_t text, const char * const iconname, const bool /*selected*/) // UTF-8
{
int startx = 170;
- char wert[5];
if (!spos)
return;
@@ -266,7 +266,6 @@ void CAlphaSetup::paintSlider(const int _x, const int _y, const unsigned char *
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(_x, _y + mheight, width, g_Locale->getText(text), COL_MENUCONTENT, 0, true); // UTF-8
- sprintf(wert, "%3d", (*spos)); // UTF-8 encoded
frameBuffer->paintBoxRel(_x + startx + 120 + 10, _y, 50, mheight, COL_MENUCONTENT_PLUS_0);
- g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(_x + startx + 120 + 10, _y + mheight, width, wert, COL_MENUCONTENT, 0, true); // UTF-8
+ g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(_x + startx + 120 + 10, _y + mheight, width, to_string(*spos), COL_MENUCONTENT, 0, true); // UTF-8
}
diff --git a/tuxbox/neutrino/src/gui/audioplayer.cpp b/tuxbox/neutrino/src/gui/audioplayer.cpp
index cecf479..74027a8 100644
--- a/tuxbox/neutrino/src/gui/audioplayer.cpp
+++ b/tuxbox/neutrino/src/gui/audioplayer.cpp
@@ -655,7 +655,6 @@ int CAudioPlayerGui::show()
if (m_key_level == 0)
{
if (m_inetmode) {
- char cnt[5];
CMenuWidget InputSelector(LOCALE_AUDIOPLAYER_LOAD_RADIO_STATIONS, NEUTRINO_ICON_AUDIO, 400);
int count = 0;
int select = -1;
@@ -663,20 +662,17 @@ int CAudioPlayerGui::show()
// -- setup menue for inetradio input
InputSelector.addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
- sprintf(cnt, "%d", count);
InputSelector.addItem(new CMenuForwarder(
LOCALE_AUDIOPLAYER_ADD_LOC, true, NULL, &InetRadioInputChanger,
- cnt, CRCInput::convertDigitToKey(count + 1)), true);
+ to_string(count).c_str(), CRCInput::convertDigitToKey(count + 1)), true);
- sprintf(cnt, "%d", ++count);
InputSelector.addItem(new CMenuForwarder(
LOCALE_AUDIOPLAYER_ADD_SC, true, NULL, &InetRadioInputChanger,
- cnt, CRCInput::convertDigitToKey(count + 1)), false);
+ to_string(count).c_str(), CRCInput::convertDigitToKey(count + 1)), false);
- sprintf(cnt, "%d", ++count);
InputSelector.addItem(new CMenuForwarder(
LOCALE_AUDIOPLAYER_ADD_IC, true, NULL, &InetRadioInputChanger,
- cnt, CRCInput::convertDigitToKey(count + 1)), false);
+ to_string(count).c_str(), CRCInput::convertDigitToKey(count + 1)), false);
hide();
InputSelector.exec(NULL, "");
@@ -2302,15 +2298,14 @@ bool CAudioPlayerGui::getNumericInput(neutrino_msg_t& msg, int& val) {
int y1 = getScreenStartY(0);
int w = 0;
int h = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight();
- char str[11];
do
{
val = val * 10 + CRCInput::getNumericValue(msg);
- sprintf(str, "%d", val);
- w = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(str);
+ std::string value = to_string(val);
+ w = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(value);
m_frameBuffer->paintBoxRel(x1 - 7, y1 - h - 5, w + 14, h + 10, COL_MENUCONTENT_PLUS_6);
m_frameBuffer->paintBoxRel(x1 - 4, y1 - h - 3, w + 8, h + 6, COL_MENUCONTENTSELECTED_PLUS_0);
- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->RenderString(x1, y1, w + 1, str, COL_MENUCONTENTSELECTED, 0);
+ g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->RenderString(x1, y1, w + 1, value, COL_MENUCONTENTSELECTED, 0);
while (true)
{
g_RCInput->getMsg(&msg, &data, 100);
diff --git a/tuxbox/neutrino/src/gui/bouquetlist.cpp b/tuxbox/neutrino/src/gui/bouquetlist.cpp
index edef77f..40ffd4d 100644
--- a/tuxbox/neutrino/src/gui/bouquetlist.cpp
+++ b/tuxbox/neutrino/src/gui/bouquetlist.cpp
@@ -48,6 +48,7 @@
#include <driver/rcinput.h>
#include <daemonc/remotecontrol.h>
#include <system/settings.h>
+#include <system/helper.h>
#include <global.h>
#include <neutrino.h>
@@ -333,8 +334,7 @@ void CBouquetList::paintItem(int pos)
{
CBouquet* bouq = Bouquets[liststart+pos];
//number - for direct jump
- char tmp[10];
- sprintf((char*) tmp, "%d", liststart+pos+ 1);
+ std::string tmp = to_string(liststart+pos+ 1);
if (liststart + pos == selected)
CLCD::getInstance()->showMenuText(0, bouq->channelList->getName(), -1, true); // UTF-8
diff --git a/tuxbox/neutrino/src/gui/eventlist.cpp b/tuxbox/neutrino/src/gui/eventlist.cpp
index 8b8f4a0..24bca77 100644
--- a/tuxbox/neutrino/src/gui/eventlist.cpp
+++ b/tuxbox/neutrino/src/gui/eventlist.cpp
@@ -44,7 +44,7 @@
#include <gui/widget/messagebox.h>
#include <gui/widget/mountchooser.h>
#include <gui/widget/dirchooser.h>
-
+#include <system/helper.h>
#include <global.h>
#include <neutrino.h>
@@ -691,8 +691,7 @@ void EventList::paintItem(unsigned int pos)
datetime2_str += " " + g_Zapit->getChannelName(channel);
}
- sprintf(tmpstr, "[%d min]", evtlist[curpos].duration / 60 );
- duration_str = tmpstr;
+ duration_str = "[" + to_string(evtlist[curpos].duration / 60) + " min]";
}
// 1st line
@@ -702,8 +701,7 @@ void EventList::paintItem(unsigned int pos)
int seit = (evtlist[curpos].startTime - time(NULL)) / 60;
if ((seit > 0) && (seit < 100) && !duration_str.empty())
{
- char beginnt[100];
- sprintf((char*) &beginnt, "in %d min", seit);
+ std::string beginnt = "in " + to_string(seit) + " min";
int w = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(beginnt) + 10;
g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x+width-fwidth2-5- 20- w, ypos+ fheight2+3, w, beginnt, color);
diff --git a/tuxbox/neutrino/src/gui/infoviewer.cpp b/tuxbox/neutrino/src/gui/infoviewer.cpp
index 0c8fe07..5227eef 100644
--- a/tuxbox/neutrino/src/gui/infoviewer.cpp
+++ b/tuxbox/neutrino/src/gui/infoviewer.cpp
@@ -55,6 +55,7 @@ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
#include <algorithm>
#include <string>
#include <system/settings.h>
+#include <system/helper.h>
#include <time.h>
#include <sys/param.h>
@@ -157,8 +158,8 @@ void CInfoViewer::showSatfind()
signal.ber = (s.ber < 0x3FFFF) ? s.ber : 0x3FFFF;
char freq[20];
- char percent[10];
char pos[6];
+ std::string percent;
int percent_width;
int sig;
int snr;
@@ -186,17 +187,17 @@ void CInfoViewer::showSatfind()
frameBuffer->paintBoxRel(ChanInfoX, BoxEndY, BoxEndX-ChanInfoX, 30, COL_INFOBAR_PLUS_0);
- sprintf (percent, "sig %d%%", sig);
+ percent = "sig " + to_string(sig) + "%";
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX+ 10, BoxEndY+ 25, BoxEndX- ChanInfoX- 10, percent, COL_INFOBAR_PLUS_0);
percent_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(percent);
pbsig.paintProgressBar(ChanInfoX+ 10+ percent_width+ 5, BoxEndY+ 7, 60, 15, sig, 100, 0, 0, COL_INFOBAR_PLUS_0, 0, "", COL_INFOBAR);
- sprintf (percent, "snr %d%%", snr);
+ percent = "snr " + to_string(snr) + "%";
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX+ 140, BoxEndY+ 25, BoxEndX- ChanInfoX- 140, percent, COL_INFOBAR_PLUS_0);
percent_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(percent);
pbsnr.paintProgressBar(ChanInfoX+ 140+ percent_width+ 5, BoxEndY+ 7, 60, 15, snr, 100, 0, 0, COL_INFOBAR_PLUS_0, 0, "", COL_INFOBAR);
- sprintf (percent, "ber %d%%", ber);
+ percent = "ber " + to_string(ber); // no unit
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX+ 270, BoxEndY+ 25, BoxEndX- ChanInfoX- 270, percent, COL_INFOBAR_PLUS_0);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(ChanInfoX+ 345, BoxEndY+ 25, BoxEndX- ChanInfoX- 345, freq, COL_INFOBAR_PLUS_0);
@@ -431,9 +432,8 @@ void CInfoViewer::showMovieTitle(const int _playstate, const std::string &title,
showIcon_VTXT(vtxtpid);
showIcon_SubT(subpid);
- char runningRest[32]; // %d can be 10 digits max...
- sprintf(runningRest, "%ld / %ld min", (time_elapsed + 30) / 60, (time_remaining + 30) / 60);
- display_Info(title.c_str(), sub_title.c_str(), true, false, (percent * 112) / 100, NULL, runningRest);
+ std::string runningRest = to_string((time_elapsed + 30) / 60) + " / " + to_string((time_remaining + 30) / 60) + " min";
+ display_Info(title.c_str(), sub_title.c_str(), true, false, (percent * 112) / 100, NULL, runningRest.c_str());
infobarLoop(false, fadeIn);
}
@@ -1260,12 +1260,10 @@ void CInfoViewer::showFailure()
void CInfoViewer::showMotorMoving(int duration)
{
char text[256];
- char buffer[10];
-
- sprintf(buffer, "%d", duration);
+
strcpy(text, g_Locale->getText(LOCALE_INFOVIEWER_MOTOR_MOVING));
strcat(text, " (");
- strcat(text, buffer);
+ strcat(text, to_string(duration).c_str());
strcat(text, " s)");
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, text, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(text, true) + 10, duration); // UTF-8
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 96d7a95..1d40283 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -66,6 +66,8 @@
#include <gui/widget/mountchooser.h>
#include <gui/widget/dirchooser.h>
#include <gui/widget/stringinput.h>
+#include <system/helper.h>
+
#include <dirent.h>
#include <sys/stat.h>
#ifdef ENABLE_GUI_MOUNT
@@ -733,11 +735,10 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings)
settings->parentalLockAge = (MI_PARENTAL_LOCKAGE)configfile.getInt32("mb_parentalLockAge", MI_PARENTAL_OVER18);
settings->parentalLock = (MB_PARENTAL_LOCK)configfile.getInt32("mb_parentalLock", MB_PARENTAL_LOCK_ACTIVE);
- char cfg_key[81];
+// char cfg_key[81];
for(int i = 0; i < MAX_RECORDING_DIR ; i++)
{
- sprintf(cfg_key, "mb_storageDir_rec_%d", i);
- settings->storageDirRecUsed[i] = (bool)configfile.getInt32(cfg_key, true );
+ settings->storageDirRecUsed[i] = (bool)configfile.getInt32("mb_storageDir_rec_" + to_string(i), true );
}
settings->storageDirMovieUsed = (bool)configfile.getInt32("mb_storageDir_movie", true );
@@ -746,20 +747,16 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings)
for(int i = 0; i < MB_MAX_DIRS; i++)
{
- sprintf(cfg_key, "mb_dir_%d", i);
- settings->storageDir[i] = configfile.getString( cfg_key, "" );
- sprintf(cfg_key, "mb_dir_used%d", i);
- settings->storageDirUsed[i] = configfile.getInt32( cfg_key,false );
+ settings->storageDir[i] = configfile.getString("mb_dir_" + to_string(i), "" );
+ settings->storageDirUsed[i] = configfile.getInt32("mb_dir_used" + to_string(i), false );
}
/* these variables are used for the listframes */
settings->browserFrameHeight = configfile.getInt32("mb_browserFrameHeight", 250);
settings->browserRowNr = configfile.getInt32("mb_browserRowNr", 0);
for(int i = 0; i < MB_MAX_ROWS && i < settings->browserRowNr; i++)
{
- sprintf(cfg_key, "mb_browserRowItem_%d", i);
- settings->browserRowItem[i] = (MB_INFO_ITEM)configfile.getInt32(cfg_key, MB_INFO_MAX_NUMBER);
- sprintf(cfg_key, "mb_browserRowWidth_%d", i);
- settings->browserRowWidth[i] = configfile.getInt32(cfg_key, 50);
+ settings->browserRowItem[i] = (MB_INFO_ITEM)configfile.getInt32("mb_browserRowItem_" + to_string(i), MB_INFO_MAX_NUMBER);
+ settings->browserRowWidth[i] = configfile.getInt32("mb_browserRowWidth_" + to_string(i), 50);
}
}
else
@@ -793,11 +790,9 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings)
configfile.setString("mb_filter_optionString", settings->filter.optionString);
configfile.setInt32("mb_filter_optionVar", settings->filter.optionVar);
- char cfg_key[81];
for(int i = 0; i < MAX_RECORDING_DIR ; i++)
{
- sprintf(cfg_key, "mb_storageDir_rec_%d", i);
- configfile.setInt32(cfg_key, settings->storageDirRecUsed[i] );
+ configfile.setInt32("mb_storageDir_rec_" + to_string(i), settings->storageDirRecUsed[i] );
}
configfile.setInt32("mb_storageDir_movie", settings->storageDirMovieUsed );
@@ -809,20 +804,16 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings)
for(int i = 0; i < MB_MAX_DIRS; i++)
{
- sprintf(cfg_key, "mb_dir_%d", i);
- configfile.setString( cfg_key, settings->storageDir[i] );
- sprintf(cfg_key, "mb_dir_used%d", i);
- configfile.setInt32( cfg_key, settings->storageDirUsed[i] ); // do not save this so far
+ configfile.setString("mb_dir_" + to_string(i) , settings->storageDir[i] );
+ configfile.setInt32("mb_dir_used" + to_string(i), settings->storageDirUsed[i] ); // do not save this so far
}
/* these variables are used for the listframes */
configfile.setInt32("mb_browserFrameHeight", settings->browserFrameHeight);
configfile.setInt32("mb_browserRowNr",settings->browserRowNr);
for(int i = 0; i < MB_MAX_ROWS && i < settings->browserRowNr; i++)
{
- sprintf(cfg_key, "mb_browserRowItem_%d", i);
- configfile.setInt32(cfg_key, settings->browserRowItem[i]);
- sprintf(cfg_key, "mb_browserRowWidth_%d", i);
- configfile.setInt32(cfg_key, settings->browserRowWidth[i]);
+ configfile.setInt32("mb_browserRowItem_" + to_string(i) , settings->browserRowItem[i]);
+ configfile.setInt32("mb_browserRowWidth_" + to_string(i), settings->browserRowWidth[i]);
}
if (configfile.getModifiedFlag())
@@ -3398,7 +3389,6 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite
*item_string="";
struct tm tm_tmp;
- char text[20];
int i=0;
int counter=0;
@@ -3449,9 +3439,7 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite
if(movie_info.bookmarks.user[i].pos != 0)
counter++;
}
- snprintf(text, 8,"%d",counter);
- text[9] = 0; // just to make sure string is terminated
- *item_string = text;
+ *item_string = to_string(counter);
break;
case MB_INFO_QUALITY: // = 11,
snprintf(str_tmp,MAX_STR_TMP,"%d",movie_info.quality);
@@ -3480,10 +3468,7 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite
case MB_INFO_AUDIO: // = 17,
#if 1 // MB_INFO_AUDIO test
// we just return the number of audiopids
- char text2[10];
- snprintf(text2, 8,"%d",movie_info.audioPids.size());
- text2[9] = 0; // just to make sure string is terminated
- *item_string = text2;
+ *item_string = to_string(movie_info.audioPids.size());
#else // MB_INFO_AUDIO test
for(i=0; i < movie_info.audioPids.size() && i < 10; i++)
{
@@ -3662,11 +3647,7 @@ const char * CSelectedMenu::getTargetValue()
{
if (*value > 0)
{
- char tmp[16];
- sprintf(tmp, "%d", *value / 60);
- value_string = tmp;
- value_string += " ";
- value_string += g_Locale->getText(LOCALE_WORD_MINUTES_SHORT);
+ value_string = to_string(*value/60) + " " + g_Locale->getText(LOCALE_WORD_MINUTES_SHORT);
}
else
value_string = "---";
diff --git a/tuxbox/neutrino/src/gui/movieinfo.cpp b/tuxbox/neutrino/src/gui/movieinfo.cpp
index 42537f4..2404d57 100644
--- a/tuxbox/neutrino/src/gui/movieinfo.cpp
+++ b/tuxbox/neutrino/src/gui/movieinfo.cpp
@@ -161,7 +161,6 @@ bool CMovieInfo::convertTs2XmlName(std::string* filename)
bool CMovieInfo::encodeMovieInfoXml(std::string* extMessage,MI_MOVIE_INFO &movie_info)
{
//TRACE("[mi]->encodeMovieInfoXml\r\n");
- char tmp[40];
*extMessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
*extMessage += "<"MI_XML_TAG_NEUTRINO" commandversion=\"1\">\n";
@@ -179,15 +178,13 @@ bool CMovieInfo::encodeMovieInfoXml(std::string* extMessage,MI_MOVIE_INFO &movie
if (!movie_info.audioPids.empty())
{
*extMessage += "\t\t<"MI_XML_TAG_AUDIOPIDS" selected=\"";
- sprintf(tmp, "%u", movie_info.audioPids[0].epgAudioPid); //pids.APIDs[i].pid);
- *extMessage += tmp;
+ *extMessage += to_string(movie_info.audioPids[0].epgAudioPid); //pids.APIDs[i].pid);
*extMessage += "\">\n";
for(unsigned int i = 0; i < movie_info.audioPids.size(); i++) // pids.APIDs.size()
{
*extMessage += "\t\t\t<"MI_XML_TAG_AUDIO" "MI_XML_TAG_PID"=\"";
- sprintf(tmp, "%u", movie_info.audioPids[i].epgAudioPid); //pids.APIDs[i].pid);
- *extMessage += tmp;
+ *extMessage += to_string(movie_info.audioPids[i].epgAudioPid); //pids.APIDs[i].pid);
*extMessage += "\" "MI_XML_TAG_NAME"=\"";
*extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info.audioPids[i].epgAudioPidName.c_str());
*extMessage += "\"/>\n";
@@ -201,11 +198,9 @@ bool CMovieInfo::encodeMovieInfoXml(std::string* extMessage,MI_MOVIE_INFO &movie
for(unsigned int i = 0; i < movie_info.subPids.size(); i++)
{
*extMessage += "\t\t\t<"MI_XML_TAG_SUB" "MI_XML_TAG_PID"=\"";
- sprintf(tmp, "%u", movie_info.subPids[i].subPid);
- *extMessage += tmp;
+ *extMessage += to_string(movie_info.subPids[i].subPid);
*extMessage += "\" "MI_XML_TAG_PAGE"=\"";
- sprintf(tmp, "%u", movie_info.subPids[i].subPage);
- *extMessage += tmp;
+ *extMessage += to_string(movie_info.subPids[i].subPage);
*extMessage += "\" "MI_XML_TAG_NAME"=\"";
*extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info.subPids[i].subName.c_str());
*extMessage += "\"/>\n";
@@ -234,11 +229,9 @@ bool CMovieInfo::encodeMovieInfoXml(std::string* extMessage,MI_MOVIE_INFO &movie
{
// encode any valid book, at least 1
*extMessage += "\t\t\t<"MI_XML_TAG_BOOKMARK_USER" "MI_XML_TAG_BOOKMARK_USER_POS"=\"";
- sprintf(tmp, "%d", movie_info.bookmarks.user[i].pos); //pids.APIDs[i].pid);
- *extMessage += tmp;
+ *extMessage += to_string(movie_info.bookmarks.user[i].pos); //pids.APIDs[i].pid);
*extMessage += "\" "MI_XML_TAG_BOOKMARK_USER_TYPE"=\"";
- sprintf(tmp, "%d", movie_info.bookmarks.user[i].length); //pids.APIDs[i].pid);
- *extMessage += tmp;
+ *extMessage += to_string(movie_info.bookmarks.user[i].length); //pids.APIDs[i].pid);
*extMessage += "\" "MI_XML_TAG_BOOKMARK_USER_NAME"=\"";
*extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info.bookmarks.user[i].name.c_str());
*extMessage += "\"/>\n";
@@ -509,8 +502,7 @@ void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info)
print_buffer += "\n";
print_buffer += movie_info.productionCountry;
print_buffer += " ";
- snprintf(date_char, 12,"%4d",movie_info.productionDate);
- print_buffer += date_char;
+ print_buffer += to_string(movie_info.productionDate);
}
if(!movie_info.serieName.empty())
@@ -532,16 +524,14 @@ void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info)
print_buffer += "\n";
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_QUALITY);
print_buffer += ": ";
- snprintf(date_char, 12,"%2d",movie_info.quality);
- print_buffer += date_char;
+ print_buffer += to_string(movie_info.quality);
}
if(movie_info.parentalLockAge != 0 )
{
print_buffer += "\n";
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_PARENTAL_LOCKAGE);
print_buffer += ": ";
- snprintf(date_char, 12,"%2d",movie_info.parentalLockAge);
- print_buffer += date_char;
+ print_buffer += to_string(movie_info.parentalLockAge);
print_buffer += " Jahre";
}
if(movie_info.rec_length != 0 )
@@ -549,8 +539,8 @@ void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info)
print_buffer += "\n";
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_LENGTH);
print_buffer += ": ";
- snprintf(date_char, 12, "%3d:%02d", movie_info.rec_length / 60, movie_info.rec_length % 60);
- print_buffer += date_char;
+ snprintf(date_char, 12, "%3d:%02d", movie_info.rec_length / 60, movie_info.rec_length % 60);
+ print_buffer += date_char;
}
else if(movie_info.length != 0 )
{
@@ -558,7 +548,7 @@ void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info)
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_LENGTH);
print_buffer += ": ";
snprintf(date_char, 12, "%3d", movie_info.length);
- print_buffer += date_char;
+ print_buffer += date_char;
}
if (!movie_info.audioPids.empty())
{
@@ -623,8 +613,7 @@ void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info)
print_buffer += "\n";
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_SIZE);
print_buffer += ": ";
- snprintf(date_char, 12,"%4llu",movie_info.file.Size>>20);
- print_buffer += date_char;
+ print_buffer += to_string(movie_info.file.Size>>20);
}
print_buffer += "\n" ;
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_PATH);
diff --git a/tuxbox/neutrino/src/gui/movieplayer.cpp b/tuxbox/neutrino/src/gui/movieplayer.cpp
index 5676b0b..ce75671 100644
--- a/tuxbox/neutrino/src/gui/movieplayer.cpp
+++ b/tuxbox/neutrino/src/gui/movieplayer.cpp
@@ -208,9 +208,7 @@ bool get_movie_info_apid_name(int apid,MI_MOVIE_INFO* movie_info,std::string* ap
if( movie_info->audioPids[i].epgAudioPid == apid &&
!movie_info->audioPids[i].epgAudioPidName.empty())
{
- char show_pid_number[5];
- sprintf(show_pid_number, "%u", apid);
- apidtitle->assign(show_pid_number);
+ apidtitle->assign(to_string(apid));
apidtitle->append(" : ");
apidtitle->append(movie_info->audioPids[i].epgAudioPidName);
return true;
@@ -230,9 +228,7 @@ bool get_movie_info_subpid_name(int subpid, MI_MOVIE_INFO* movie_info, std::stri
if( movie_info->subPids[i].subPid == subpid &&
!movie_info->subPids[i].subName.empty())
{
- char show_pid_number[5];
- sprintf(show_pid_number, "%u", subpid);
- subpidtitle->assign(show_pid_number);
+ subpidtitle->assign(to_string(subpid));
subpidtitle->append(" : ");
subpidtitle->append(movie_info->subPids[i].subName);
return true;
@@ -1152,9 +1148,7 @@ PlayStreamThread (void *mrl)
if(g_startposition > 0)
{
printf ("[movieplayer.cpp] Was Bookmark. Skipping to startposition\n");
- char tmpbuf[30];
- sprintf(tmpbuf,"%lld",g_startposition);
- skipvalue = tmpbuf;
+ skipvalue = to_string(g_startposition);
g_startposition = 0;
g_playstate = CMoviePlayerGui::SKIP;
}
diff --git a/tuxbox/neutrino/src/gui/movieplayer2.cpp b/tuxbox/neutrino/src/gui/movieplayer2.cpp
index 5f54380..759fea4 100644
--- a/tuxbox/neutrino/src/gui/movieplayer2.cpp
+++ b/tuxbox/neutrino/src/gui/movieplayer2.cpp
@@ -3051,7 +3051,6 @@ CMoviePlayerGui::PlayStream(int streamtype)
g_apidchanged = false;
CAPIDSelectExec *APIDChanger = new CAPIDSelectExec;
unsigned int digit = 0;
- char show_pid_number[5];
std::string apidtitle = "";
bool sep_added = false;
@@ -3062,9 +3061,8 @@ CMoviePlayerGui::PlayStream(int streamtype)
continue;
bool mi_found = false, current = false;
- sprintf(show_pid_number, "%u", g_apids[count]);
- apidtitle.assign(show_pid_number);
+ apidtitle.assign(to_string(g_apids[count]));
apidtitle.append(" : ");
if (movieinfo_valid)
{
@@ -3107,9 +3105,8 @@ CMoviePlayerGui::PlayStream(int streamtype)
continue;
bool mi_found = false, current = false;
- sprintf(show_pid_number, "%u", g_apids[count]);
- apidtitle.assign(show_pid_number);
+ apidtitle.assign(to_string(g_apids[count]));
apidtitle.append(" : ");
if (movieinfo_valid)
{
@@ -3158,8 +3155,6 @@ CMoviePlayerGui::PlayStream(int streamtype)
if (!movieinfo_valid)
break; // only one teletext pid possible
- sprintf(show_pid_number, "%d", vtxtpid);
-
for (unsigned int i = 0; i < movieinfo.subPids.size(); i++)
{
if (movieinfo.subPids[i].subPid == vtxtpid)
@@ -3170,7 +3165,7 @@ CMoviePlayerGui::PlayStream(int streamtype)
sep_added = true;
}
- apidtitle.assign(show_pid_number);
+ apidtitle.assign(to_string(vtxtpid));
apidtitle.append(" : ");
apidtitle.append(movieinfo.subPids[i].subName);
apidtitle.append(" (TTX)");
@@ -3198,7 +3193,6 @@ CMoviePlayerGui::PlayStream(int streamtype)
bool mi_found = false;
subpid = g_apids[count];
- sprintf(show_pid_number, "%d", subpid);
if (!sep_added)
{
@@ -3206,7 +3200,7 @@ CMoviePlayerGui::PlayStream(int streamtype)
sep_added = true;
}
- apidtitle.assign(show_pid_number);
+ apidtitle.assign(to_string(subpid));
apidtitle.append(" : ");
if (movieinfo_valid)
{
diff --git a/tuxbox/neutrino/src/gui/movieplayer_setup.cpp b/tuxbox/neutrino/src/gui/movieplayer_setup.cpp
index 5ef9cdb..0d80597 100644
--- a/tuxbox/neutrino/src/gui/movieplayer_setup.cpp
+++ b/tuxbox/neutrino/src/gui/movieplayer_setup.cpp
@@ -43,6 +43,7 @@
#include <gui/widget/stringinput.h>
#include <gui/widget/stringinput_ext.h>
#include <gui/widget/dirchooser.h>
+#include <system/helper.h>
#include "gui/movieplayer.h"
#include "gui/filebrowser.h"
@@ -260,7 +261,6 @@ int CMoviePlayerSetup::showMoviePlayerSelectPlugin()
MoviePluginSelector->addIntroItems(LOCALE_MOVIEPLAYER_DEFPLUGIN, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
std::string pluginName;
- char id[5];
int enabled_count = 0;
for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++)
{
@@ -268,11 +268,10 @@ int CMoviePlayerSetup::showMoviePlayerSelectPlugin()
{
// zB vtxt-plugins
pluginName = g_PluginList->getName(count);
- sprintf(id, "%d", count);
enabled_count++;
CMenuForwarder* fw = new CMenuForwarder(pluginName.c_str(),
- true, NULL, this, id, CRCInput::convertDigitToKey(enabled_count));
+ true, NULL, this, to_string(count).c_str(), CRCInput::convertDigitToKey(enabled_count));
fw->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
MoviePluginSelector->addItem(fw, (g_settings.movieplayer_plugin.compare(pluginName) == 0));
diff --git a/tuxbox/neutrino/src/gui/neutrino_menu.cpp b/tuxbox/neutrino/src/gui/neutrino_menu.cpp
index 78aa91a..c16c948 100644
--- a/tuxbox/neutrino/src/gui/neutrino_menu.cpp
+++ b/tuxbox/neutrino/src/gui/neutrino_menu.cpp
@@ -41,6 +41,7 @@
#include <neutrino.h>
#include <system/debug.h>
+#include <system/helper.h>
#include <unistd.h>
#include <driver/encoding.h>
@@ -393,7 +394,6 @@ bool CNeutrinoApp::showUserMenu(int button)
neutrino_msg_t key = CRCInput::RC_nokey;
const char * icon = NULL;
- char id[5];
int menu_items = 0;
int menu_prev = -1;
int cnt = 0;
@@ -466,13 +466,12 @@ bool CNeutrinoApp::showUserMenu(int button)
std::string tmp = g_PluginList->getName(count);
if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count) && tmp.find("Teletext") != std::string::npos)
{
- sprintf(id, "%d", count);
menu_items++;
menu_prev = SNeutrinoSettings::ITEM_VTXT;
if (StreamFeaturesChanger == NULL)
StreamFeaturesChanger = new CStreamFeaturesChangeExec();
keyhelper.get(&key, &icon, cnt == 0 ? CRCInput::RC_blue : CRCInput::RC_nokey);
- menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon);
+ menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, to_string(count).c_str(), key, icon);
menu->addItem(menu_item, (cnt == 0));
cnt++;
}
@@ -485,13 +484,12 @@ bool CNeutrinoApp::showUserMenu(int button)
std::string tmp = g_PluginList->getName(count);
if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count) && tmp.find("Teletext") == std::string::npos)
{
- sprintf(id, "%d", count);
menu_items++;
menu_prev = SNeutrinoSettings::ITEM_PLUGIN;
if (StreamFeaturesChanger == NULL)
StreamFeaturesChanger = new CStreamFeaturesChangeExec();
keyhelper.get(&key, &icon, cnt == 0 ? CRCInput::RC_blue : CRCInput::RC_nokey);
- menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon);
+ menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, to_string(count).c_str(), key, icon);
menu->addItem(menu_item, (cnt == 0));
cnt++;
}
diff --git a/tuxbox/neutrino/src/gui/nfs.cpp b/tuxbox/neutrino/src/gui/nfs.cpp
index 17f277d..0f0cb61 100644
--- a/tuxbox/neutrino/src/gui/nfs.cpp
+++ b/tuxbox/neutrino/src/gui/nfs.cpp
@@ -41,6 +41,7 @@
#include <gui/widget/hintbox.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/stringinput_ext.h>
+#include <system/helper.h>
#include <fstream>
@@ -156,13 +157,12 @@ int CNFSMountGui::menu()
{
CMenuWidget mountMenuW(LOCALE_NFS_MOUNT, NEUTRINO_ICON_STREAMING, 720);
mountMenuW.addIntroItems();
- char s2[12];
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- sprintf(s2,"mountentry%d",i);
+ std::string s2 = "mountentry" + to_string(i);
sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
- mountMenuEntry[i] = new CMenuForwarder("", true, ISO_8859_1_entry[i], this, s2);
+ mountMenuEntry[i] = new CMenuForwarder("", true, ISO_8859_1_entry[i], this, s2.c_str());
if (CFSMounter::isMounted(g_settings.network_nfs_local_dir[i]))
mountMenuEntry[i]->iconName = NEUTRINO_ICON_MOUNTED;
else
@@ -194,8 +194,8 @@ int CNFSMountGui::menuEntry(int nr)
char *dir,*local_dir, *username, *password, *options1, *options2, *mac;
int* automount;
int* type;
- char cmd[9];
- char cmd2[9];
+ std::string cmd = "domount" + to_string(nr);
+ std::string cmd2 = "dir" + to_string(nr);
dir = g_settings.network_nfs_dir[nr];
local_dir = g_settings.network_nfs_local_dir[nr];
@@ -207,9 +207,6 @@ int CNFSMountGui::menuEntry(int nr)
options2 = g_settings.network_nfs_mount_options2[nr];
mac = g_settings.network_nfs_mac[nr];
- sprintf(cmd,"domount%d",nr);
- sprintf(cmd2,"dir%d",nr);
-
/* rewrite fstype in new entries */
if(strlen(local_dir)==0)
{
@@ -243,7 +240,7 @@ int CNFSMountGui::menuEntry(int nr)
CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (*type != (int)CFSMounter::NFS), NULL, &passInput);
CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs_mac[nr]);
CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs_mac[nr], &macInput);
- CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs_local_dir[nr])), NULL, this, cmd);
+ CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs_local_dir[nr])), NULL, this, cmd.c_str());
mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
COnOffNotifier notifier(CFSMounter::NFS);
@@ -253,7 +250,7 @@ int CNFSMountGui::menuEntry(int nr)
mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, ¬ifier));
mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs_ip[nr], &ipInput ));
mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_DIR , true, dir , &dirInput ));
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_LOCALDIR, true, local_dir , this , cmd2));
+ mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_LOCALDIR, true, local_dir , this , cmd2.c_str()));
mountMenuEntryW.addItem(automountInput);
mountMenuEntryW.addItem(options1_fwd);
mountMenuEntryW.addItem(options2_fwd);
diff --git a/tuxbox/neutrino/src/gui/plugins.cpp b/tuxbox/neutrino/src/gui/plugins.cpp
index 8ba4163..7b236d2 100644
--- a/tuxbox/neutrino/src/gui/plugins.cpp
+++ b/tuxbox/neutrino/src/gui/plugins.cpp
@@ -34,6 +34,7 @@
#endif
#include <gui/plugins.h>
+#include <system/helper.h>
#include <sstream>
#include <fstream>
@@ -280,11 +281,7 @@ PluginParam * CPlugins::makeParam(const char * const id, const char * const valu
PluginParam * CPlugins::makeParam(const char * const id, const int value, PluginParam * const next)
{
- char aval[10];
-
- sprintf(aval, "%d", value);
-
- return makeParam(id, aval, next);
+ return makeParam(id, to_string(value).c_str(), next);
}
void CPlugins::start_plugin_by_name(const std::string & filename,int param)
diff --git a/tuxbox/neutrino/src/gui/sleeptimer.cpp b/tuxbox/neutrino/src/gui/sleeptimer.cpp
index d95a2d6..562a2f5 100644
--- a/tuxbox/neutrino/src/gui/sleeptimer.cpp
+++ b/tuxbox/neutrino/src/gui/sleeptimer.cpp
@@ -43,6 +43,7 @@
#include <global.h>
#include <gui/widget/stringinput.h>
+#include <system/helper.h>
#include <stdlib.h>
@@ -120,10 +121,7 @@ const char * CSleepTimerWidget::getTargetValue()
#endif
if (shutdown_min > 0)
{
- sprintf(value, "%d", shutdown_min);
- shutdown_min_string = value;
- shutdown_min_string += " ";
- shutdown_min_string += g_Locale->getText(LOCALE_WORD_MINUTES_SHORT);
+ shutdown_min_string = to_string(shutdown_min) + " " + g_Locale->getText(LOCALE_WORD_MINUTES_SHORT);
return shutdown_min_string.c_str();
}
return NULL;
diff --git a/tuxbox/neutrino/src/gui/update.cpp b/tuxbox/neutrino/src/gui/update.cpp
index 38e1700..598384d 100644
--- a/tuxbox/neutrino/src/gui/update.cpp
+++ b/tuxbox/neutrino/src/gui/update.cpp
@@ -55,6 +55,7 @@
#include <gui/widget/messagebox.h>
#include <gui/widget/hintbox.h>
+#include <system/helper.h>
#include <system/flashtool.h>
#include <sectionsdclient/sectionsdclient.h>
#ifndef DISABLE_INTERNET_UPDATE
@@ -550,11 +551,8 @@ CFlashExpert::CFlashExpert()
void CFlashExpert::readmtd(int mtd)
{
- char tmp[10];
- sprintf(tmp, "%d", mtd);
- std::string filename = "/tmp/mtd";
- filename += tmp;
- filename += ".img"; // US-ASCII (subset of UTF-8 and ISO8859-1)
+
+ std::string filename = "/tmp/mtd" + to_string(mtd) + ".img"; // US-ASCII (subset of UTF-8 and ISO8859-1)
if (mtd == -1)
{
filename = "/tmp/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1)
diff --git a/tuxbox/neutrino/src/gui/user_menue_setup.cpp b/tuxbox/neutrino/src/gui/user_menue_setup.cpp
index d772f9a..ee14e16 100644
--- a/tuxbox/neutrino/src/gui/user_menue_setup.cpp
+++ b/tuxbox/neutrino/src/gui/user_menue_setup.cpp
@@ -43,6 +43,7 @@
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/keychooser.h>
+#include <system/helper.h>
#include <driver/screen_max.h>
@@ -107,13 +108,10 @@ int CUserMenuSetup::showSetup()
//-------------------------------------
ums->addItem(mf);
ums->addItem(GenericMenuSeparatorLine);
- //-------------------------------------
- char text[10];
- for(int item = 0; item < SNeutrinoSettings::ITEM_MAX && item <13; item++) // Do not show more than 13 items
+ //---------------------------
+ for(int item = 1; item < SNeutrinoSettings::ITEM_MAX && item <14; item++) // Do not show more than 13 items
{
- snprintf(text,10,"%d:",item+1);
- text[9]=0;// terminate for sure
- ums->addItem( new CMenuOptionChooser(text, &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, USERMENU_ITEM_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true, true));
+ ums->addItem( new CMenuOptionChooser((to_string(item)+":").c_str(), &g_settings.usermenu[button][item], USERMENU_ITEM_OPTIONS, USERMENU_ITEM_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true, true));
}
int res = ums->exec(NULL, "");
diff --git a/tuxbox/neutrino/src/gui/widget/menue.cpp b/tuxbox/neutrino/src/gui/widget/menue.cpp
index aad8b95..20e619d 100644
--- a/tuxbox/neutrino/src/gui/widget/menue.cpp
+++ b/tuxbox/neutrino/src/gui/widget/menue.cpp
@@ -48,6 +48,7 @@
#include <gui/widget/stringinput.h>
#include <gui/widget/stringinput_ext.h>
+#include <system/helper.h>
#include <global.h>
#include <neutrino.h>
@@ -935,7 +936,6 @@ int CMenuOptionChooser::exec(CMenuTarget* parent)
if (pulldown)
{
int select = -1;
- char cnt[5];
CMenuWidget* menu = new CMenuWidget(optionNameString.c_str(), "", dx);
menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
@@ -944,8 +944,7 @@ int CMenuOptionChooser::exec(CMenuTarget* parent)
bool selected = false;
if (options[count]->key == (*optionValue))
selected = true;
- sprintf(cnt, "%d", count);
- CMenuForwarder *mn_option = new CMenuForwarder(options[count]->value, true, NULL, selector, cnt);
+ CMenuForwarder *mn_option = new CMenuForwarder(options[count]->value, true, NULL, selector, to_string(count).c_str());
mn_option->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true /*for selected item*/);
menu->addItem(mn_option, selected);
}
@@ -1066,7 +1065,6 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
if (pulldown)
{
int select = -1;
- char cnt[5];
CMenuWidget* menu = new CMenuWidget(optionName, "", dx);
menu->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL);
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
@@ -1075,8 +1073,7 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
bool selected = false;
if (strcmp(options[count].c_str(), optionValue) == 0)
selected = true;
- sprintf(cnt, "%d", count);
- CMenuForwarder *mn_option = new CMenuForwarder(options[count].c_str(), true, NULL, selector, cnt);
+ CMenuForwarder *mn_option = new CMenuForwarder(options[count].c_str(), true, NULL, selector, to_string(count).c_str());
mn_option->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true /*for selected item*/);
menu->addItem(mn_option, selected);
}
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/gui/alphasetup.cpp | 5 +-
tuxbox/neutrino/src/gui/audioplayer.cpp | 17 +++-----
tuxbox/neutrino/src/gui/bouquetlist.cpp | 4 +-
tuxbox/neutrino/src/gui/eventlist.cpp | 8 +--
tuxbox/neutrino/src/gui/infoviewer.cpp | 20 ++++-----
tuxbox/neutrino/src/gui/moviebrowser.cpp | 51 ++++++++-----------------
tuxbox/neutrino/src/gui/movieinfo.cpp | 37 ++++++------------
tuxbox/neutrino/src/gui/movieplayer.cpp | 12 +----
tuxbox/neutrino/src/gui/movieplayer2.cpp | 14 ++-----
tuxbox/neutrino/src/gui/movieplayer_setup.cpp | 5 +-
tuxbox/neutrino/src/gui/neutrino_menu.cpp | 8 +--
tuxbox/neutrino/src/gui/nfs.cpp | 17 +++-----
tuxbox/neutrino/src/gui/plugins.cpp | 7 +--
tuxbox/neutrino/src/gui/sleeptimer.cpp | 6 +--
tuxbox/neutrino/src/gui/update.cpp | 8 +--
tuxbox/neutrino/src/gui/user_menue_setup.cpp | 10 ++---
tuxbox/neutrino/src/gui/widget/menue.cpp | 9 +---
17 files changed, 84 insertions(+), 154 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-22 10:13:56
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 269f491b571a837eb6efd6a2647a570878bc4ef3 (commit)
from 6ac4efb8c8b046ba88fca11c10ab4f9cc9ddca3e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 269f491b571a837eb6efd6a2647a570878bc4ef3
Author: GetAway <get...@t-...>
Date: Fri May 22 12:12:47 2015 +0200
neutrino: introduce func to_string() and use it
code based on martii
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/gui/epgview.cpp b/tuxbox/neutrino/src/gui/epgview.cpp
index b1424eb..21a114c 100644
--- a/tuxbox/neutrino/src/gui/epgview.cpp
+++ b/tuxbox/neutrino/src/gui/epgview.cpp
@@ -36,7 +36,6 @@
#endif
#include <algorithm>
-#include <sstream>
#include <gui/epgview.h>
@@ -47,8 +46,8 @@
#include <gui/widget/mountchooser.h>
#include <gui/widget/dirchooser.h>
#include <gui/widget/progressbar.h>
-
#include <gui/timerlist.h>
+#include <system/helper.h>
#include <global.h>
#include <neutrino.h>
@@ -1066,12 +1065,10 @@ void CEpgData::showTimerEventBar(bool _show, bool webzap)
frameBuffer->paintBoxRel(sx, sy + oy, ox-60, buttonheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_LEFT);
std::string tmp_but_name;
- std::stringstream s;
- s << g_settings.wzap_time;
const char *but_name = NULL;
if (g_settings.wzap_time && webzap && !g_Timerd->adzap_eventID) {
tmp_but_name = g_Locale->getText(LOCALE_ADZAP);
- tmp_but_name += " "+ s.str() + " ";
+ tmp_but_name += " "+ to_string(g_settings.wzap_time) + " ";
tmp_but_name += g_Locale->getText(LOCALE_WORD_MINUTES_SHORT);
but_name = tmp_but_name.c_str();
}
diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp
index b531f55..852fb75 100644
--- a/tuxbox/neutrino/src/neutrino.cpp
+++ b/tuxbox/neutrino/src/neutrino.cpp
@@ -447,29 +447,19 @@ int CNeutrinoApp::loadSetup()
#endif
//network
- char cfg_key[81];
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- sprintf(cfg_key, "network_nfs_ip_%d", i);
- g_settings.network_nfs_ip[i] = configfile.getString(cfg_key, "");
- sprintf(cfg_key, "network_nfs_dir_%d", i);
- strcpy( g_settings.network_nfs_dir[i], configfile.getString( cfg_key, "" ).c_str() );
- sprintf(cfg_key, "network_nfs_local_dir_%d", i);
- strcpy( g_settings.network_nfs_local_dir[i], configfile.getString( cfg_key, "" ).c_str() );
- sprintf(cfg_key, "network_nfs_automount_%d", i);
- g_settings.network_nfs_automount[i] = configfile.getInt32( cfg_key, 0);
- sprintf(cfg_key, "network_nfs_type_%d", i);
- g_settings.network_nfs_type[i] = configfile.getInt32( cfg_key, 0);
- sprintf(cfg_key, "network_nfs_username_%d", i);
- strcpy( g_settings.network_nfs_username[i], configfile.getString( cfg_key, "" ).c_str() );
- sprintf(cfg_key, "network_nfs_password_%d", i);
- strcpy( g_settings.network_nfs_password[i], configfile.getString( cfg_key, "" ).c_str() );
- sprintf(cfg_key, "network_nfs_mount_options1_%d", i);
- strcpy( g_settings.network_nfs_mount_options1[i], configfile.getString( cfg_key, "ro,soft,udp" ).c_str() );
- sprintf(cfg_key, "network_nfs_mount_options2_%d", i);
- strcpy( g_settings.network_nfs_mount_options2[i], configfile.getString( cfg_key, "nolock,rsize=8192,wsize=8192" ).c_str() );
- sprintf(cfg_key, "network_nfs_mac_%d", i);
- strcpy( g_settings.network_nfs_mac[i], configfile.getString( cfg_key, "11:22:33:44:55:66").c_str() );
+ std::string i_str(to_string(i));
+ g_settings.network_nfs_ip[i] = configfile.getString("network_nfs_ip_" + i_str, "");
+ strcpy( g_settings.network_nfs_dir[i] , configfile.getString("network_nfs_dir_" + i_str, "").c_str() );
+ strcpy( g_settings.network_nfs_local_dir[i] , configfile.getString("network_nfs_local_dir_" + i_str, "").c_str() );
+ g_settings.network_nfs_automount[i] = configfile.getInt32 ("network_nfs_automount_" + i_str, 0);
+ g_settings.network_nfs_type[i] = configfile.getInt32 ("network_nfs_type_" + i_str, 0);
+ strcpy( g_settings.network_nfs_username[i] , configfile.getString("network_nfs_username_" + i_str, "").c_str() );
+ strcpy( g_settings.network_nfs_password[i] , configfile.getString("network_nfs_password_" + i_str, "").c_str() );
+ strcpy( g_settings.network_nfs_mount_options1[i], configfile.getString("network_nfs_mount_options1_" + i_str, "ro,soft,udp" ).c_str() );
+ strcpy( g_settings.network_nfs_mount_options2[i], configfile.getString("network_nfs_mount_options2_" + i_str, "nolock,rsize=8192,wsize=8192" ).c_str() );
+ strcpy( g_settings.network_nfs_mac[i] , configfile.getString("network_nfs_mac" + i_str, "11:22:33:44:55:66").c_str() );
}
g_settings.filesystem_is_utf8 = configfile.getBool("filesystem_is_utf8" , true );
@@ -581,12 +571,10 @@ int CNeutrinoApp::loadSetup()
g_settings.recording_dir_permissions[3] = '\0';
for(int i=0 ; i < MAX_RECORDING_DIR ; i++)
{
- sprintf(cfg_key, "recording_dir_%d", i);
- g_settings.recording_dir[i] = configfile.getString( cfg_key, "" );
- sprintf(cfg_key, "recording_filename_template_%d", i);
- g_settings.recording_filename_template[i] = configfile.getString( cfg_key, "" );
- sprintf(cfg_key, "recording_splitsize_%d", i);
- strcpy(g_settings.recording_splitsize[i], configfile.getString( cfg_key, "" ).c_str());
+ std::string i_str(to_string(i));
+ g_settings.recording_dir[i] = configfile.getString("recording_dir_" + i_str, "" );
+ g_settings.recording_filename_template[i] = configfile.getString("recording_filename_template_" + i_str, "" );
+ strcpy(g_settings.recording_splitsize[i], configfile.getString("recording_splitsize_" + i_str, "" ).c_str());
}
g_settings.recording_gen_psi = configfile.getBool("recordingmenu.gen_psi", true);
@@ -990,29 +978,19 @@ void CNeutrinoApp::saveSetup()
configfile.setBool( "menu_numbers_as_icons", g_settings.menu_numbers_as_icons );
//network
- char cfg_key[81];
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++)
{
- sprintf(cfg_key, "network_nfs_ip_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_ip[i] );
- sprintf(cfg_key, "network_nfs_dir_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_dir[i] );
- sprintf(cfg_key, "network_nfs_local_dir_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_local_dir[i] );
- sprintf(cfg_key, "network_nfs_automount_%d", i);
- configfile.setInt32( cfg_key, g_settings.network_nfs_automount[i]);
- sprintf(cfg_key, "network_nfs_type_%d", i);
- configfile.setInt32( cfg_key, g_settings.network_nfs_type[i]);
- sprintf(cfg_key,"network_nfs_username_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_username[i] );
- sprintf(cfg_key, "network_nfs_password_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_password[i] );
- sprintf(cfg_key, "network_nfs_mount_options1_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_mount_options1[i]);
- sprintf(cfg_key, "network_nfs_mount_options2_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_mount_options2[i]);
- sprintf(cfg_key, "network_nfs_mac_%d", i);
- configfile.setString( cfg_key, g_settings.network_nfs_mac[i]);
+ std::string i_str(to_string(i));
+ configfile.setString("network_nfs_ip_" + i_str , g_settings.network_nfs_ip[i] );
+ configfile.setString("network_nfs_dir_" + i_str , g_settings.network_nfs_dir[i] );
+ configfile.setString("network_nfs_local_dir_" + i_str , g_settings.network_nfs_local_dir[i] );
+ configfile.setInt32 ("network_nfs_automount_" + i_str , g_settings.network_nfs_automount[i]);
+ configfile.setInt32 ("network_nfs_type_" + i_str , g_settings.network_nfs_type[i]);
+ configfile.setString("network_nfs_username_" + i_str , g_settings.network_nfs_username[i] );
+ configfile.setString("network_nfs_password_" + i_str , g_settings.network_nfs_password[i] );
+ configfile.setString("network_nfs_mount_options1_" + i_str, g_settings.network_nfs_mount_options1[i]);
+ configfile.setString("network_nfs_mount_options2_" + i_str, g_settings.network_nfs_mount_options2[i]);
+ configfile.setString("network_nfs_mac_" + i_str , g_settings.network_nfs_mac[i]);
}
configfile.setBool ( "filesystem_is_utf8" , g_settings.filesystem_is_utf8);
#ifdef ENABLE_SAMBASERVER
@@ -1103,12 +1081,10 @@ void CNeutrinoApp::saveSetup()
configfile.setString("recording_dir_permissions" , g_settings.recording_dir_permissions);
for(int i=0 ; i < MAX_RECORDING_DIR ; i++)
{
- sprintf(cfg_key, "recording_dir_%d", i);
- configfile.setString( cfg_key, g_settings.recording_dir[i] );
- sprintf(cfg_key, "recording_filename_template_%d", i);
- configfile.setString( cfg_key, g_settings.recording_filename_template[i] );
- sprintf(cfg_key, "recording_splitsize_%d", i);
- configfile.setString( cfg_key, g_settings.recording_splitsize[i] );
+ std::string i_str(to_string(i));
+ configfile.setString("recording_dir_" + i_str , g_settings.recording_dir[i] );
+ configfile.setString("recording_filename_template_" + i_str, g_settings.recording_filename_template[i] );
+ configfile.setString("recording_splitsize_" + i_str , g_settings.recording_splitsize[i] );
}
//streaming
diff --git a/tuxbox/neutrino/src/system/helper.cpp b/tuxbox/neutrino/src/system/helper.cpp
index cb7a065..1681c1b 100644
--- a/tuxbox/neutrino/src/system/helper.cpp
+++ b/tuxbox/neutrino/src/system/helper.cpp
@@ -153,3 +153,45 @@ std::string find_executable(const char *name)
}
return "";
}
+
+std::string to_string(int i)
+{
+ std::stringstream s;
+ s << i;
+ return s.str();
+}
+
+std::string to_string(unsigned int i)
+{
+ std::stringstream s;
+ s << i;
+ return s.str();
+}
+
+std::string to_string(long i)
+{
+ std::stringstream s;
+ s << i;
+ return s.str();
+}
+
+std::string to_string(unsigned long i)
+{
+ std::stringstream s;
+ s << i;
+ return s.str();
+}
+
+std::string to_string(long long i)
+{
+ std::stringstream s;
+ s << i;
+ return s.str();
+}
+
+std::string to_string(unsigned long long i)
+{
+ std::stringstream s;
+ s << i;
+ return s.str();
+}
diff --git a/tuxbox/neutrino/src/system/helper.h b/tuxbox/neutrino/src/system/helper.h
index 8ccc836..f17c10b 100644
--- a/tuxbox/neutrino/src/system/helper.h
+++ b/tuxbox/neutrino/src/system/helper.h
@@ -26,6 +26,7 @@
#define __neutrino_helper__
#include <string>
+#include <sstream>
void StrSearchReplace( std::string &s, const std::string &to_find, const std::string& repl_with );
@@ -36,4 +37,10 @@ bool file_exists(const char *filename);
std::string find_executable(const char *name);
+std::string to_string(int);
+std::string to_string(unsigned int);
+std::string to_string(long);
+std::string to_string(unsigned long);
+std::string to_string(long long);
+std::string to_string(unsigned long long);
#endif
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/src/gui/epgview.cpp | 7 +--
tuxbox/neutrino/src/neutrino.cpp | 84 ++++++++++++---------------------
tuxbox/neutrino/src/system/helper.cpp | 42 ++++++++++++++++
tuxbox/neutrino/src/system/helper.h | 7 +++
4 files changed, 81 insertions(+), 59 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-20 07:02:28
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 6ac4efb8c8b046ba88fca11c10ab4f9cc9ddca3e (commit)
from 7a67c5a67d90674771736d0f07f9873d9c41d0e7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6ac4efb8c8b046ba88fca11c10ab4f9cc9ddca3e
Author: Jacek Jendrzej <cra...@go...>
Date: Wed May 20 09:00:28 2015 +0200
Neutrino: add AdZap/Werbezapper in EPGview
use +/- to change time
possible values are up to 60 Mins.
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/data/locale/deutsch.locale b/tuxbox/neutrino/data/locale/deutsch.locale
index 4a26c68..e9ac38d 100644
--- a/tuxbox/neutrino/data/locale/deutsch.locale
+++ b/tuxbox/neutrino/data/locale/deutsch.locale
@@ -129,6 +129,7 @@ GENRE.TRAVEL_HOBBIES.5 Kochen
GENRE.TRAVEL_HOBBIES.6 Einkauf
GENRE.TRAVEL_HOBBIES.7 Garten
GENRE.UNKNOWN Unbekannt
+adzap Werbezapper
apidselector.head Audio-Auswahl
audiomenu.PCMOffset Lautstärkeabsenkung PCM
audiomenu.analogout Analog-Ausgang
diff --git a/tuxbox/neutrino/data/locale/english.locale b/tuxbox/neutrino/data/locale/english.locale
index c13e022..ff033c6 100644
--- a/tuxbox/neutrino/data/locale/english.locale
+++ b/tuxbox/neutrino/data/locale/english.locale
@@ -129,6 +129,7 @@ GENRE.TRAVEL_HOBBIES.5 cooking
GENRE.TRAVEL_HOBBIES.6 advertisement/shopping
GENRE.TRAVEL_HOBBIES.7 gardening
GENRE.UNKNOWN unknown
+adzap AdZap
apidselector.head Audio Selection
audiomenu.PCMOffset Volume Decrease PCM
audiomenu.analogout Analog Output
diff --git a/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp b/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp
index 49685f5..42313d4 100644
--- a/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp
+++ b/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp
@@ -28,7 +28,11 @@
#include <timerdclient/timerdmsg.h>
#include <timerdclient/timerdclient.h>
-
+int CTimerdClient::adzap_eventID = 0;
+void CTimerdClient::resetAdZap_EventID()
+{
+ adzap_eventID = 0;
+}
unsigned char CTimerdClient::getVersion() const
{
return CTimerdMsg::ACTVERSION;
@@ -231,7 +235,6 @@ int CTimerdClient::addTimerEvent( CTimerEventTypes evType, void* data , int min,
int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data, time_t announcetime, time_t alarmtime,time_t stoptime,
CTimerd::CTimerEventRepeat evrepeat, uint repeatcount,bool forceadd)
{
-
if (!forceadd)
{
//printf("[CTimerdClient] checking for overlapping timers\n");
@@ -244,6 +247,11 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data,
}
}
+ bool adzaptimer = false;
+ if (evType == CTimerd::TIMER_ADZAP) {
+ evType = CTimerd::TIMER_ZAPTO;
+ adzaptimer = true;
+ }
CTimerd::TransferEventInfo tei;
CTimerd::TransferRecordingInfo tri;
CTimerdMsg::commandAddTimer msgAddTimer;
@@ -259,7 +267,8 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data,
length = 0;
}
else if(evType == CTimerd::TIMER_NEXTPROGRAM || evType == CTimerd::TIMER_ZAPTO ||
- evType == CTimerd::TIMER_IMMEDIATE_RECORD )
+ evType == CTimerd::TIMER_IMMEDIATE_RECORD ||
+ evType == CTimerd::TIMER_ADZAP)
{
CTimerd::EventInfo *ei=static_cast<CTimerd::EventInfo*>(data);
tei.apids = ei->apids;
@@ -307,15 +316,19 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data,
CTimerdMsg::responseAddTimer response;
receive_data((char*)&response, sizeof(response));
close_connection();
-
+ if (adzaptimer) {
+ adzap_eventID = response.eventID; //set adzap flag
+ }
return( response.eventID);
}
//-------------------------------------------------------------------------
void CTimerdClient::removeTimerEvent( int evId)
{
- CTimerdMsg::commandRemoveTimer msgRemoveTimer;
+ if (evId == adzap_eventID)
+ adzap_eventID = 0; //reset adzap flag
+ CTimerdMsg::commandRemoveTimer msgRemoveTimer;
msgRemoveTimer.eventID = evId;
send(CTimerdMsg::CMD_REMOVETIMER, (char*) &msgRemoveTimer, sizeof(msgRemoveTimer));
diff --git a/tuxbox/neutrino/lib/timerdclient/timerdclient.h b/tuxbox/neutrino/lib/timerdclient/timerdclient.h
index 5696c0b..98e455a 100644
--- a/tuxbox/neutrino/lib/timerdclient/timerdclient.h
+++ b/tuxbox/neutrino/lib/timerdclient/timerdclient.h
@@ -62,7 +62,9 @@ class CTimerdClient:private CBasicClient
void registerEvent(unsigned int eventID, unsigned int clientID, const char * const udsName);
void unRegisterEvent(unsigned int eventID, unsigned int clientID);
+ static int adzap_eventID;
+ void resetAdZap_EventID();
bool isTimerdAvailable(); // check if timerd is running
CTimerd::TimerList getOverlappingTimers(time_t& announcetime, time_t& stoptime);
@@ -148,6 +150,17 @@ class CTimerdClient:private CBasicClient
eventInfo.recordingSafety = safety;
return addTimerEvent(CTimerd::TIMER_ZAPTO, &eventInfo, announcetime, alarmtime, stoptime);
};
+ // adds new adzap timer event //pseudo TIMER_ADZAP
+ int addAdZaptoTimerEvent(const t_channel_id channel_id, time_t alarmtime)
+ {
+ CTimerd::EventInfo eventInfo;
+ eventInfo.channel_id = channel_id;
+ eventInfo.epgID = 1;
+ eventInfo.epg_starttime = 0;
+ eventInfo.apids = 0;
+ eventInfo.recordingSafety = false;
+ return addTimerEvent(CTimerd::TIMER_ADZAP, &eventInfo, 0, alarmtime, 0);
+ };
int addNextProgramTimerEvent(CTimerd::EventInfo eventInfo,time_t alarmtime, time_t announcetime = 0, time_t stoptime = 0)
{
diff --git a/tuxbox/neutrino/lib/timerdclient/timerdtypes.h b/tuxbox/neutrino/lib/timerdclient/timerdtypes.h
index a09ecaa..2105eaa 100644
--- a/tuxbox/neutrino/lib/timerdclient/timerdtypes.h
+++ b/tuxbox/neutrino/lib/timerdclient/timerdtypes.h
@@ -69,7 +69,8 @@ class CTimerd
TIMER_REMIND,
TIMER_SLEEPTIMER,
TIMER_EXEC_PLUGIN,
- TIMER_IMMEDIATE_RECORD
+ TIMER_IMMEDIATE_RECORD,
+ TIMER_ADZAP
};
enum CTimerEventStates
diff --git a/tuxbox/neutrino/src/gui/epgview.cpp b/tuxbox/neutrino/src/gui/epgview.cpp
index f1ed2c5..b1424eb 100644
--- a/tuxbox/neutrino/src/gui/epgview.cpp
+++ b/tuxbox/neutrino/src/gui/epgview.cpp
@@ -36,6 +36,7 @@
#endif
#include <algorithm>
+#include <sstream>
#include <gui/epgview.h>
@@ -455,6 +456,15 @@ static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b)
return a.startTime< b.startTime;
}
+bool CEpgData::isCurrentEPG(const t_channel_id channel_id)
+{
+ t_channel_id live_channel_id = g_Zapit->getCurrentServiceID();
+ if(( epg_done != -1 ) && live_channel_id == channel_id){
+ return true;
+ }
+ return false;
+}
+
int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_t* a_startzeit, bool doLoop, bool callFromfollowlist )
{
int res = menu_return::RETURN_REPAINT;
@@ -630,7 +640,9 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
showText(showPos, sy + toph);
// show Timer Event Buttons
- showTimerEventBar (true);
+ bool wzap = isCurrentEPG(channel_id);
+ frameBuffer->paintBoxRel(sx, sy + oy, ox, buttonheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM);
+ showTimerEventBar (true, wzap);
//show Content&Component for Dolby & 16:9
if (hasComponentTags)
@@ -678,6 +690,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
while(loop)
{
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd );
+ neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat;
scrollCount = medlinecount;
@@ -716,6 +729,29 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
else
showText(showPos, sy + toph);
break;
+ case CRCInput::RC_plus:
+ if(isCurrentEPG(channel_id)){
+ if(g_settings.wzap_time> 14)
+ g_settings.wzap_time+=5;
+ else
+ g_settings.wzap_time++;
+ if(g_settings.wzap_time>60)
+ g_settings.wzap_time = 0;
+ showTimerEventBar(true, true);
+ }
+ break;
+ case CRCInput::RC_minus:
+ if (isCurrentEPG(channel_id)) {
+ if(g_settings.wzap_time> 19)
+ g_settings.wzap_time-=5;
+ else
+ g_settings.wzap_time--;
+
+ if(g_settings.wzap_time<0)
+ g_settings.wzap_time = 60;
+ showTimerEventBar(true, true);
+ }
+ break;
// 31.05.2002 dirch record timer
case CRCInput::RC_red:
@@ -779,14 +815,19 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
// 31.05.2002 dirch zapto timer
case CRCInput::RC_yellow:
{
- CTimerdClient timerdclient;
- if(timerdclient.isTimerdAvailable())
+ if(g_Timerd->isTimerdAvailable())
{
- timerdclient.addZaptoTimerEvent(channel_id,
- epgData.epg_times.startzeit,
- epgData.epg_times.startzeit - ANNOUNCETIME, 0,
- epgData.eventID, epgData.epg_times.startzeit, 0, true);
- ShowLocalizedMessage(LOCALE_TIMER_EVENTTIMED_TITLE, LOCALE_TIMER_EVENTTIMED_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
+ if (!g_Timerd->adzap_eventID && g_settings.wzap_time && isCurrentEPG(channel_id)) {
+ g_Timerd->addAdZaptoTimerEvent(channel_id,
+ time (NULL) + (g_settings.wzap_time * 60));
+ loop = false;
+ } else {
+ g_Timerd->addZaptoTimerEvent(channel_id,
+ epgData.epg_times.startzeit,
+ epgData.epg_times.startzeit - ANNOUNCETIME, 0,
+ epgData.eventID, epgData.epg_times.startzeit, 0, true);
+ ShowLocalizedMessage(LOCALE_TIMER_EVENTTIMED_TITLE, LOCALE_TIMER_EVENTTIMED_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
+ }
}
else
printf("timerd not available\n");
@@ -848,6 +889,8 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_
// konfigurierbare Keys handlen...
if (msg == g_settings.key_channelList_cancel)
loop = false;
+ else if (msg_repeatok == CRCInput::RC_plus || msg_repeatok == CRCInput::RC_minus)
+ ;
else
{
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all )
@@ -1001,16 +1044,16 @@ void CEpgData::FollowScreenings(const time_t startzeit)
// -- Just display or hide TimerEventbar
// -- 2002-05-13 rasc
//
-const struct button_label epgviewButtons[3] =
+struct button_label epgviewButtons[3] =
{
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_TIMERBAR_RECORDEVENT },
- { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_TIMERBAR_CHANNELSWITCH },
+ { NEUTRINO_ICON_BUTTON_YELLOW , LOCALE_GENERIC_EMPTY }, // channelswitch / adZap
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_EPGVIEWER_MORE_SCREENINGS_SHORT }
};
-void CEpgData::showTimerEventBar(bool _show)
+void CEpgData::showTimerEventBar(bool _show, bool webzap)
{
- int ButtonWidth = (ox - 12) / 4; // 4 cells
+ int ButtonWidth = (ox - 70) / 3; // 3 cells + 16:9 & dd
int by = sy + oy + 2;
// hide only?
@@ -1020,14 +1063,27 @@ void CEpgData::showTimerEventBar(bool _show)
return;
}
- frameBuffer->paintBoxRel(sx, sy + oy, ox, buttonheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM);
+ frameBuffer->paintBoxRel(sx, sy + oy, ox-60, buttonheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_LEFT);
+
+ std::string tmp_but_name;
+ std::stringstream s;
+ s << g_settings.wzap_time;
+ const char *but_name = NULL;
+ if (g_settings.wzap_time && webzap && !g_Timerd->adzap_eventID) {
+ tmp_but_name = g_Locale->getText(LOCALE_ADZAP);
+ tmp_but_name += " "+ s.str() + " ";
+ tmp_but_name += g_Locale->getText(LOCALE_WORD_MINUTES_SHORT);
+ but_name = tmp_but_name.c_str();
+ }
+ else
+ epgviewButtons[1].locale = LOCALE_TIMERBAR_CHANNELSWITCH;
// Button: Timer Record & Channelswitch
if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF)
::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, sx + 6, by, ButtonWidth, 1, &epgviewButtons[0]);
- // Button: Timer Channelswitch
- ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, sx + 6 + ButtonWidth, by, ButtonWidth, 1, &epgviewButtons[1]);
+ // Button: Timer Channelswitch / AdZap
+ ::paintButtons(frameBuffer, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL], g_Locale, sx + 6 + ButtonWidth-25, by, ButtonWidth, 1, &epgviewButtons[1], 0, false, COL_INFOBAR_SHADOW_PLUS_1, but_name);
// Button: more screenings
if (!followlist.empty() && !call_fromfollowlist)
diff --git a/tuxbox/neutrino/src/gui/epgview.h b/tuxbox/neutrino/src/gui/epgview.h
index 5e46982..189041e 100644
--- a/tuxbox/neutrino/src/gui/epgview.h
+++ b/tuxbox/neutrino/src/gui/epgview.h
@@ -95,7 +95,8 @@ class CEpgData
void showText( int startPos, int ypos );
bool hasFollowScreenings(const t_channel_id channel_id, const std::string & title, const time_t startzeit);
void FollowScreenings(const time_t startzeit);
- void showTimerEventBar(bool show);
+ void showTimerEventBar(bool show, bool webzap = false);
+ bool isCurrentEPG(const t_channel_id channel_id);
public:
diff --git a/tuxbox/neutrino/src/neutrino.cpp b/tuxbox/neutrino/src/neutrino.cpp
index 73f73e2..b531f55 100644
--- a/tuxbox/neutrino/src/neutrino.cpp
+++ b/tuxbox/neutrino/src/neutrino.cpp
@@ -400,8 +400,9 @@ int CNeutrinoApp::loadSetup()
g_settings.infobar_show_channellogo = configfile.getInt32("infobar_show_channellogo" , CInfoViewer::NO_LOGO);
g_settings.infobar_channellogo_background = configfile.getInt32("infobar_channellogo_background" , CInfoViewer::NO_BACKGROUND);
g_settings.startmode = configfile.getInt32("startmode" , STARTMODE_RESTORE );
-
+ g_settings.wzap_time = configfile.getInt32("wzap_time", 3 );
g_settings.radiotext_enable = configfile.getBool("radiotext_enable" , false);
+
//audio
g_settings.audio_AnalogMode = configfile.getInt32( "audio_AnalogMode" , 0 );
g_settings.audio_DolbyDigital = configfile.getBool("audio_DolbyDigital" , false);
@@ -959,6 +960,7 @@ void CNeutrinoApp::saveSetup()
configfile.setString("infobar_channel_logodir" , g_settings.infobar_channel_logodir);
configfile.setInt32( "infobar_channellogo_background" , g_settings.infobar_channellogo_background);
configfile.setInt32("startmode" , g_settings.startmode);
+ configfile.setInt32("wzap_time" , g_settings.wzap_time);
configfile.setBool("radiotext_enable" , g_settings.radiotext_enable);
//audio
@@ -2924,6 +2926,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t m, neutrino_msg_data_t data)
channelsInit(init_mode_switch, mode_tv);
}
channelList->zapTo_ChannelID(eventinfo->channel_id);
+ if (eventinfo->epgID == 1) {
+ g_Timerd->resetAdZap_EventID();
+ }
}
delete [] (unsigned char*) data;
return messages_return::handled;
diff --git a/tuxbox/neutrino/src/system/locals.h b/tuxbox/neutrino/src/system/locals.h
index d772f7b..cb1510b 100644
--- a/tuxbox/neutrino/src/system/locals.h
+++ b/tuxbox/neutrino/src/system/locals.h
@@ -156,6 +156,7 @@ typedef enum
LOCALE_GENRE_TRAVEL_HOBBIES_6,
LOCALE_GENRE_TRAVEL_HOBBIES_7,
LOCALE_GENRE_UNKNOWN,
+ LOCALE_ADZAP,
LOCALE_APIDSELECTOR_HEAD,
LOCALE_AUDIOMENU_PCMOFFSET,
LOCALE_AUDIOMENU_ANALOGOUT,
diff --git a/tuxbox/neutrino/src/system/locals_intern.h b/tuxbox/neutrino/src/system/locals_intern.h
index 47a6218..4535f7f 100644
--- a/tuxbox/neutrino/src/system/locals_intern.h
+++ b/tuxbox/neutrino/src/system/locals_intern.h
@@ -156,6 +156,7 @@ const char * locale_real_names[] =
"GENRE.TRAVEL_HOBBIES.6",
"GENRE.TRAVEL_HOBBIES.7",
"GENRE.UNKNOWN",
+ "adzap",
"apidselector.head",
"audiomenu.PCMOffset",
"audiomenu.analogout",
diff --git a/tuxbox/neutrino/src/system/settings.h b/tuxbox/neutrino/src/system/settings.h
index 5651d8b..17e1ca4 100644
--- a/tuxbox/neutrino/src/system/settings.h
+++ b/tuxbox/neutrino/src/system/settings.h
@@ -75,6 +75,7 @@ struct SNeutrinoSettings
int infobar_show_channellogo;
int infobar_channellogo_background;
int startmode;
+ int wzap_time;
int radiotext_enable;
// EPG
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/data/locale/deutsch.locale | 1 +
tuxbox/neutrino/data/locale/english.locale | 1 +
tuxbox/neutrino/lib/timerdclient/timerdclient.cpp | 23 +++++-
tuxbox/neutrino/lib/timerdclient/timerdclient.h | 13 +++
tuxbox/neutrino/lib/timerdclient/timerdtypes.h | 3 +-
tuxbox/neutrino/src/gui/epgview.cpp | 86 +++++++++++++++++----
tuxbox/neutrino/src/gui/epgview.h | 3 +-
tuxbox/neutrino/src/neutrino.cpp | 7 ++-
tuxbox/neutrino/src/system/locals.h | 1 +
tuxbox/neutrino/src/system/locals_intern.h | 1 +
tuxbox/neutrino/src/system/settings.h | 1 +
11 files changed, 117 insertions(+), 23 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-19 08:58:56
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 7a67c5a67d90674771736d0f07f9873d9c41d0e7 (commit)
via 826bc80d4ac1db1e2a7b3f31cd3932d5a0ba1cf6 (commit)
from 488b2b49a03eaf1bef874d38ac97b7f8078c14eb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7a67c5a67d90674771736d0f07f9873d9c41d0e7
Author: GetAway <get...@t-...>
Date: Tue May 19 10:58:11 2015 +0200
small fix localtime_r and gmtime_r
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp
index 9a0b796..0b53b32 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp
@@ -271,12 +271,14 @@ std::string CyhookHandler::BuildHeader(bool cache)
gmtime_r(&x_time, <);
lt.tm_mday+=1;
x_time = mktime(<);
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&x_time, <));
+ gmtime_r(&x_time, <);
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, <);
result += string_printf("Expires: %s\r\n", timeStr);
}
result += "Server: " WEBSERVERNAME "\r\n";
// actual date
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&timer, <));
+ gmtime_r(&timer, <);
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, <);
result += string_printf("Date: %s\r\n", timeStr);
// connection type
#ifdef Y_CONFIG_FEATURE_KEEP_ALIVE
@@ -297,7 +299,8 @@ std::string CyhookHandler::BuildHeader(bool cache)
if(LastModified != (time_t)-1)
mod_time = LastModified;
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&mod_time, <));
+ gmtime_r(&mod_time, <);
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, <);
result += string_printf("Last-Modified: %s\r\nContent-Length: %ld\r\n", timeStr, GetContentLength());
}
result += "\r\n"; // End of Header
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp
index 2d439f7..e725f38 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp
@@ -212,7 +212,8 @@ void CmodCache::yshowCacheInfo(CyhookHandler *hh)
TCache *item = &((*i).second);
char timeStr[80];
struct tm lt;
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&item->created, <) );
+ gmtime_r(&item->created, <);
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, < );
yresult += string_printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>" \
"<td><a href=\"/y/cache-clear?url=%s\">url</a> " \
"<a href=\"/y/cache-clear?category=%s\">category</a></td></tr>\n",
diff --git a/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp b/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp
index ef7be8f..4a5420a 100644
--- a/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp
+++ b/tuxbox/neutrino/daemons/sectionsd/SIsections.cpp
@@ -167,8 +167,8 @@ void SIsectionEIT::parsePDCDescriptor(const char *buf, SIevent &e, unsigned maxl
{
const struct descr_pdc_header *s = (struct descr_pdc_header *)buf;
time_t now = time(NULL);
- struct tm tm_r;
- struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
+ struct tm t;
+ localtime_r(&now, &t); // this initializes the time zone in 't'
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
int month = t.tm_mon;
t.tm_mon = ((s->pil1 >> 3) & 0x0F) - 1;
commit 826bc80d4ac1db1e2a7b3f31cd3932d5a0ba1cf6
Author: GetAway <get...@t-...>
Date: Tue May 19 10:56:46 2015 +0200
neutrino: use thread-safe localtime_r and gmtime_r
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/driver/lcdd.cpp b/tuxbox/neutrino/src/driver/lcdd.cpp
index 2266bcd..fa42e22 100644
--- a/tuxbox/neutrino/src/driver/lcdd.cpp
+++ b/tuxbox/neutrino/src/driver/lcdd.cpp
@@ -642,18 +642,18 @@ void CLCD::showTime()
{
if (showclock)
{
- char timestr[21];
+ char timestr[20];
struct timeval tm;
- struct tm * t;
+ struct tm lt;
gettimeofday(&tm, NULL);
- t = localtime(&tm.tv_sec);
+ localtime_r(&tm.tv_sec, <);
if (mode == MODE_STANDBY)
{
display.draw_fill_rect(-1, -1, LCD_COLS, 64, CLCDDisplay::PIXEL_OFF); // clear lcd
- ShowNewClock(&display, t->tm_hour, t->tm_min, t->tm_sec, t->tm_wday, t->tm_mday, t->tm_mon, CNeutrinoApp::getInstance()->recordingstatus);
+ ShowNewClock(&display, lt.tm_hour, lt.tm_min, lt.tm_sec, lt.tm_wday, lt.tm_mday, lt.tm_mon, CNeutrinoApp::getInstance()->recordingstatus);
}
else
{
@@ -664,7 +664,7 @@ void CLCD::showTime()
}
else
{
- strftime((char*) ×tr, 20, "%H:%M", t);
+ strftime(timestr, sizeof(timestr), "%H:%M", <);
clearClock = 1;
}
diff --git a/tuxbox/neutrino/src/driver/radiotext.cpp b/tuxbox/neutrino/src/driver/radiotext.cpp
index 210a496..a225a39 100644
--- a/tuxbox/neutrino/src/driver/radiotext.cpp
+++ b/tuxbox/neutrino/src/driver/radiotext.cpp
@@ -614,13 +614,13 @@ fprintf(stderr, "MEC=0x%02x DSN=0x%02x PSN=0x%02x MEL=%02d STATUS=0x%02x MFL=%02
if (rtp_itoggle) {
if (S_Verbose >= 1) {
- struct tm tm_store;
- struct tm *ts = localtime_r(&RTP_Starttime, &tm_store);
+ struct tm ts;
+ localtime_r(&RTP_Starttime, &ts);
if (rtp_idiffs > 0)
printf(" StartTime : %02d:%02d:%02d (last Title elapsed = %d s)\n",
- ts->tm_hour, ts->tm_min, ts->tm_sec, rtp_idiffs);
+ ts.tm_hour, ts.tm_min, ts.tm_sec, rtp_idiffs);
else
- printf(" StartTime : %02d:%02d:%02d\n", ts->tm_hour, ts->tm_min, ts->tm_sec);
+ printf(" StartTime : %02d:%02d:%02d\n", ts.tm_hour, ts.tm_min, ts.tm_sec);
printf(" RTp-Title : %s\n RTp-Artist: %s\n", RTP_Title, RTP_Artist);
}
RTP_ItemToggle = mtext[10] & 0x10;
diff --git a/tuxbox/neutrino/src/driver/vcrcontrol.cpp b/tuxbox/neutrino/src/driver/vcrcontrol.cpp
index 61a99d7..9134307 100644
--- a/tuxbox/neutrino/src/driver/vcrcontrol.cpp
+++ b/tuxbox/neutrino/src/driver/vcrcontrol.cpp
@@ -835,7 +835,7 @@ bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, c
// Create filename for recording
pos = Directory.size();
strcpy(filename, Directory.c_str());
-
+
if ((pos == 0) ||
(filename[pos - 1] != '/'))
{
@@ -843,9 +843,7 @@ bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, c
pos++;
filename[pos] = '\0';
}
-
- time_t t = time(NULL);
-
+
// %C == channel, %T == title, %I == info1, %d == date, %t == time
if (FilenameTemplate.empty())
FilenameTemplate = "%C_%T_%d_%t";
@@ -870,10 +868,13 @@ bool CVCRControl::CFileDevice::Record(const t_channel_id channel_id, int mode, c
appendEPGInfo(buf, 255, epgid);
StrSearchReplace(expandedTemplate, "%I", buf);
- strftime(buf,11,"%Y-%m-%d",localtime(&t));
+ time_t t = time(NULL);
+ struct tm tm;
+ localtime_r(&t, &tm);
+ strftime(buf,11,"%Y-%m-%d", &tm);
StrSearchReplace(expandedTemplate, "%d", buf);
- strftime(buf,7,"%H%M%S",localtime(&t));
+ strftime(buf,7,"%H%M%S", &tm);
StrSearchReplace(expandedTemplate, "%t", buf);
//printf("[CFileDevice] filename: %s, expandedTemplate: %s\n",filename,expandedTemplate.c_str());
diff --git a/tuxbox/neutrino/src/gui/channellist.cpp b/tuxbox/neutrino/src/gui/channellist.cpp
index 927a928..b0b03fe 100644
--- a/tuxbox/neutrino/src/gui/channellist.cpp
+++ b/tuxbox/neutrino/src/gui/channellist.cpp
@@ -1092,14 +1092,15 @@ void CChannelList::paintDetails(unsigned int index)
char cNoch[50] = {0}; // UTF-8
char cSeit[50] = {0}; // UTF-8
- struct tm *pStartZeit = localtime(&p_event->startTime);
+ struct tm pStartZeit;
+ localtime_r(&p_event->startTime, &pStartZeit);
unsigned seit = ( time(NULL) - p_event->startTime + 30) / 60;
if (displayNext) {
snprintf(cNoch, sizeof(cNoch), "(%d min)", p_event->duration / 60);
- snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_START), pStartZeit->tm_hour, pStartZeit->tm_min);
+ snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_START), pStartZeit.tm_hour, pStartZeit.tm_min);
} else {
- snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_SINCE), pStartZeit->tm_hour, pStartZeit->tm_min);
+ snprintf(cSeit, sizeof(cSeit), g_Locale->getText(LOCALE_CHANNELLIST_SINCE), pStartZeit.tm_hour, pStartZeit.tm_min);
int noch = (p_event->duration / 60) - seit;
if ((noch< 0) || (noch>=10000))
noch= 0;
@@ -1222,8 +1223,9 @@ void CChannelList::paintDetails(unsigned int index)
CSectionsdClient::CurrentNextInfo CurrentNext;
g_Sectionsd->getCurrentNextServiceKey(chanlist[index]->channel_id, CurrentNext);
if (!(CurrentNext.next_name.empty())) {
- struct tm *pStartZeit = localtime (& CurrentNext.next_zeit.startzeit);
- snprintf(cFrom, sizeof(cFrom), "%s %02d:%02d",g_Locale->getText(LOCALE_WORD_FROM),pStartZeit->tm_hour, pStartZeit->tm_min );
+ struct tm pStartZeit;
+ localtime_r(&CurrentNext.next_zeit.startzeit, &pStartZeit);
+ snprintf(cFrom, sizeof(cFrom), "%s %02d:%02d",g_Locale->getText(LOCALE_WORD_FROM),pStartZeit.tm_hour, pStartZeit.tm_min );
snprintf(buf, sizeof(buf), "%s", Latin1_to_UTF8(CurrentNext.next_name).c_str());
int from_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cFrom, true); // UTF-8
@@ -1385,9 +1387,10 @@ void CChannelList::paintItem(int pos)
{
if(displayNext)
{
- struct tm *pStartZeit = localtime(&p_event->startTime);
+ struct tm pStartZeit;
+ localtime_r(&p_event->startTime, &pStartZeit);
- snprintf((char*) tmp, sizeof(tmp), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
+ snprintf((char*) tmp, sizeof(tmp), "%02d:%02d", pStartZeit.tm_hour, pStartZeit.tm_min);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + 5 + numwidth + 6, ypos + xtheight, width - numwidth - 20 - 12 - prg_offset, tmp, tcolor, 0, true);
}
else
@@ -1467,12 +1470,13 @@ void CChannelList::paintHead()
char timestr[10];
char provstr[20];
time_t now = time(NULL);
- struct tm *tm = localtime(&now);
+ struct tm tm;
+ localtime_r(&now, &tm);
bool gotTime = g_Sectionsd->getIsTimeSet();
if(gotTime){
- strftime(timestr, 10, "%H:%M", tm);
+ strftime(timestr, 10, "%H:%M", &tm);
timestr_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(timestr, true); // UTF-8
timestr_offset = timestr_len + 10;
}
@@ -1641,8 +1645,9 @@ void CChannelList::paint_events(int index)
{
if (e->eventID)
{
- struct tm *tmStartZeit = localtime(&e->startTime);
- strftime(startTime, sizeof(startTime), "%H:%M", tmStartZeit );
+ struct tm tmStartZeit;
+ localtime_r(&e->startTime, &tmStartZeit);
+ strftime(startTime, sizeof(startTime), "%H:%M", &tmStartZeit );
//printf("%s %s\n", startTime, e->description.c_str());
startTimeWidth = eventStartTimeWidth;
g_Font[eventFont]->RenderString(x+ width+5, y+ theight+ pig_height + i*ffheight, startTimeWidth, startTime, /*(g_settings.colored_events_channellist == 2) ? COL_COLORED_EVENTS_CHANNELLIST :*/ COL_MENUCONTENTINACTIVE, 0, true);
diff --git a/tuxbox/neutrino/src/gui/drive_setup.cpp b/tuxbox/neutrino/src/gui/drive_setup.cpp
index 0bf5300..691e940 100644
--- a/tuxbox/neutrino/src/gui/drive_setup.cpp
+++ b/tuxbox/neutrino/src/gui/drive_setup.cpp
@@ -4564,9 +4564,11 @@ bool CDriveSetup::isIdeInterfaceActive()
// returns current time string
string CDriveSetup::getTimeStamp()
{
- time_t now = time(0);
char ret[22];
- strftime(ret, 22, "%d.%m.%Y - %H:%M:%S", localtime(&now));
+ time_t now = time(0);
+ struct tm lt;
+ localtime_r(&now, <);
+ strftime(ret, sizeof(ret), "%d.%m.%Y - %H:%M:%S", <);
return (string)ret;
}
diff --git a/tuxbox/neutrino/src/gui/epgplus.cpp b/tuxbox/neutrino/src/gui/epgplus.cpp
index 2b3c5fb..c330f2d 100644
--- a/tuxbox/neutrino/src/gui/epgplus.cpp
+++ b/tuxbox/neutrino/src/gui/epgplus.cpp
@@ -909,7 +909,8 @@ int EpgPlus::exec(CChannelList* _channelList, int selectedChannelIndex, CBouquet
is_visible = true;
time_t currentTime = time(NULL);
- tm tmStartTime = *localtime(¤tTime);
+ struct tm tmStartTime;
+ localtime_r(¤tTime, &tmStartTime);
tmStartTime.tm_sec = 0;
tmStartTime.tm_min = int(tmStartTime.tm_min/15) * 15;
@@ -1493,9 +1494,10 @@ void EpgPlus::paintChannelEntry(int position)
std::string EpgPlus::getTimeString(const time_t& time, const std::string& format)
{
char tmpstr[256];
- struct tm *tmStartTime = localtime(&time);
+ struct tm tmStartTime;
+ localtime_r(&time, &tmStartTime);
- strftime(tmpstr, sizeof(tmpstr), format.c_str(), tmStartTime );
+ strftime(tmpstr, sizeof(tmpstr), format.c_str(), &tmStartTime );
// TODO: check scope of tmpstr!
return tmpstr;
}
diff --git a/tuxbox/neutrino/src/gui/epgview.cpp b/tuxbox/neutrino/src/gui/epgview.cpp
index 4da1704..f1ed2c5 100644
--- a/tuxbox/neutrino/src/gui/epgview.cpp
+++ b/tuxbox/neutrino/src/gui/epgview.cpp
@@ -901,18 +901,20 @@ void CEpgData::GetEPGData(const t_channel_id channel_id, unsigned long long id,
reformatExtendedEvents("Presenter", g_Locale->getText(LOCALE_EPGEXTENDED_PRESENTER), false, epgData);
}
- struct tm *pStartZeit = localtime(&(epgData.epg_times).startzeit);
+ struct tm pStartZeit;
+ localtime_r(&epgData.epg_times.startzeit, &pStartZeit);
char temp[11] = {0};
- strftime( temp, sizeof(temp), "%d.%m.%Y", pStartZeit);
- epg_date = g_Locale->getText(CLocaleManager::getWeekday(pStartZeit));
+ strftime( temp, sizeof(temp), "%d.%m.%Y", &pStartZeit);
+ epg_date = g_Locale->getText(CLocaleManager::getWeekday(&pStartZeit));
epg_date += ". ";
epg_date += temp;
- strftime( temp, sizeof(temp), "%H:%M", pStartZeit);
+ strftime( temp, sizeof(temp), "%H:%M", &pStartZeit);
epg_start= temp;
long int uiEndTime((epgData.epg_times).startzeit+ (epgData.epg_times).dauer);
- struct tm *pEndeZeit = localtime((time_t*)&uiEndTime);
- strftime( temp, sizeof(temp), "%H:%M", pEndeZeit);
+ struct tm pEndeZeit;
+ localtime_r((time_t*)&uiEndTime, &pEndeZeit);
+ strftime( temp, sizeof(temp), "%H:%M", &pEndeZeit);
epg_end= temp;
epg_done= -1;
@@ -963,7 +965,7 @@ void CEpgData::GetPrevNextEPGData( unsigned long long id, time_t* startzeit )
void CEpgData::FollowScreenings(const time_t startzeit)
{
CChannelEventList::iterator e;
- struct tm *tmStartZeit;
+ struct tm tmStartZeit;
std::string screening_dates, screening_nodual;
int flag = SCREENING_AFTER;
char tmpstr[256] = {0};
@@ -972,17 +974,17 @@ void CEpgData::FollowScreenings(const time_t startzeit)
for (e = followlist.begin(); e != followlist.end(); ++e)
{
- tmStartZeit = localtime(&(e->startTime));
+ localtime_r(&e->startTime, &tmStartZeit);
- screening_dates = g_Locale->getText(CLocaleManager::getWeekday(tmStartZeit));
+ screening_dates = g_Locale->getText(CLocaleManager::getWeekday(&tmStartZeit));
screening_dates += '.';
- strftime(tmpstr, sizeof(tmpstr), " %d.", tmStartZeit );
+ strftime(tmpstr, sizeof(tmpstr), " %d.", &tmStartZeit );
screening_dates += tmpstr;
- screening_dates += g_Locale->getText(CLocaleManager::getMonth(tmStartZeit));
+ screening_dates += g_Locale->getText(CLocaleManager::getMonth(&tmStartZeit));
- strftime(tmpstr, sizeof(tmpstr), ". %H:%M ", tmStartZeit );
+ strftime(tmpstr, sizeof(tmpstr), ". %H:%M ", &tmStartZeit );
screening_dates += tmpstr;
flag = (e->startTime <= startzeit) ? SCREENING_BEFORE : SCREENING_AFTER;
diff --git a/tuxbox/neutrino/src/gui/eventlist.cpp b/tuxbox/neutrino/src/gui/eventlist.cpp
index 10f09c6..8b8f4a0 100644
--- a/tuxbox/neutrino/src/gui/eventlist.cpp
+++ b/tuxbox/neutrino/src/gui/eventlist.cpp
@@ -676,13 +676,14 @@ void EventList::paintItem(unsigned int pos)
if (evtlist[curpos].eventID != 0)
{
char tmpstr[256];
- struct tm *tmStartZeit = localtime(&evtlist[curpos].startTime);
+ struct tm tmStartZeit;
+ localtime_r(&evtlist[curpos].startTime, &tmStartZeit);
- strftime(tmpstr, sizeof(tmpstr), ". %H:%M, ", tmStartZeit );
- datetime1_str = (std::string)g_Locale->getText(CLocaleManager::getWeekday(tmStartZeit)) + tmpstr;
+ strftime(tmpstr, sizeof(tmpstr), ". %H:%M, ", &tmStartZeit );
+ datetime1_str = (std::string)g_Locale->getText(CLocaleManager::getWeekday(&tmStartZeit)) + tmpstr;
- strftime(tmpstr, sizeof(tmpstr), " %d. ", tmStartZeit );
- datetime2_str = (std::string)tmpstr + g_Locale->getText(CLocaleManager::getMonth(tmStartZeit)) + '.';
+ strftime(tmpstr, sizeof(tmpstr), " %d. ", &tmStartZeit );
+ datetime2_str = (std::string)tmpstr + g_Locale->getText(CLocaleManager::getMonth(&tmStartZeit)) + '.';
if (m_showSearchResults) // show the channel if we made a event search only (which could be made through all channels)
{
diff --git a/tuxbox/neutrino/src/gui/filebrowser.cpp b/tuxbox/neutrino/src/gui/filebrowser.cpp
index 4351daf..fc402ee 100644
--- a/tuxbox/neutrino/src/gui/filebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/filebrowser.cpp
@@ -1296,7 +1296,9 @@ void CFileBrowser::paintItem(unsigned int pos)
char timestring[18];
time_t rawtime;
rawtime = actual_file->Time;
- strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&rawtime));
+ struct tm tm;
+ gmtime_r(&rawtime, &tm);
+ strftime(timestring, sizeof(timestring), "%d-%m-%Y %H:%M", &tm);
/* right align directory time */
int time_w = fnt_item->getRenderWidth(timestring);
fnt_item->RenderString(x + width - time_w - 25, ypos+ fheight, time_w, timestring, color);
diff --git a/tuxbox/neutrino/src/gui/infoviewer.cpp b/tuxbox/neutrino/src/gui/infoviewer.cpp
index f6a836b..0c8fe07 100644
--- a/tuxbox/neutrino/src/gui/infoviewer.cpp
+++ b/tuxbox/neutrino/src/gui/infoviewer.cpp
@@ -220,9 +220,11 @@ void CInfoViewer::paintTime( bool show_dot, bool firstPaint )
char timestr[10];
struct timeval tm;
+ struct tm lt;
gettimeofday(&tm, NULL);
- strftime((char*) ×tr, 10, "%H:%M", localtime(&tm.tv_sec) );
+ localtime_r(&tm.tv_sec, <);
+ strftime(timestr, sizeof(timestr), "%H:%M", <);
if ( ( !firstPaint ) && ( strcmp( timestr, old_timestr ) == 0 ) )
{
@@ -1725,6 +1727,7 @@ void CInfoViewer::show_Data(bool calledFromEvent)
#endif
time_t jetzt=time(NULL);
+ struct tm pStartZeit;
if (info_CurrentNext.flags & CSectionsdClient::epgflags::has_current)
{
int seit = (abs(jetzt - info_CurrentNext.current_zeit.startzeit) + 30) / 60;
@@ -1742,8 +1745,8 @@ void CInfoViewer::show_Data(bool calledFromEvent)
else
sprintf((char*)&runningRest, "%d +%d min", info_CurrentNext.current_zeit.dauer / 60, -rest);
}
- struct tm *pStartZeit = localtime(&info_CurrentNext.current_zeit.startzeit);
- sprintf((char*)&runningStart, "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
+ localtime_r(&info_CurrentNext.current_zeit.startzeit, &pStartZeit);
+ sprintf((char*)&runningStart, "%02d:%02d", pStartZeit.tm_hour, pStartZeit.tm_min);
} else
last_curr_id = 0;
@@ -1751,8 +1754,8 @@ void CInfoViewer::show_Data(bool calledFromEvent)
{
unsigned dauer = info_CurrentNext.next_zeit.dauer / 60;
sprintf((char*)&nextDuration, "%d min", dauer);
- struct tm *pStartZeit = localtime(&info_CurrentNext.next_zeit.startzeit);
- sprintf((char*)&nextStart, "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
+ localtime_r(&info_CurrentNext.next_zeit.startzeit, &pStartZeit);
+ sprintf((char*)&nextStart, "%02d:%02d", pStartZeit.tm_hour, pStartZeit.tm_min);
} else
last_next_id = 0;
@@ -2085,8 +2088,9 @@ void CInfoViewer::showEpgInfo() //message on event change
{
char nextStart[10];
int mode = CNeutrinoApp::getInstance()->getMode();
- struct tm *pnStartZeit = localtime(&info_CurrentNext.next_zeit.startzeit);
- sprintf((char*)&nextStart, "%02d:%02d", pnStartZeit->tm_hour, pnStartZeit->tm_min);
+ struct tm pnStartZeit;
+ localtime_r(&info_CurrentNext.next_zeit.startzeit, &pnStartZeit);
+ sprintf((char*)&nextStart, "%02d:%02d", pnStartZeit.tm_hour, pnStartZeit.tm_min);
/* show epg info only if we in TV- or Radio mode and current event is not the same like before */
if ((eventname != info_CurrentNext.current_name) && (mode != 0))
diff --git a/tuxbox/neutrino/src/gui/moviebrowser.cpp b/tuxbox/neutrino/src/gui/moviebrowser.cpp
index 7f9036d..96d7a95 100644
--- a/tuxbox/neutrino/src/gui/moviebrowser.cpp
+++ b/tuxbox/neutrino/src/gui/moviebrowser.cpp
@@ -3396,7 +3396,7 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite
char str_tmp[MAX_STR_TMP];
bool result = true;
*item_string="";
- tm* tm_tmp;
+ struct tm tm_tmp;
char text[20];
int i=0;
@@ -3458,13 +3458,13 @@ bool CMovieBrowser::getMovieInfoItem(MI_MOVIE_INFO& movie_info, MB_INFO_ITEM ite
*item_string = str_tmp;
break;
case MB_INFO_PREVPLAYDATE: // = 12,
- tm_tmp = localtime(&movie_info.dateOfLastPlay);
- snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp->tm_mday,(tm_tmp->tm_mon)+ 1, tm_tmp->tm_year >= 100 ? tm_tmp->tm_year-100 : tm_tmp->tm_year);
+ localtime_r(&movie_info.dateOfLastPlay, &tm_tmp);
+ snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp.tm_mday,(tm_tmp.tm_mon)+ 1, tm_tmp.tm_year >= 100 ? tm_tmp.tm_year-100 : tm_tmp.tm_year);
*item_string = str_tmp;
break;
case MB_INFO_RECORDDATE: // = 13,
- tm_tmp = localtime(&movie_info.file.Time);
- snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp->tm_mday,(tm_tmp->tm_mon) + 1,tm_tmp->tm_year >= 100 ? tm_tmp->tm_year-100 : tm_tmp->tm_year);
+ localtime_r(&movie_info.file.Time, &tm_tmp);
+ snprintf(str_tmp,MAX_STR_TMP,"%02d.%02d.%02d",tm_tmp.tm_mday,(tm_tmp.tm_mon) + 1,tm_tmp.tm_year >= 100 ? tm_tmp.tm_year-100 : tm_tmp.tm_year);
*item_string = str_tmp;
break;
case MB_INFO_PRODDATE: // = 14,
diff --git a/tuxbox/neutrino/src/gui/movieinfo.cpp b/tuxbox/neutrino/src/gui/movieinfo.cpp
index c7c20b7..42537f4 100644
--- a/tuxbox/neutrino/src/gui/movieinfo.cpp
+++ b/tuxbox/neutrino/src/gui/movieinfo.cpp
@@ -493,7 +493,7 @@ void CMovieInfo::showMovieInfo(const char* filename)
void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info)
{
std::string print_buffer;
- tm* date_tm;
+ struct tm date_tm;
char date_char[100];
// prepare print buffer
print_buffer = movie_info.epgInfo1;
@@ -609,14 +609,14 @@ void CMovieInfo::showMovieInfo(MI_MOVIE_INFO& movie_info)
print_buffer += "\n\n";
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_PREVPLAYDATE);
print_buffer += ": ";
- date_tm = localtime(&movie_info.dateOfLastPlay);
- snprintf(date_char, 12,"%02d.%02d.%04d",date_tm->tm_mday,date_tm->tm_mon+1,date_tm->tm_year +1900);
+ localtime_r(&movie_info.dateOfLastPlay, &date_tm);
+ snprintf(date_char, 12,"%02d.%02d.%04d",date_tm.tm_mday,date_tm.tm_mon+1,date_tm.tm_year +1900);
print_buffer += date_char;
print_buffer += "\n";
print_buffer += g_Locale->getText(LOCALE_MOVIEBROWSER_INFO_RECORDDATE);
print_buffer += ": ";
- date_tm = localtime(&movie_info.file.Time);
- snprintf(date_char, 12,"%02d.%02d.%04d",date_tm->tm_mday,date_tm->tm_mon+1,date_tm->tm_year +1900);
+ localtime_r(&movie_info.file.Time, &date_tm);
+ snprintf(date_char, 12,"%02d.%02d.%04d",date_tm.tm_mday,date_tm.tm_mon+1,date_tm.tm_year +1900);
print_buffer += date_char;
if(movie_info.file.Size != 0 )
{
diff --git a/tuxbox/neutrino/src/gui/movieplayer2.cpp b/tuxbox/neutrino/src/gui/movieplayer2.cpp
index 19a9a07..5f54380 100644
--- a/tuxbox/neutrino/src/gui/movieplayer2.cpp
+++ b/tuxbox/neutrino/src/gui/movieplayer2.cpp
@@ -1076,7 +1076,9 @@ ReceiveStreamThread(void *arg)
skipvalue[0] = '+';
o = 1;
}
- strftime(&skipvalue[o], 9, "%T", gmtime(&s));
+ struct tm tm;
+ gmtime_r(&s, &tm);
+ strftime(&skipvalue[o], 9, "%T", &tm);
counter = 0;
skipurl = baseurl;
skipurl += "requests/status.xml?command=seek&val=";
diff --git a/tuxbox/neutrino/src/gui/pictureviewer.cpp b/tuxbox/neutrino/src/gui/pictureviewer.cpp
index a95024e..3a595c3 100644
--- a/tuxbox/neutrino/src/gui/pictureviewer.cpp
+++ b/tuxbox/neutrino/src/gui/pictureviewer.cpp
@@ -554,7 +554,9 @@ void CPictureViewerGui::paintItem(int pos)
tmp += playlist[liststart+pos].Type;
tmp += ')';
char timestring[18];
- strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[liststart+pos].Date));
+ struct tm tm;
+ gmtime_r(&playlist[liststart+pos].Date, &tm);
+ strftime(timestring, sizeof(timestring), "%d-%m-%Y %H:%M", &tm);
int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(timestring);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, width-30 - w, tmp, color, fheight, true); // UTF-8
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+width-20-w,ypos+fheight, w, timestring, color, fheight);
@@ -667,7 +669,9 @@ void CPictureViewerGui::view(unsigned int index, bool unscaled)
CLCD::getInstance()->showMenuText(0, playlist[index].Name.c_str(), -1, true); // UTF-8
char timestring[19];
- strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[index].Date));
+ struct tm tm;
+ gmtime_r(&playlist[index].Date, &tm);
+ strftime(timestring, sizeof(timestring), "%d-%m-%Y %H:%M", &tm);
CLCD::getInstance()->showMenuText(1, timestring);
if(m_state == MENU)
diff --git a/tuxbox/neutrino/src/gui/subchannel_select.cpp b/tuxbox/neutrino/src/gui/subchannel_select.cpp
index 16c347a..db58e4a 100644
--- a/tuxbox/neutrino/src/gui/subchannel_select.cpp
+++ b/tuxbox/neutrino/src/gui/subchannel_select.cpp
@@ -77,14 +77,14 @@ int CSubChannelSelectMenu::doMenu()
{
char nvod_time_a[50], nvod_time_e[50], nvod_time_x[50];
char nvod_s[100];
- struct tm *tmZeit;
+ struct tm tmZeit;
- tmZeit = localtime(&e->startzeit);
- sprintf(nvod_time_a, "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
+ localtime_r(&e->startzeit, &tmZeit);
+ sprintf(nvod_time_a, "%02d:%02d", tmZeit.tm_hour, tmZeit.tm_min);
time_t endtime = e->startzeit + e->dauer;
- tmZeit = localtime(&endtime);
- sprintf(nvod_time_e, "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
+ localtime_r(&endtime, &tmZeit);
+ sprintf(nvod_time_e, "%02d:%02d", tmZeit.tm_hour, tmZeit.tm_min);
time_t jetzt = time(NULL);
if (e->startzeit > jetzt)
diff --git a/tuxbox/neutrino/src/gui/timeosd.cpp b/tuxbox/neutrino/src/gui/timeosd.cpp
index 1af084e..8cae6cd 100644
--- a/tuxbox/neutrino/src/gui/timeosd.cpp
+++ b/tuxbox/neutrino/src/gui/timeosd.cpp
@@ -82,7 +82,9 @@ void CTimeOSD::update()
}
if(tDisplayTime < 0)
tDisplayTime=0;
- strftime(cDisplayTime, 9, "%T", gmtime(&tDisplayTime));
+ struct tm tm;
+ gmtime_r(&tDisplayTime, &tm);
+ strftime(cDisplayTime, 9, "%T", &tm);
frameBuffer->paintBoxRel(m_xend - m_width - 10, m_y , m_width + 10 , m_height, color, RADIUS_MID);
g_Font[TIMEOSD_FONT]->RenderString(m_xend - m_width - 5,m_y + m_height,
m_width+5, cDisplayTime, color);
diff --git a/tuxbox/neutrino/src/gui/timerlist.cpp b/tuxbox/neutrino/src/gui/timerlist.cpp
index fa4ab60..94a5d16 100644
--- a/tuxbox/neutrino/src/gui/timerlist.cpp
+++ b/tuxbox/neutrino/src/gui/timerlist.cpp
@@ -109,10 +109,11 @@ public:
if(type == CTimerd::TIMER_RECORD)
{
*stopTime=(time(NULL)/60)*60;
- struct tm *tmTime2 = localtime(stopTime);
- sprintf( display, "%02d.%02d.%04d %02d:%02d", tmTime2->tm_mday, tmTime2->tm_mon+1,
- tmTime2->tm_year+1900,
- tmTime2->tm_hour, tmTime2->tm_min);
+ struct tm tmTime2;
+ localtime_r(stopTime, &tmTime2);
+ sprintf( display, "%02d.%02d.%04d %02d:%02d", tmTime2.tm_mday, tmTime2.tm_mon+1,
+ tmTime2.tm_year+1900,
+ tmTime2.tm_hour, tmTime2.tm_min);
m1->setActive(true);
m6->setActive((g_settings.recording_type == RECORDING_FILE));
}
@@ -594,12 +595,14 @@ void CTimerList::paintItem(int pos)
if(liststart+pos<timerlist.size())
{
CTimerd::responseGetTimer & timer = timerlist[liststart+pos];
- char zAlarmTime[25] = {0};
- struct tm *alarmTime = localtime(&(timer.alarmTime));
- strftime(zAlarmTime,20,"%d.%m. %H:%M",alarmTime);
- char zStopTime[25] = {0};
- struct tm *stopTime = localtime(&(timer.stopTime));
- strftime(zStopTime,20,"%d.%m. %H:%M",stopTime);
+ char zAlarmTime[20];
+ struct tm alarmTime;
+ localtime_r(&timer.alarmTime, &alarmTime);
+ strftime(zAlarmTime, sizeof(zAlarmTime), "%d.%m. %H:%M", &alarmTime);
+ char zStopTime[20];
+ struct tm stopTime;
+ localtime_r(&timer.stopTime, &stopTime);
+ strftime(zStopTime,sizeof(zStopTime), "%d.%m. %H:%M", &stopTime);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10, ypos+fheight, time_width, zAlarmTime, color, fheight, true); // UTF-8
if(timer.stopTime != 0)
{
@@ -1158,14 +1161,15 @@ bool askUserOnTimerConflict(time_t announceTime, time_t stopTime)
std::string timerbuf = g_Locale->getText(LOCALE_TIMERLIST_OVERLAPPING_TIMER1);
timerbuf += "\n";
- char rec[25] = {0};
- struct tm *recTime = localtime(&announceTime);
- strftime(rec,20,"%d.%m. %H:%M",recTime);
+ char rec[20];
+ struct tm recTime;
+ localtime_r(&announceTime, &recTime);
+ strftime(rec, sizeof(rec), "%d.%m. %H:%M", &recTime);
timerbuf += rec;
- recTime = localtime(&stopTime);
+ localtime_r(&stopTime, &recTime);
if(stopTime > announceTime)
{
- strftime(rec,20,"- %d.%m. %H:%M",recTime);
+ strftime(rec, sizeof(rec), "- %d.%m. %H:%M", &recTime);
timerbuf += rec;
}
@@ -1175,15 +1179,17 @@ bool askUserOnTimerConflict(time_t announceTime, time_t stopTime)
for (CTimerd::TimerList::iterator it = overlappingTimers.begin();
it != overlappingTimers.end(); ++it)
{
- char at[25] = {0};
- struct tm *annTime = localtime(&(it->alarmTime));
- strftime(at,20,"%d.%m. %H:%M",annTime);
+ char at[20];
+ struct tm annTime;
+ localtime_r(&it->alarmTime, &annTime);
+ strftime(at, sizeof(at), "%d.%m. %H:%M", &annTime);
timerbuf += at;
timerbuf += " - ";
- char st[25] = {0};
- struct tm *sTime = localtime(&(it->stopTime));
- strftime(st,20,"%d.%m. %H:%M",sTime);
+ char st[20];
+ struct tm sTime;
+ localtime_r(&it->stopTime, &sTime);
+ strftime(st, sizeof(st), "%d.%m. %H:%M", &sTime);
timerbuf += st;
timerbuf += " -> ";
timerbuf += CTimerList::convertTimerType2String(it->eventType);
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
index 9adfc5a..74c6bdc 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
@@ -486,10 +486,11 @@ CDateInput::~CDateInput()
}
void CDateInput::onBeforeExec()
{
- struct tm *tmTime = localtime(time);
- snprintf(value, 20, "%02d.%02d.%04d %02d:%02d", tmTime->tm_mday, tmTime->tm_mon+1,
- tmTime->tm_year+1900,
- tmTime->tm_hour, tmTime->tm_min);
+ struct tm tmTime;
+ localtime_r(time, &tmTime);
+ snprintf(value, 20, "%02d.%02d.%04d %02d:%02d", tmTime.tm_mday, tmTime.tm_mon+1,
+ tmTime.tm_year+1900,
+ tmTime.tm_hour, tmTime.tm_min);
}
void CDateInput::onAfterExec()
@@ -528,10 +529,11 @@ void CDateInput::onAfterExec()
if(tmTime.tm_sec<0)
tmTime.tm_sec=0;
*time=mktime(&tmTime);
- struct tm *tmTime2 = localtime(time);
- snprintf(value, 20, "%02d.%02d.%04d %02d:%02d", tmTime2->tm_mday, tmTime2->tm_mon+1,
- tmTime2->tm_year+1900,
- tmTime2->tm_hour, tmTime2->tm_min);
+ struct tm tmTime2;
+ localtime_r(time, &tmTime2);
+ snprintf(value, 20, "%02d.%02d.%04d %02d:%02d", tmTime2.tm_mday, tmTime2.tm_mon+1,
+ tmTime2.tm_year+1900,
+ tmTime2.tm_hour, tmTime2.tm_min);
}
//-----------------------------#################################-------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
.../neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp | 9 +++-
.../daemons/nhttpd/yhttpd_mods/mod_cache.cpp | 3 +-
tuxbox/neutrino/daemons/sectionsd/SIsections.cpp | 4 +-
tuxbox/neutrino/src/driver/lcdd.cpp | 10 ++--
tuxbox/neutrino/src/driver/radiotext.cpp | 8 ++--
tuxbox/neutrino/src/driver/vcrcontrol.cpp | 13 +++---
tuxbox/neutrino/src/gui/channellist.cpp | 27 +++++++-----
tuxbox/neutrino/src/gui/drive_setup.cpp | 6 ++-
tuxbox/neutrino/src/gui/epgplus.cpp | 8 ++-
tuxbox/neutrino/src/gui/epgview.cpp | 26 ++++++-----
tuxbox/neutrino/src/gui/eventlist.cpp | 11 +++--
tuxbox/neutrino/src/gui/filebrowser.cpp | 4 +-
tuxbox/neutrino/src/gui/infoviewer.cpp | 18 +++++---
tuxbox/neutrino/src/gui/moviebrowser.cpp | 10 ++--
tuxbox/neutrino/src/gui/movieinfo.cpp | 10 ++--
tuxbox/neutrino/src/gui/movieplayer2.cpp | 4 +-
tuxbox/neutrino/src/gui/pictureviewer.cpp | 8 +++-
tuxbox/neutrino/src/gui/subchannel_select.cpp | 10 ++--
tuxbox/neutrino/src/gui/timeosd.cpp | 4 +-
tuxbox/neutrino/src/gui/timerlist.cpp | 48 +++++++++++---------
tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp | 18 ++++---
21 files changed, 149 insertions(+), 110 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-18 14:08:25
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 488b2b49a03eaf1bef874d38ac97b7f8078c14eb (commit)
from 1861fb8666a28eba0eabbaa990ec1c8720142375 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 488b2b49a03eaf1bef874d38ac97b7f8078c14eb
Author: Stefan Seyfried <se...@tu...>
Date: Mon May 18 16:06:40 2015 +0200
revert: sectionsd: fix memleak with unused events
does not work on dbox
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
index 825264e..893fc20 100644
--- a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
+++ b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
@@ -846,7 +846,6 @@ static void addEvent(const SIevent &evt, const time_t zeit, bool cn = false)
continue;
/* else: keep the old event with the lower table_id */
unlockEvents();
- delete eptr;
return;
}
if ((*x)->times.begin()->startzeit >= end_time)
@@ -862,7 +861,6 @@ static void addEvent(const SIevent &evt, const time_t zeit, bool cn = false)
dprintf("%s: don't replace 0x%016llx.%02x with 0x%016llx.%02x\n",
__func__, x_key, (*x)->table_id, e_key, e->table_id);
unlockEvents();
- delete eptr;
return;
}
/* SRF special case: advertising is inserted with start time of
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-18 12:59:28
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 1861fb8666a28eba0eabbaa990ec1c8720142375 (commit)
from 08814bc329f1b8c2ac5264aaec7cfe55df57b13c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1861fb8666a28eba0eabbaa990ec1c8720142375
Author: Stefan Seyfried <se...@tu...>
Date: Mon May 18 14:58:33 2015 +0200
sectionsd: fix memleak with unused events
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
index 893fc20..825264e 100644
--- a/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
+++ b/tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp
@@ -846,6 +846,7 @@ static void addEvent(const SIevent &evt, const time_t zeit, bool cn = false)
continue;
/* else: keep the old event with the lower table_id */
unlockEvents();
+ delete eptr;
return;
}
if ((*x)->times.begin()->startzeit >= end_time)
@@ -861,6 +862,7 @@ static void addEvent(const SIevent &evt, const time_t zeit, bool cn = false)
dprintf("%s: don't replace 0x%016llx.%02x with 0x%016llx.%02x\n",
__func__, x_key, (*x)->table_id, e_key, e->table_id);
unlockEvents();
+ delete eptr;
return;
}
/* SRF special case: advertising is inserted with start time of
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/daemons/sectionsd/sectionsd.cpp | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-17 15:25:39
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 08814bc329f1b8c2ac5264aaec7cfe55df57b13c (commit)
from 5a34ea4859dd2b93f8923b2c62ce0ccb4cc4e4f4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 08814bc329f1b8c2ac5264aaec7cfe55df57b13c
Author: GetAway <get...@t-...>
Date: Sun May 17 17:24:44 2015 +0200
reverse: add new line and line feed to xml
currently makes no sense and
break down reading of saved EPG data
Signed-off-by: GetAway <get...@t-...>
diff --git a/dvb/zapit/lib/zapittools.cpp b/dvb/zapit/lib/zapittools.cpp
index 6d17be5..1c1ce51 100644
--- a/dvb/zapit/lib/zapittools.cpp
+++ b/dvb/zapit/lib/zapittools.cpp
@@ -94,13 +94,6 @@ namespace ZapitTools {
case '\'':
r += "'";
break;
- case 0x0a:
- r +="
";
- break;
- case 0x0d:
- r +="
";
- break;
-
default:
r += *s;
}
diff --git a/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp b/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp
index 332bf4b..a47ec0d 100644
--- a/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp
+++ b/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp
@@ -162,7 +162,7 @@ time_t changeUTCtoCtime(const unsigned char *buffer, int local_time)
}
// Thanks to tmbinc
-int saveStringToXMLfile(FILE *out, const char *c /*, int withControlCodes*/)
+int saveStringToXMLfile(FILE *out, const char *c, int withControlCodes)
{
if(!c)
return 1;
@@ -178,28 +178,15 @@ int saveStringToXMLfile(FILE *out, const char *c /*, int withControlCodes*/)
*/
for(;*c; c++) {
switch ((unsigned char)*c) {
- case '<':
- fprintf(out, "<");
- break;
- case '>':
- fprintf(out, ">");
- break;
- case '&':
- fprintf(out, "&");
- break;
- case '\"':
- fprintf(out, """);
- break;
- case '\'':
- fprintf(out, "'");
- break;
- case 0x0a:
- fprintf(out,"
");
- break;
- case 0x0d:
- fprintf(out,"
");
- break;
-#if 0
+ case '&':
+ fprintf(out, "&");
+ break;
+ case '<':
+ fprintf(out, "<");
+ break;
+ case '\"':
+ fprintf(out, """);
+ break;
case 0x81:
case 0x82:
break;
@@ -222,12 +209,6 @@ int saveStringToXMLfile(FILE *out, const char *c /*, int withControlCodes*/)
fprintf(out, "%c", *c);
else
fprintf(out, "&#%d;", *c);
-#else
- default:
- if ((unsigned char)*c<32)
- break;
- fprintf(out, "%c", *c);
-#endif
} // case
} // for
diff --git a/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp b/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp
index f1976b0..4dc269e 100644
--- a/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp
+++ b/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp
@@ -29,7 +29,7 @@ time_t changeUTCtoCtime(const unsigned char *buffer, int local_time=1);
// returns the descriptor type as readable text
const char *decode_descr (unsigned char tag_value);
-int saveStringToXMLfile(FILE *out, const char *string /*, int withControlCodes=0*/);
+int saveStringToXMLfile(FILE *out, const char *string, int withControlCodes=0);
// Entfernt die ControlCodes aus dem String (-> String wird evtl. kuerzer)
void removeControlCodes(char *string);
diff --git a/tuxbox/neutrino/src/gui/movieinfo.cpp b/tuxbox/neutrino/src/gui/movieinfo.cpp
index e7410ed..c7c20b7 100644
--- a/tuxbox/neutrino/src/gui/movieinfo.cpp
+++ b/tuxbox/neutrino/src/gui/movieinfo.cpp
@@ -725,8 +725,6 @@ std::string decodeXmlSpecialChars(std::string s)
StrSearchReplace(s,"&","&");
StrSearchReplace(s,""","\"");
StrSearchReplace(s,"'","\'");
- StrSearchReplace(s,"
","\n");
- StrSearchReplace(s,"
","\n");
return s;
}
-----------------------------------------------------------------------
Summary of changes:
dvb/zapit/lib/zapittools.cpp | 7 ----
tuxbox/neutrino/daemons/sectionsd/SIutils.cpp | 39 ++++++------------------
tuxbox/neutrino/daemons/sectionsd/SIutils.hpp | 2 +-
tuxbox/neutrino/src/gui/movieinfo.cpp | 2 -
4 files changed, 11 insertions(+), 39 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-17 13:56:08
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 5a34ea4859dd2b93f8923b2c62ce0ccb4cc4e4f4 (commit)
from 1f417d7035b06cd727b9f156d7627af009ebbbb2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5a34ea4859dd2b93f8923b2c62ce0ccb4cc4e4f4
Author: m4...@gm... <m4...@gm...>
Date: Sun May 17 15:55:16 2015 +0200
zapit.cpp: simplify
Signed-off-by: GetAway <get...@t-...>
diff --git a/dvb/zapit/src/zapit.cpp b/dvb/zapit/src/zapit.cpp
index 2998f08..19cdb89 100644
--- a/dvb/zapit/src/zapit.cpp
+++ b/dvb/zapit/src/zapit.cpp
@@ -2808,62 +2808,49 @@ void sendChannels(int connfd, const CZapitClient::channelsMode mode, const CZapi
int startPlayBack(CZapitChannel *thisChannel)
{
- bool have_pcr = false;
- bool have_audio = false;
- bool have_video = false;
- bool have_teletext = false;
-
- if ((playbackStopForced == true) || (!thisChannel))
+ if (playbackStopForced || !thisChannel)
return -1;
- if (thisChannel->getPcrPid() != 0) {
- have_pcr = true;
- }
- if (thisChannel->getAudioPid() != NONE) {
- have_audio = true;
- }
- if ((thisChannel->getVideoPid() != NONE) && (currentMode & TV_MODE)) {
- have_video = true;
- }
- if (thisChannel->getTeletextPid() != 0) {
- have_teletext = true;
- }
+ unsigned short pcr_pid = thisChannel->getPcrPid();
+ unsigned short audio_pid = thisChannel->getAudioPid();
+ unsigned short video_pid = (currentMode & TV_MODE) ? thisChannel->getVideoPid() : 0;
+ unsigned short teletext_pid = thisChannel->getTeletextPid();
+ printf("[zapit] vpid %X apid %X pcr %X\n", video_pid, audio_pid, pcr_pid);
- if ((!have_audio) && (!have_video) && (!have_teletext)) {
+ if (!audio_pid && !video_pid && !teletext_pid)
return -1;
- }
/* set demux filters */
- if (have_video) {
+ if (video_pid) {
if (!videoDemux)
videoDemux = new CDemux();
- if (videoDemux->pesFilter(thisChannel->getVideoPid(), DMX_OUT_DECODER, DMX_PES_VIDEO) < 0)
+ if (videoDemux->pesFilter(video_pid, DMX_OUT_DECODER, DMX_PES_VIDEO) < 0)
return -1;
if (videoDemux->start() < 0)
return -1;
}
- if (have_audio) {
+ if (audio_pid) {
if (!audioDemux)
audioDemux = new CDemux();
- if (audioDemux->pesFilter(thisChannel->getAudioPid(), DMX_OUT_DECODER, DMX_PES_AUDIO) < 0)
+ if (audioDemux->pesFilter(audio_pid, DMX_OUT_DECODER, DMX_PES_AUDIO) < 0)
return -1;
if (audioDemux->start() < 0)
return -1;
}
- if (have_pcr) {
+ if (pcr_pid) {
if (!pcrDemux)
pcrDemux = new CDemux();
- if (pcrDemux->pesFilter(thisChannel->getPcrPid(), DMX_OUT_DECODER, DMX_PES_PCR) < 0)
+ if (pcrDemux->pesFilter(pcr_pid, DMX_OUT_DECODER, DMX_PES_PCR) < 0)
return -1;
if (pcrDemux->start() < 0)
return -1;
}
#ifdef HAVE_DBOX_HARDWARE
/* AFAIK only the dbox2 can reinsert telextext... */
- if (have_teletext) {
+ if (teletext_pid) {
if (!teletextDemux)
teletextDemux = new CDemux();
- if (teletextDemux->pesFilter(thisChannel->getTeletextPid(), DMX_OUT_DECODER, DMX_PES_TELETEXT) < 0)
+ if (teletextDemux->pesFilter(teletext_pid, DMX_OUT_DECODER, DMX_PES_TELETEXT) < 0)
return -1;
if (teletextDemux->start() < 0)
return -1;
@@ -2881,14 +2868,14 @@ int startPlayBack(CZapitChannel *thisChannel)
*/
#ifndef HAVE_TRIPLEDRAGON
/* start video */
- if (have_video) {
+ if (video_pid) {
videoDecoder->setSource(VIDEO_SOURCE_DEMUX);
videoDecoder->start();
}
#endif
/* select audio output and start audio */
- if (have_audio) {
+ if (audio_pid) {
if (thisChannel->getAudioChannel()->isAc3)
audioDecoder->enableBypass();
else
@@ -2900,7 +2887,7 @@ int startPlayBack(CZapitChannel *thisChannel)
#ifdef HAVE_TRIPLEDRAGON
/* start video */
- if (have_video) {
+ if (video_pid) {
videoDecoder->setBlank(true);
videoDecoder->setSource(VIDEO_SOURCE_DEMUX);
videoDecoder->start();
@@ -3144,8 +3131,7 @@ unsigned zapTo(const unsigned int channel)
CBouquetManager::ChannelIterator cit = ((currentMode & RADIO_MODE) ? bouquetManager->radioChannelsBegin() : bouquetManager->tvChannelsBegin()).FindChannelNr(channel);
if (!(cit.EndOfChannels()))
return zapTo_ChannelID((*cit)->getChannelID(), false);
- else
- return 0;
+ return 0;
}
void signal_handler(int signum)
-----------------------------------------------------------------------
Summary of changes:
dvb/zapit/src/zapit.cpp | 52 +++++++++++++++++-----------------------------
1 files changed, 19 insertions(+), 33 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-16 15:46:09
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 1f417d7035b06cd727b9f156d7627af009ebbbb2 (commit)
from 46ef70fbfbc30a552dc40cdc3f18ea140822f6a0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1f417d7035b06cd727b9f156d7627af009ebbbb2
Author: GetAway <get...@t-...>
Date: Sat May 16 17:45:22 2015 +0200
fix strict aliasing warnings
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp
index bcaea2b..800b619 100644
--- a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp
@@ -2492,7 +2492,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
else // default: no repeat
rep = (CTimerd::CTimerEventRepeat)0;
if(((int)rep) >= ((int)CTimerd::TIMERREPEAT_WEEKDAYS) && !hh->ParamList["wd"].empty())
- NeutrinoAPI->Timerd->getWeekdaysFromStr((int*)&rep, hh->ParamList["wd"].c_str());
+ NeutrinoAPI->Timerd->getWeekdaysFromStr(&rep, hh->ParamList["wd"].c_str());
// apids
bool changeApids=false;
diff --git a/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp b/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp
index eeee6b4..49685f5 100644
--- a/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp
+++ b/tuxbox/neutrino/lib/timerdclient/timerdclient.cpp
@@ -449,22 +449,24 @@ void CTimerdClient::getZaptoSafety(int &pre)
}
//-------------------------------------------------------------------------
-void CTimerdClient::getWeekdaysFromStr(int *rep, const char* str)
+void CTimerdClient::getWeekdaysFromStr(CTimerd::CTimerEventRepeat *eventRepeat, const char* str)
{
- if(*rep >= (int)CTimerd::TIMERREPEAT_WEEKDAYS)
+ int rep = (int) *eventRepeat;
+ if(rep >= (int)CTimerd::TIMERREPEAT_WEEKDAYS)
{
for(int n=0;n<7;n++)
{
if(str[n]=='X' || str[n]=='x')
{
- *rep |= (1 << (n+9));
+ rep |= (1 << (n+9));
}
else
{
- *rep &= (~(1 << (n+9)));
+ rep &= (~(1 << (n+9)));
}
}
}
+ *eventRepeat = (CTimerd::CTimerEventRepeat) rep;
}
//-------------------------------------------------------------------------
void CTimerdClient::setWeekdaysToStr(CTimerd::CTimerEventRepeat rep, char* str)
diff --git a/tuxbox/neutrino/lib/timerdclient/timerdclient.h b/tuxbox/neutrino/lib/timerdclient/timerdclient.h
index f35449e..5696c0b 100644
--- a/tuxbox/neutrino/lib/timerdclient/timerdclient.h
+++ b/tuxbox/neutrino/lib/timerdclient/timerdclient.h
@@ -168,7 +168,7 @@ class CTimerdClient:private CBasicClient
void getZaptoSafety(int &pre);
// Convert String of O and X to repeat type and vice versa
- void getWeekdaysFromStr(int *rep, const char* str);
+ void getWeekdaysFromStr(CTimerd::CTimerEventRepeat *rep, const char* str);
void setWeekdaysToStr(CTimerd::CTimerEventRepeat rep, char* str);
};
diff --git a/tuxbox/neutrino/src/gui/timerlist.cpp b/tuxbox/neutrino/src/gui/timerlist.cpp
index 2a88102..fa4ab60 100644
--- a/tuxbox/neutrino/src/gui/timerlist.cpp
+++ b/tuxbox/neutrino/src/gui/timerlist.cpp
@@ -256,7 +256,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
{
timerlist[selected].announceTime = timerlist[selected].alarmTime -60;
if(timerlist[selected].eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS)
- Timer->getWeekdaysFromStr((int *)&timerlist[selected].eventRepeat, m_weekdaysStr);
+ Timer->getWeekdaysFromStr(&timerlist[selected].eventRepeat, m_weekdaysStr);
if(timerlist[selected].eventType == CTimerd::TIMER_RECORD)
{
timerlist[selected].announceTime -= 120; // 2 more mins for rec timer
@@ -323,7 +323,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
data= timerNew.pluginName;
}
if(timerNew.eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS)
- Timer->getWeekdaysFromStr((int *)&timerNew.eventRepeat, m_weekdaysStr);
+ Timer->getWeekdaysFromStr(&timerNew.eventRepeat, m_weekdaysStr);
if (Timer->addTimerEvent(timerNew.eventType,data,timerNew.announceTime,timerNew.alarmTime,
timerNew.stopTime,timerNew.eventRepeat,timerNew.repeatCount,false) == -1)
-----------------------------------------------------------------------
Summary of changes:
.../daemons/nhttpd/tuxboxapi/controlapi.cpp | 2 +-
tuxbox/neutrino/lib/timerdclient/timerdclient.cpp | 10 ++++++----
tuxbox/neutrino/lib/timerdclient/timerdclient.h | 2 +-
tuxbox/neutrino/src/gui/timerlist.cpp | 4 ++--
4 files changed, 10 insertions(+), 8 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-16 14:33:47
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 46ef70fbfbc30a552dc40cdc3f18ea140822f6a0 (commit)
from fde68c8aeb7303fdcd7dcd01a6e77dc2a2a4ab08 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 46ef70fbfbc30a552dc40cdc3f18ea140822f6a0
Author: GetAway <get...@t-...>
Date: Sat May 16 16:02:05 2015 +0200
timerd: use thread-safe localtime_r
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/timerd/timermanager.cpp b/tuxbox/neutrino/daemons/timerd/timermanager.cpp
index 5efb20d..9922749 100644
--- a/tuxbox/neutrino/daemons/timerd/timermanager.cpp
+++ b/tuxbox/neutrino/daemons/timerd/timermanager.cpp
@@ -829,16 +829,17 @@ CTimerEvent::CTimerEvent( CTimerd::CTimerEventTypes evtype, int mon, int day, in
{
time_t mtime = time(NULL);
- struct tm *tmtime = localtime(&mtime);
+ struct tm tmtime;
+ localtime_r(&mtime, &tmtime);
if(mon > 0)
- tmtime->tm_mon = mon -1;
+ tmtime.tm_mon = mon -1;
if(day > 0)
- tmtime->tm_mday = day;
- tmtime->tm_hour = hour;
- tmtime->tm_min = min;
+ tmtime.tm_mday = day;
+ tmtime.tm_hour = hour;
+ tmtime.tm_min = min;
- CTimerEvent(evtype, (time_t) 0, mktime(tmtime), (time_t)0, evrepeat, repeatcount);
+ CTimerEvent(evtype, (time_t) 0, mktime(&tmtime), (time_t)0, evrepeat, repeatcount);
}
//------------------------------------------------------------
CTimerEvent::CTimerEvent(CTimerd::CTimerEventTypes evtype,CConfigFile *config, int iId)
@@ -885,26 +886,27 @@ void CTimerEvent::Reschedule(bool force)
while(alarmTime <= now || force)
{
time_t diff = 0;
- struct tm *t= localtime(&alarmTime);
- int isdst1=t->tm_isdst;
+ struct tm t;
+ localtime_r(&alarmTime, &t);
+ int isdst1=t.tm_isdst;
switch(eventRepeat)
{
case CTimerd::TIMERREPEAT_ONCE :
break;
case CTimerd::TIMERREPEAT_DAILY:
- t->tm_mday++;
+ t.tm_mday++;
break;
case CTimerd::TIMERREPEAT_WEEKLY:
- t->tm_mday+=7;
+ t.tm_mday+=7;
break;
case CTimerd::TIMERREPEAT_BIWEEKLY:
- t->tm_mday+=14;
+ t.tm_mday+=14;
break;
case CTimerd::TIMERREPEAT_FOURWEEKLY:
- t->tm_mday+=28;
+ t.tm_mday+=28;
break;
case CTimerd::TIMERREPEAT_MONTHLY:
- t->tm_mon++;
+ t.tm_mon++;
break;
case CTimerd::TIMERREPEAT_BYEVENTDESCRIPTION :
// todo !!
@@ -923,19 +925,20 @@ void CTimerEvent::Reschedule(bool force)
weekday_arr[4]=((weekdays & 0x8) > 0); //Do
weekday_arr[5]=((weekdays & 0x10) > 0); //Fr
weekday_arr[6]=((weekdays & 0x20) > 0); //Sa
- struct tm *t2= localtime(&alarmTime);
+ struct tm t2;
+ localtime_r(&alarmTime, &t2);
int day;
- for(day=1 ; !weekday_arr[(t2->tm_wday+day)%7] ; day++){}
- t2->tm_mday+=day;
+ for(day=1 ; !weekday_arr[(t2.tm_wday+day)%7] ; day++){}
+ t2.tm_mday+=day;
}
}
else
dprintf("unknown repeat type %d\n",eventRepeat);
}
- diff = mktime(t)-alarmTime;
+ diff = mktime(&t)-alarmTime;
alarmTime += diff;
- t = localtime(&alarmTime);
- int isdst2 = t->tm_isdst;
+ localtime_r(&alarmTime, &t);
+ int isdst2 = t.tm_isdst;
if(isdst2 > isdst1) //change from winter to summer
{
diff-=3600;
@@ -964,12 +967,12 @@ void CTimerEvent::Reschedule(bool force)
//------------------------------------------------------------
void CTimerEvent::printEvent(void)
{
- struct tm *alarmtime, *announcetime;
+ struct tm alarmtime, announcetime;
dprintf("eventID: %03d type: %d state: %d repeat: %d ,repeatCount %d\n",eventID,eventType,eventState,((int)eventRepeat)&0x1FF,repeatCount);
- announcetime = localtime(&announceTime);
- dprintf(" announce: %u %02d.%02d. %02d:%02d:%02d\n",(uint) announceTime,announcetime->tm_mday,announcetime->tm_mon+1,announcetime->tm_hour,announcetime->tm_min,announcetime->tm_sec);
- alarmtime = localtime(&alarmTime);
- dprintf(" alarm: %u %02d.%02d. %02d:%02d:%02d\n",(uint) alarmTime,alarmtime->tm_mday,alarmtime->tm_mon+1,alarmtime->tm_hour,alarmtime->tm_min,alarmtime->tm_sec);
+ localtime_r(&announceTime, &announcetime);
+ dprintf(" announce: %u %02d.%02d. %02d:%02d:%02d\n",(uint) &announceTime,announcetime.tm_mday,announcetime.tm_mon+1,announcetime.tm_hour,announcetime.tm_min,announcetime.tm_sec);
+ localtime_r(&alarmTime, &alarmtime);
+ dprintf(" alarm: %u %02d.%02d. %02d:%02d:%02d\n",(uint) &alarmTime,alarmtime.tm_mday,alarmtime.tm_mon+1,alarmtime.tm_hour,alarmtime.tm_min,alarmtime.tm_sec);
switch(eventType)
{
case CTimerd::TIMER_ZAPTO :
-----------------------------------------------------------------------
Summary of changes:
tuxbox/neutrino/daemons/timerd/timermanager.cpp | 51 ++++++++++++-----------
1 files changed, 27 insertions(+), 24 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-15 15:38:59
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via fde68c8aeb7303fdcd7dcd01a6e77dc2a2a4ab08 (commit)
from b1c0e5df235155d738d46e3310302be5ba82fc9d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fde68c8aeb7303fdcd7dcd01a6e77dc2a2a4ab08
Author: GetAway <get...@t-...>
Date: Fri May 15 17:38:26 2015 +0200
nhttpd: use thread-safe gmtime_r
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp
index 78ff0e0..9a0b796 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp
@@ -262,20 +262,21 @@ std::string CyhookHandler::BuildHeader(bool cache)
time_t timer = time(0);
char timeStr[80];
// cache
+ struct tm lt;
if(!cache && (HookVarList["CacheCategory"]).empty() )
result += "Cache-Control: no-cache\r\n";
else
{
time_t x_time = time(NULL);
- struct tm *ptm = gmtime(&x_time);
- ptm->tm_mday+=1;
- x_time = mktime(ptm);
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime(&x_time));
+ gmtime_r(&x_time, <);
+ lt.tm_mday+=1;
+ x_time = mktime(<);
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&x_time, <));
result += string_printf("Expires: %s\r\n", timeStr);
}
result += "Server: " WEBSERVERNAME "\r\n";
// actual date
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime(&timer));
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&timer, <));
result += string_printf("Date: %s\r\n", timeStr);
// connection type
#ifdef Y_CONFIG_FEATURE_KEEP_ALIVE
@@ -296,7 +297,7 @@ std::string CyhookHandler::BuildHeader(bool cache)
if(LastModified != (time_t)-1)
mod_time = LastModified;
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime(&mod_time));
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&mod_time, <));
result += string_printf("Last-Modified: %s\r\nContent-Length: %ld\r\n", timeStr, GetContentLength());
}
result += "\r\n"; // End of Header
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp
index c60a7e1..2d439f7 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_cache.cpp
@@ -51,8 +51,9 @@ THandleStatus CmodCache::Hook_PrepareResponse(CyhookHandler *hh)
}
// normalize obj_last_modified to GMT
- struct tm *tmp = gmtime(&(CacheList[url].created));
- time_t obj_last_modified_gmt = mktime(tmp);
+ struct tm lt;
+ gmtime_r(&CacheList[url].created, <);
+ time_t obj_last_modified_gmt = mktime(<);
bool modified = (if_modified_since == (time_t)-1) || (if_modified_since < obj_last_modified_gmt);
// Send file or not-modified header
@@ -210,7 +211,8 @@ void CmodCache::yshowCacheInfo(CyhookHandler *hh)
{
TCache *item = &((*i).second);
char timeStr[80];
- strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime(&(item->created)) );
+ struct tm lt;
+ strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime_r(&item->created, <) );
yresult += string_printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>" \
"<td><a href=\"/y/cache-clear?url=%s\">url</a> " \
"<a href=\"/y/cache-clear?category=%s\">category</a></td></tr>\n",
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp
index a98a8bf..f259369 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp
@@ -112,8 +112,9 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh)
}
// normalize obj_last_modified to GMT
- struct tm *tmp = gmtime(&(hh->LastModified));
- time_t LastModifiedGMT = mktime(tmp);
+ struct tm lt;
+ gmtime_r(&hh->LastModified, <);
+ time_t LastModifiedGMT = mktime(<);
bool modified = (if_modified_since == (time_t)-1) || (if_modified_since < LastModifiedGMT);
// Send normal or not-modified header
-----------------------------------------------------------------------
Summary of changes:
.../neutrino/daemons/nhttpd/yhttpd_core/yhook.cpp | 13 +++++++------
.../daemons/nhttpd/yhttpd_mods/mod_cache.cpp | 8 +++++---
.../daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp | 5 +++--
3 files changed, 15 insertions(+), 11 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-14 20:24:28
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via b1c0e5df235155d738d46e3310302be5ba82fc9d (commit)
from 91bef1b61c652d7f600f38259d129a494b48d663 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b1c0e5df235155d738d46e3310302be5ba82fc9d
Author: GetAway <get...@t-...>
Date: Thu May 14 22:23:52 2015 +0200
nhttpd: use thread-safe localtime_r
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp
index 344b08e..bcaea2b 100644
--- a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp
@@ -504,12 +504,13 @@ void CControlAPI::GetDateCGI(CyhookHandler *hh)
if (hh->ParamList.empty())
{
//paramlos
- char *timestr = new char[50];
- struct timeval tm;
- gettimeofday(&tm, NULL);
- strftime(timestr, 20, "%d.%m.%Y\n", localtime(&tm.tv_sec) );
- hh->Write(timestr);
- delete[] timestr;
+ char tmp[16];
+ struct timeval tv;
+ struct tm tm_t;
+ gettimeofday(&tv, NULL);
+ localtime_r(&tv.tv_sec, &tm_t);
+ strftime(tmp, sizeof(tmp), "%d.%m.%Y\n", &tm_t);
+ hh->Write(tmp);
}
else
hh->SendError();
@@ -526,11 +527,11 @@ void CControlAPI::GetTimeCGI(CyhookHandler *hh)
if (hh->ParamList.empty())
{
//paramlos
- char *timestr = new char[50];
- struct tm *tm = localtime(&now);
- strftime(timestr, 20, "%H:%M:%S\n", tm );
- hh->Write(timestr);
- delete[] timestr;
+ char tmp[16];
+ struct tm t;
+ localtime_r(&now, &t);
+ strftime(tmp, sizeof(tmp), "%H:%M:%S\n", &t);
+ hh->Write(tmp);
}
else if (hh->ParamList["1"].compare("rawtime") == 0)
hh->printf("%ld\n",now);
@@ -1074,7 +1075,7 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh)
std::string timestr;
if (currentNextInfo.flags & CSectionsdClient::epgflags::has_current)
{
- timestr = timeString(currentNextInfo.current_zeit.startzeit);
+ timestr = timeString(¤tNextInfo.current_zeit.startzeit);
time_t now = time(NULL);
int percentage = 100;
if (currentNextInfo.current_zeit.dauer > 0)
@@ -1098,7 +1099,7 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh)
}
if (currentNextInfo.flags & CSectionsdClient::epgflags::has_next)
{
- timestr = timeString(currentNextInfo.next_zeit.startzeit);
+ timestr = timeString(¤tNextInfo.next_zeit.startzeit);
hh->WriteLn("\t<secondEPG>");
hh->printf("\t\t<eventid>%llu</eventid>\n"
"\t\t<startTime>%s</startTime>\n"
@@ -1321,16 +1322,17 @@ void CControlAPI::EpgCGI(CyhookHandler *hh)
hh->printf("\t<eventid_hex>%llx</eventid_hex>\r\n", eventIterator->eventID);
hh->printf("\t<start_sec>%ld</start_sec>\r\n", eventIterator->startTime);
char zbuffer[25] = {0};
- struct tm *mtime = localtime(&eventIterator->startTime);
- strftime(zbuffer,20,"%H:%M",mtime);
+ struct tm mtime_t;
+ localtime_r(&eventIterator->startTime, &mtime_t);
+ strftime(zbuffer,20,"%H:%M", &mtime_t);
hh->printf("\t<start_t>%s</start_t>\r\n", zbuffer);
memset(zbuffer, 0, 25);
- strftime(zbuffer,20,"%d.%m.%Y",mtime);
+ strftime(zbuffer,20,"%d.%m.%Y", &mtime_t);
hh->printf("\t<date>%s</date>\r\n", zbuffer);
hh->printf("\t<stop_sec>%ld</stop_sec>\r\n", eventIterator->startTime+eventIterator->duration);
long _stoptime = eventIterator->startTime+eventIterator->duration;
- mtime = localtime(&_stoptime);
- strftime(zbuffer,20,"%H:%M",mtime);
+ localtime_r(&_stoptime, &mtime_t);
+ strftime(zbuffer,20,"%H:%M", &mtime_t);
hh->printf("\t<stop_t>%s</stop_t>\r\n", zbuffer);
hh->printf("\t<duration_min>%d</duration_min>\r\n", (int)(eventIterator->duration/60));
hh->printf("\t<description><![CDATA[%s]]></description>\r\n", eventIterator->description.c_str());
@@ -1723,7 +1725,8 @@ void CControlAPI::SendFoundEvents(CyhookHandler *hh, bool xml_format)
{
if (NeutrinoAPI->Sectionsd->getEPGidShort(eventIterator->eventID, &epg))
{
- struct tm *tmStartZeit = localtime(&eventIterator->startTime);
+ struct tm StartZeit_t;
+ localtime_r(&eventIterator->startTime, &StartZeit_t);
if (xml_format)
{
hh->WriteLn("\t<epgsearch>");
@@ -1731,9 +1734,9 @@ void CControlAPI::SendFoundEvents(CyhookHandler *hh, bool xml_format)
hh->printf("\t\t<epgtitle><![CDATA[%s]]></epgtitle>\n", epg.title.c_str());
hh->printf("\t\t<info1><![CDATA[%s]]></info1>\n", epg.info1.c_str());
hh->printf("\t\t<info2><![CDATA[%s]]></info2>\n", epg.info2.c_str());
- strftime(tmpstr, sizeof(tmpstr), "%Y-%m-%d", tmStartZeit);
+ strftime(tmpstr, sizeof(tmpstr), "%Y-%m-%d", &StartZeit_t);
hh->printf("\t\t<date>%s</date>\n", tmpstr);
- strftime(tmpstr, sizeof(tmpstr), "%H:%M", tmStartZeit);
+ strftime(tmpstr, sizeof(tmpstr), "%H:%M", &StartZeit_t);
hh->printf("\t\t<time>%s</time>\n", tmpstr);
hh->printf("\t\t<duration>%d</duration>\n", eventIterator->duration);
hh->printf("\t\t<channel_id>" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "</channel_id>\n", eventIterator->get_channel_id());
@@ -1743,7 +1746,7 @@ void CControlAPI::SendFoundEvents(CyhookHandler *hh, bool xml_format)
else
{
std::string datetime_str;
- strftime(tmpstr, sizeof(tmpstr), "%Y-%m-%d %H:%M", tmStartZeit);
+ strftime(tmpstr, sizeof(tmpstr), "%Y-%m-%d %H:%M", &StartZeit_t);
datetime_str = tmpstr;
snprintf(tmpstr, sizeof(tmpstr), " [%d min]", eventIterator->duration / 60);
datetime_str += tmpstr;
@@ -2075,6 +2078,7 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
for(; timer != timerlist.end(); ++timer)
{
+ struct tm lt;
hh->WriteLn("\t\t<timer>");
hh->printf("\t\t\t<type>%s</type>\n", (NeutrinoAPI->timerEventType2Str(timer->eventType)).c_str());
hh->printf("\t\t\t<id>%d</id>\n", timer->eventID);
@@ -2084,30 +2088,30 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
// alarmtime
hh->WriteLn("\t\t\t<alarm>");
- struct tm *alarmTime = localtime(&(timer->alarmTime));
+ localtime_r(&timer->alarmTime, <);
hh->WriteLn("\t\t\t\t<normal>");
- _SendTime(hh, alarmTime, (int)timer->alarmTime);
+ _SendTime(hh, <, (int)timer->alarmTime);
hh->WriteLn("\t\t\t\t</normal>");
time_t real_alarmTimeT = timer->alarmTime - pre;
- struct tm *safetyAlarmTime = localtime(&real_alarmTimeT);
+ localtime_r(&real_alarmTimeT, <);
hh->WriteLn("\t\t\t\t<safety>");
- _SendTime(hh, safetyAlarmTime, (int)real_alarmTimeT);
+ _SendTime(hh, <, (int)real_alarmTimeT);
hh->WriteLn("\t\t\t\t</safety>");
hh->WriteLn("\t\t\t</alarm>");
// announcetime
hh->WriteLn("\t\t\t<announce>");
- struct tm *announceTime = localtime(&(timer->announceTime));
+ localtime_r(&timer->announceTime, <);
hh->WriteLn("\t\t\t\t<normal>");
- _SendTime(hh, announceTime, (int)timer->announceTime);
+ _SendTime(hh, <, (int)timer->announceTime);
hh->WriteLn("\t\t\t\t</normal>");
time_t real_announceTimeT = timer->announceTime - pre;
- struct tm *safetyAnnounceTime = localtime(&real_announceTimeT);
+ localtime_r(&real_announceTimeT, <);
hh->WriteLn("\t\t\t\t<safety>");
- _SendTime(hh, safetyAnnounceTime, (int)real_announceTimeT);
+ _SendTime(hh, <, (int)real_announceTimeT);
hh->WriteLn("\t\t\t\t</safety>");
hh->WriteLn("\t\t\t</announce>");
@@ -2116,15 +2120,15 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh)
if (timer->stopTime > 0)
{
hh->WriteLn("\t\t\t<stop>");
- struct tm *stopTime = localtime(&(timer->stopTime));
+ localtime_r(&timer->stopTime, <);
hh->WriteLn("\t\t\t\t<normal>");
- _SendTime(hh, stopTime, (int)timer->stopTime);
+ _SendTime(hh, <, (int)timer->stopTime);
hh->WriteLn("\t\t\t\t</normal>");
time_t real_stopTimeT = timer->stopTime - post;
- struct tm *safetyStopTime = localtime(&real_stopTimeT);
+ localtime_r(&real_stopTimeT, <);
hh->WriteLn("\t\t\t\t<safety>");
- _SendTime(hh, safetyStopTime, (int)real_stopTimeT);
+ _SendTime(hh, <, (int)real_stopTimeT);
hh->WriteLn("\t\t\t\t</safety>");
hh->WriteLn("\t\t\t</stop>");
@@ -2395,61 +2399,64 @@ void CControlAPI::doNewTimer(CyhookHandler *hh)
{
// Alarm Date - Format exact! DD.MM.YYYY
tnull = time(NULL);
- struct tm *alarmTime=localtime(&tnull);
- alarmTime->tm_sec = 0;
- if(sscanf(hh->ParamList["alDate"].c_str(),"%2d.%2d.%4d",&(alarmTime->tm_mday), &(alarmTime->tm_mon), &(alarmTime->tm_year)) == 3)
+ struct tm alarmTime;
+ localtime_r(&tnull, &alarmTime);
+ alarmTime.tm_sec = 0;
+ if(sscanf(hh->ParamList["alDate"].c_str(),"%2d.%2d.%4d", &alarmTime.tm_mday, &alarmTime.tm_mon, &alarmTime.tm_year) == 3)
{
- alarmTime->tm_mon -= 1;
- alarmTime->tm_year -= 1900;
+ alarmTime.tm_mon -= 1;
+ alarmTime.tm_year -= 1900;
}
// Alarm Time - Format exact! HH:MM
if(!hh->ParamList["alTime"].empty())
- sscanf(hh->ParamList["alTime"].c_str(),"%2d.%2d",&(alarmTime->tm_hour), &(alarmTime->tm_min));
- alHour = alarmTime->tm_hour;
- correctTime(alarmTime);
- alarmTimeT = mktime(alarmTime);
+ sscanf(hh->ParamList["alTime"].c_str(),"%2d.%2d", &alarmTime.tm_hour, &alarmTime.tm_min);
+ alHour = alarmTime.tm_hour;
+ correctTime(&alarmTime);
+ alarmTimeT = mktime(&alarmTime);
announceTimeT = alarmTimeT;
- struct tm *stopTime = localtime(&alarmTimeT);
- stopTime->tm_sec = 0;
+ struct tm stopTime;
+ localtime_r(&alarmTimeT, &stopTime);
+ stopTime.tm_sec = 0;
// Stop Time - Format exact! HH:MM
if(!hh->ParamList["stTime"].empty())
- sscanf(hh->ParamList["stTime"].c_str(),"%2d.%2d",&(stopTime->tm_hour), &(stopTime->tm_min));
+ sscanf(hh->ParamList["stTime"].c_str(),"%2d.%2d", &stopTime.tm_hour, &stopTime.tm_min);
// Stop Date - Format exact! DD.MM.YYYY
if(!hh->ParamList["stDate"].empty())
- if(sscanf(hh->ParamList["stDate"].c_str(),"%2d.%2d.%4d",&(stopTime->tm_mday), &(stopTime->tm_mon), &(stopTime->tm_year)) == 3)
+ if(sscanf(hh->ParamList["stDate"].c_str(),"%2d.%2d.%4d", &stopTime.tm_mday, &stopTime.tm_mon, &stopTime.tm_year) == 3)
{
- stopTime->tm_mon -= 1;
- stopTime->tm_year -= 1900;
+ stopTime.tm_mon -= 1;
+ stopTime.tm_year -= 1900;
}
- correctTime(stopTime);
- stopTimeT = mktime(stopTime);
- if(hh->ParamList["stDate"].empty() && alHour > stopTime->tm_hour)
+ correctTime(&stopTime);
+ stopTimeT = mktime(&stopTime);
+ if(hh->ParamList["stDate"].empty() && alHour > stopTime.tm_hour)
stopTimeT += 24* 60 * 60; // add 1 Day
}
else // alarm/stop time given in pieces
{
// alarm time
time_t now = time(NULL);
- struct tm *alarmTime=localtime(&now);
+ struct tm alarmTime;
+ localtime_r(&now, &alarmTime);
if(!hh->ParamList["ad"].empty())
- alarmTime->tm_mday = atoi(hh->ParamList["ad"].c_str());
+ alarmTime.tm_mday = atoi(hh->ParamList["ad"].c_str());
if(!hh->ParamList["amo"].empty())
- alarmTime->tm_mon = atoi(hh->ParamList["amo"].c_str())-1;
+ alarmTime.tm_mon = atoi(hh->ParamList["amo"].c_str())-1;
if(!hh->ParamList["ay"].empty())
- alarmTime->tm_year = atoi(hh->ParamList["ay"].c_str())-1900;
+ alarmTime.tm_year = atoi(hh->ParamList["ay"].c_str())-1900;
if(!hh->ParamList["ah"].empty())
- alarmTime->tm_hour = atoi(hh->ParamList["ah"].c_str());
+ alarmTime.tm_hour = atoi(hh->ParamList["ah"].c_str());
if(!hh->ParamList["ami"].empty())
- alarmTime->tm_min = atoi(hh->ParamList["ami"].c_str());
- alarmTime->tm_sec = 0;
- correctTime(alarmTime);
- alarmTimeT = mktime(alarmTime);
+ alarmTime.tm_min = atoi(hh->ParamList["ami"].c_str());
+ alarmTime.tm_sec = 0;
+ correctTime(&alarmTime);
+ alarmTimeT = mktime(&alarmTime);
announceTimeT = alarmTimeT;
// stop time
- struct tm *stopTime = alarmTime;
+ struct tm *stopTime = &alarmTime;
if(!hh->ParamList["sd"].empty())
stopTime->tm_mday = atoi(hh->ParamList["sd"].c_str());
if(!hh->ParamList["smo"].empty())
diff --git a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp
index 7b54c6f..63faeff 100644
--- a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp
@@ -427,7 +427,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
t_channel_id channel_id = CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(cmd.service_id, cmd.original_network_id, cmd.transport_stream_id);
- timestr = timeString(ni->zeit.startzeit); // FIXME: time is wrong (at least on little endian)!
+ timestr = timeString(&ni->zeit.startzeit); // FIXME: time is wrong (at least on little endian)!
NeutrinoAPI->Sectionsd->getActualEPGServiceKey(channel_id, &epg); // FIXME: der scheissendreck geht nit!!!
@@ -456,7 +456,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
else if ((event = NeutrinoAPI->ChannelListEvents[channel->channel_id]))
{
bool has_current_next = NeutrinoAPI->Sectionsd->getCurrentNextServiceKey(channel->channel_id, currentNextInfo);
- timestr = timeString(event->startTime);
+ timestr = timeString(&event->startTime);
yresult += string_printf("<tr><td class=\"%cepg\">",classname);
yresult += string_printf("%s %s "
@@ -467,7 +467,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
, event->duration / 60,prozent);
if ((has_current_next) && (currentNextInfo.flags & CSectionsdClient::epgflags::has_next)) {
- timestr = timeString(currentNextInfo.next_zeit.startzeit);
+ timestr = timeString(¤tNextInfo.next_zeit.startzeit);
yresult += string_printf("<br />%s %s", timestr.c_str(), currentNextInfo.next_name.c_str());
}
@@ -798,18 +798,19 @@ std::string CNeutrinoYParser::func_get_timer_list(CyhookHandler */*hh*/, std::s
// build alarm/stoptime
char zAlarmTime[25] = {0};
- struct tm *alarmTime = localtime(&(timer->alarmTime));
- strftime(zAlarmTime,20,"%d.%m. %H:%M",alarmTime);
+ struct tm lt;
+ localtime_r(&timer->alarmTime, <);
+ strftime(zAlarmTime, 20,"%d.%m. %H:%M", <);
char zAnnounceTime[25] = {0};
- struct tm *announceTime = localtime(&(timer->announceTime));
- strftime(zAnnounceTime,20,"%d.%m. %H:%M",announceTime);
+ localtime_r(&timer->announceTime, <);
+ strftime(zAnnounceTime, 20,"%d.%m. %H:%M", <);
char zStopTime[25] = {0};
if(timer->stopTime > 0)
{
- struct tm *stopTime = localtime(&(timer->stopTime));
- strftime(zStopTime,20,"%d.%m. %H:%M",stopTime);
+ localtime_r(&timer->stopTime, <);
+ strftime(zStopTime, 20,"%d.%m. %H:%M", <);
}
// repeat
std::string zRep = NeutrinoAPI->timerEventRepeat2Str(timer->eventRepeat);
@@ -924,22 +925,32 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
hh->ParamList["zType"] = zType;
}
// Alarm/StopTime
- struct tm *alarmTime = (cmd == "new") ? localtime(&now_t) : localtime(&(timer.alarmTime));
-
- hh->ParamList["alarm_mday"] = string_printf("%02d", alarmTime->tm_mday);
- hh->ParamList["alarm_mon"] = string_printf("%02d", alarmTime->tm_mon +1);
- hh->ParamList["alarm_year"] = string_printf("%04d", alarmTime->tm_year + 1900);
- hh->ParamList["alarm_hour"] = string_printf("%02d", alarmTime->tm_hour);
- hh->ParamList["alarm_min"] = string_printf("%02d", alarmTime->tm_min);
-
- struct tm *stopTime = (cmd == "new") ? alarmTime : ( (timer.stopTime > 0) ? localtime(&(timer.stopTime)) : NULL );
- if(stopTime != NULL)
+ struct tm alarmTime;
+ if (cmd == "new")
+ localtime_r(&now_t, &alarmTime);
+ else
+ localtime_r(&timer.alarmTime, &alarmTime);
+
+ hh->ParamList["alarm_mday"] = string_printf("%02d", alarmTime.tm_mday);
+ hh->ParamList["alarm_mon"] = string_printf("%02d", alarmTime.tm_mon +1);
+ hh->ParamList["alarm_year"] = string_printf("%04d", alarmTime.tm_year + 1900);
+ hh->ParamList["alarm_hour"] = string_printf("%02d", alarmTime.tm_hour);
+ hh->ParamList["alarm_min"] = string_printf("%02d", alarmTime.tm_min);
+
+ struct tm stopTime;
+ memset(&stopTime, 0, sizeof(struct tm));
+ if (cmd == "new")
+ stopTime = alarmTime;
+ else if (timer.stopTime > 0)
+ localtime_r(&timer.stopTime, &stopTime);
+
+ if(stopTime.tm_mday > 0)
{
- hh->ParamList["stop_mday"] = string_printf("%02d", stopTime->tm_mday);
- hh->ParamList["stop_mon"] = string_printf("%02d", stopTime->tm_mon +1);
- hh->ParamList["stop_year"] = string_printf("%04d", stopTime->tm_year + 1900);
- hh->ParamList["stop_hour"] = string_printf("%02d", stopTime->tm_hour);
- hh->ParamList["stop_min"] = string_printf("%02d", stopTime->tm_min);
+ hh->ParamList["stop_mday"] = string_printf("%02d", stopTime.tm_mday);
+ hh->ParamList["stop_mon"] = string_printf("%02d", stopTime.tm_mon +1);
+ hh->ParamList["stop_year"] = string_printf("%04d", stopTime.tm_year + 1900);
+ hh->ParamList["stop_hour"] = string_printf("%02d", stopTime.tm_hour);
+ hh->ParamList["stop_min"] = string_printf("%02d", stopTime.tm_min);
// APid settings for Record
if(timer.apids == TIMERD_APIDS_CONF)
@@ -953,6 +964,7 @@ std::string CNeutrinoYParser::func_set_timer_form(CyhookHandler *hh, std::strin
}
else
hh->ParamList["stop_mday"] = "0";
+
// event type
for(int i=1; i<=8;i++)
{
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp
index 74e3fff..be6dd61 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.cpp
@@ -64,11 +64,12 @@ std::string itoa(unsigned int conv)
//-------------------------------------------------------------------------
// convert timer_t to "<hour>:<minutes>" String
//-------------------------------------------------------------------------
-std::string timeString(time_t time)
+std::string timeString(const time_t *time)
{
char tmp[7]={'\0'};
- struct tm *tm = localtime(&time);
- if (strftime(tmp, 6, "%H:%M", tm))
+ struct tm t;
+ localtime_r(time, &t);
+ if (strftime(tmp, 6, "%H:%M", &t))
return std::string(tmp);
else
return std::string("??:??");
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h
index a5dc11e..86b1f7b 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/helper.h
@@ -5,9 +5,9 @@
#ifndef __yhttpd_helper_h__
#define __yhttpd_helper_h__
-// c
-#include <ctime>
+
// c++
+#include <time.h>
#include <string>
#include <vector>
#include "ytypes_globals.h"
@@ -36,7 +36,7 @@ bool ySplitStringExact(std::string str, std::string delimiter, std::string& left
bool ySplitStringLast(std::string str, std::string delimiter, std::string& left, std::string& right);
CStringArray ySplitStringVector(std::string str, std::string delimiter);
bool nocase_compare (char c1, char c2);
-std::string timeString(time_t time);
+std::string timeString(const time_t *time);
bool write_to_file(std::string filename, std::string content);
#endif /* __yhttpd_helper_h__ */
diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp
index 63db846..e2da1f8 100644
--- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp
+++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_weblog.cpp
@@ -157,12 +157,12 @@ void CmWebLog::AddLogEntry_CLF(CyhookHandler *hh)
int s_status = hh->httpStatus;
int bytes = hh->GetContentLength();
- struct tm *time_now;
+ struct tm time_now;
time_t now = time(NULL);
char request_time[80];
- time_now = localtime(&now);
- strftime(request_time, 80, "[%d/%b/%Y:%H:%M:%S]", time_now);
+ localtime_r(&now, &time_now);
+ strftime(request_time, 80, "[%d/%b/%Y:%H:%M:%S]", &time_now);
printf("%s - - %s \"%s\" %d %d\n",
c_ip.c_str(),
@@ -331,18 +331,18 @@ void CmWebLog::AddLogEntry_ELF(CyhookHandler *hh)
int bytes = hh->GetContentLength();
int cached = (hh->HookVarList["CacheCategory"].empty()) ? 0 : 1;
- struct tm *time_now;
+ struct tm time_now;
time_t now = time(NULL);
- time_now = localtime(&now);
+ localtime_r(&now, &time_now);
char request_time[80];
- strftime(request_time, 80, "[%d/%b/%Y:%H:%M:%S]", time_now);
+ strftime(request_time, 80, "[%d/%b/%Y:%H:%M:%S]", &time_now);
char _date[11];
- strftime(_date, 11, "%Y-%m-%d", time_now);
+ strftime(_date, 11, "%Y-%m-%d", &time_now);
char _time[11];
- strftime(_time, 11, "%H:%M:%S", time_now);
+ strftime(_time, 11, "%H:%M:%S", &time_now);
std::string time_taken_request = hh->HookVarList["enlapsed_request"];
std::string time_taken_response = hh->HookVarList["enlapsed_response"];
-----------------------------------------------------------------------
Summary of changes:
.../daemons/nhttpd/tuxboxapi/controlapi.cpp | 131 ++++++++++---------
.../daemons/nhttpd/tuxboxapi/neutrinoyparser.cpp | 60 ++++++----
.../neutrino/daemons/nhttpd/yhttpd_core/helper.cpp | 7 +-
.../neutrino/daemons/nhttpd/yhttpd_core/helper.h | 6 +-
.../daemons/nhttpd/yhttpd_mods/mod_weblog.cpp | 16 ++--
5 files changed, 120 insertions(+), 100 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-14 07:29:34
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 91bef1b61c652d7f600f38259d129a494b48d663 (commit)
via 4676f6a1c620b13ccf619556c3a54a72e2bd6965 (commit)
via eecdd87aba22cd00e50ab82cf969b5fd4d985533 (commit)
from fdca0ea1c62b7c43bd6810dea975c81897547597 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 91bef1b61c652d7f600f38259d129a494b48d663
Author: GetAway <get...@t-...>
Date: Thu May 14 09:28:43 2015 +0200
yWeb: remove save of setting that is not used
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt b/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt
index 8bd4289..c5b0ed2 100644
--- a/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt
+++ b/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt
@@ -35,7 +35,6 @@ start-block~Live_save_settings
{=ini-set:/var/tuxbox/config/Y-Web.conf;slavebox;{=slavebox=}~open=}
{=ini-set:/var/tuxbox/config/Y-Web.conf;vlc_record_path;{=vlc_record_path=}~cache=}
{=ini-set:/var/tuxbox/config/Y-Web.conf;deinterlace;{=deinterlace=}~cache=}
-{=ini-set:/var/tuxbox/config/Y-Web.conf;deinterlace_filter;{=v=}~cache=}
{=ini-set:/var/tuxbox/config/Y-Web.conf;udp;{=udp=}~cache=}
{=ini-set:/var/tuxbox/config/Y-Web.conf;http_caching;{=http_caching=}~save=}
end-block~Live_save_settings
diff --git a/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt b/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt
index 362fee4..3938606 100644
--- a/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt
+++ b/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt
@@ -1,4 +1,4 @@
-version=2.8.3.00
-date=09.05.2015
+version=2.8.3.01
+date=14.05.2015
type=Release
info=Tuxbox
commit 4676f6a1c620b13ccf619556c3a54a72e2bd6965
Author: Christian Schuett <Gau...@ho...>
Date: Wed May 13 19:41:17 2015 +0200
Neutrino network setup: add missing observer to netmask input
also simplify, remove unused and avoid redundant code
Signed-off-by: Christian Schuett <Gau...@ho...>
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/src/gui/network_setup.cpp b/tuxbox/neutrino/src/gui/network_setup.cpp
index 29d1cd2..f4906aa 100644
--- a/tuxbox/neutrino/src/gui/network_setup.cpp
+++ b/tuxbox/neutrino/src/gui/network_setup.cpp
@@ -85,22 +85,13 @@ CNetworkSetup::CNetworkSetup()
width = w_max (500, 100);
selected = -1;
- network_automatic_start = networkConfig->automatic_start;
- network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON;
- network_address = networkConfig->address;
- network_netmask = networkConfig->netmask;
- network_broadcast = networkConfig->broadcast;
- network_nameserver = networkConfig->nameserver;
- network_gateway = networkConfig->gateway;
-
- old_network_automatic_start = networkConfig->automatic_start;
- old_network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON;
- old_network_address = networkConfig->address;
- old_network_netmask = networkConfig->netmask;
- old_network_broadcast = networkConfig->broadcast;
- old_network_nameserver = networkConfig->nameserver;
- old_network_gateway = networkConfig->gateway;
-
+ network_automatic_start = old_network_automatic_start = networkConfig->automatic_start;
+ network_dhcp = old_network_dhcp = networkConfig->inet_static ? NETWORK_DHCP_OFF : NETWORK_DHCP_ON;
+ network_address = old_network_address = networkConfig->address;
+ network_netmask = old_network_netmask = networkConfig->netmask;
+ network_broadcast = networkConfig->broadcast;
+ network_nameserver = old_network_nameserver = networkConfig->nameserver;
+ network_gateway = old_network_gateway = networkConfig->gateway;
}
CNetworkSetup::~CNetworkSetup()
@@ -108,7 +99,6 @@ CNetworkSetup::~CNetworkSetup()
}
-
int CNetworkSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
int res = menu_return::RETURN_REPAINT;
@@ -146,6 +136,7 @@ int CNetworkSetup::exec(CMenuTarget* parent, const std::string &actionKey)
return res;
}
+
void CNetworkSetup::setBroadcast(void)
{
in_addr_t na = inet_addr(network_address.c_str());
@@ -179,11 +170,9 @@ int CNetworkSetup::showNetworkSetup()
//prepare input entries
CIPInput networkSettings_NetworkIP (LOCALE_NETWORKMENU_IPADDRESS , network_address , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, this);
- CIPInput networkSettings_NetMask (LOCALE_NETWORKMENU_NETMASK , network_netmask );
- CIPInput networkSettings_Broadcast (LOCALE_NETWORKMENU_BROADCAST , network_broadcast );
+ CIPInput networkSettings_NetMask (LOCALE_NETWORKMENU_NETMASK , network_netmask , LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2, this);
CIPInput networkSettings_Gateway (LOCALE_NETWORKMENU_GATEWAY , network_gateway );
CIPInput networkSettings_NameServer (LOCALE_NETWORKMENU_NAMESERVER, network_nameserver);
-
//auto start
CMenuOptionChooser* o1 = new CMenuOptionChooser(LOCALE_NETWORKMENU_SETUPONSTARTUP, &network_automatic_start, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);
@@ -194,11 +183,11 @@ int CNetworkSetup::showNetworkSetup()
CMenuForwarder *m1 = new CMenuForwarder(LOCALE_NETWORKMENU_IPADDRESS , networkConfig->inet_static, network_address , &networkSettings_NetworkIP );
CMenuForwarder *m2 = new CMenuForwarder(LOCALE_NETWORKMENU_NETMASK , networkConfig->inet_static, network_netmask , &networkSettings_NetMask );
setBroadcast();
- CMenuForwarder *m3 = new CMenuForwarder(LOCALE_NETWORKMENU_BROADCAST , false, network_broadcast);
+ CMenuForwarder *m3 = new CMenuForwarder(LOCALE_NETWORKMENU_BROADCAST , false , network_broadcast );
CMenuForwarder *m4 = new CMenuForwarder(LOCALE_NETWORKMENU_GATEWAY , networkConfig->inet_static, network_gateway , &networkSettings_Gateway );
CMenuForwarder *m5 = new CMenuForwarder(LOCALE_NETWORKMENU_NAMESERVER, networkConfig->inet_static, network_nameserver, &networkSettings_NameServer);
- CDHCPNotifier dhcpNotifier(m1,m2,m3,m4,m5);
+ CDHCPNotifier dhcpNotifier(m1,m2,m4,m5);
CMenuOptionChooser* o2 = new CMenuOptionChooser(LOCALE_NETWORKMENU_DHCP, &network_dhcp, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, &dhcpNotifier);
//paint menu items
@@ -241,7 +230,6 @@ int CNetworkSetup::showNetworkSetup()
ntp->addItem( ntp1);
ntp->addItem( ntp2);
ntp->addItem( ntp3);
-
#ifdef ENABLE_GUI_MOUNT
CMenuWidget* networkmounts = new CMenuWidget(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width);
@@ -558,10 +546,9 @@ void CNetworkSetup::showCurrentNetworkSettings()
bool CNetworkSetup::changeNotify(const neutrino_locale_t OptionName, void * /*Data*/)
{
- if (ARE_LOCALES_EQUAL(OptionName, LOCALE_NETWORKMENU_IPADDRESS)) {
- setBroadcast();
- }
- else if(OptionName == LOCALE_NETWORKMENU_NETMASK) {
+ if (ARE_LOCALES_EQUAL(OptionName, LOCALE_NETWORKMENU_IPADDRESS) ||
+ ARE_LOCALES_EQUAL(OptionName, LOCALE_NETWORKMENU_NETMASK))
+ {
setBroadcast();
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_NETWORKMENU_NTPSERVER) ||
@@ -573,19 +560,18 @@ bool CNetworkSetup::changeNotify(const neutrino_locale_t OptionName, void * /*Da
return false;
}
-CDHCPNotifier::CDHCPNotifier( CMenuForwarder* a1, CMenuForwarder* a2, CMenuForwarder* a3, CMenuForwarder* a4, CMenuForwarder* a5)
+CDHCPNotifier::CDHCPNotifier(CMenuForwarder* a1, CMenuForwarder* a2, CMenuForwarder* a3, CMenuForwarder* a4)
{
toDisable[0] = a1;
toDisable[1] = a2;
toDisable[2] = a3;
toDisable[3] = a4;
- toDisable[4] = a5;
}
bool CDHCPNotifier::changeNotify(const neutrino_locale_t, void * data)
{
CNetworkConfig::getInstance()->inet_static = ((*(int*)(data)) == CNetworkSetup::NETWORK_DHCP_OFF);
- for(int x=0;x<5;x++)
+ for (int x = 0; x < 4; x++)
toDisable[x]->setActive(CNetworkConfig::getInstance()->inet_static);
return false;
}
diff --git a/tuxbox/neutrino/src/gui/network_setup.h b/tuxbox/neutrino/src/gui/network_setup.h
index 2723eb7..9137518 100644
--- a/tuxbox/neutrino/src/gui/network_setup.h
+++ b/tuxbox/neutrino/src/gui/network_setup.h
@@ -57,7 +57,6 @@ class CNetworkSetup : public CMenuTarget, CChangeObserver
int old_network_automatic_start;
std::string old_network_address;
std::string old_network_netmask;
- std::string old_network_broadcast;
std::string old_network_nameserver;
std::string old_network_gateway;
@@ -106,9 +105,9 @@ class CNetworkSetup : public CMenuTarget, CChangeObserver
class CDHCPNotifier : public CChangeObserver
{
private:
- CMenuForwarder* toDisable[5];
+ CMenuForwarder* toDisable[4];
public:
- CDHCPNotifier( CMenuForwarder*, CMenuForwarder*, CMenuForwarder*, CMenuForwarder*, CMenuForwarder*);
+ CDHCPNotifier(CMenuForwarder*, CMenuForwarder*, CMenuForwarder*, CMenuForwarder*);
bool changeNotify(const neutrino_locale_t, void * data);
};
commit eecdd87aba22cd00e50ab82cf969b5fd4d985533
Author: Jacek Jendrzej <cra...@go...>
Date: Wed May 13 21:10:05 2015 +0200
add new line and line feed to xml
and port some code for "saveStringToXMLfile"
Signed-off-by: GetAway <get...@t-...>
diff --git a/dvb/zapit/lib/zapittools.cpp b/dvb/zapit/lib/zapittools.cpp
index 1c1ce51..6d17be5 100644
--- a/dvb/zapit/lib/zapittools.cpp
+++ b/dvb/zapit/lib/zapittools.cpp
@@ -94,6 +94,13 @@ namespace ZapitTools {
case '\'':
r += "'";
break;
+ case 0x0a:
+ r +="
";
+ break;
+ case 0x0d:
+ r +="
";
+ break;
+
default:
r += *s;
}
diff --git a/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp b/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp
index a47ec0d..332bf4b 100644
--- a/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp
+++ b/tuxbox/neutrino/daemons/sectionsd/SIutils.cpp
@@ -162,7 +162,7 @@ time_t changeUTCtoCtime(const unsigned char *buffer, int local_time)
}
// Thanks to tmbinc
-int saveStringToXMLfile(FILE *out, const char *c, int withControlCodes)
+int saveStringToXMLfile(FILE *out, const char *c /*, int withControlCodes*/)
{
if(!c)
return 1;
@@ -178,15 +178,28 @@ int saveStringToXMLfile(FILE *out, const char *c, int withControlCodes)
*/
for(;*c; c++) {
switch ((unsigned char)*c) {
- case '&':
- fprintf(out, "&");
- break;
- case '<':
- fprintf(out, "<");
- break;
- case '\"':
- fprintf(out, """);
- break;
+ case '<':
+ fprintf(out, "<");
+ break;
+ case '>':
+ fprintf(out, ">");
+ break;
+ case '&':
+ fprintf(out, "&");
+ break;
+ case '\"':
+ fprintf(out, """);
+ break;
+ case '\'':
+ fprintf(out, "'");
+ break;
+ case 0x0a:
+ fprintf(out,"
");
+ break;
+ case 0x0d:
+ fprintf(out,"
");
+ break;
+#if 0
case 0x81:
case 0x82:
break;
@@ -209,6 +222,12 @@ int saveStringToXMLfile(FILE *out, const char *c, int withControlCodes)
fprintf(out, "%c", *c);
else
fprintf(out, "&#%d;", *c);
+#else
+ default:
+ if ((unsigned char)*c<32)
+ break;
+ fprintf(out, "%c", *c);
+#endif
} // case
} // for
diff --git a/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp b/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp
index 4dc269e..f1976b0 100644
--- a/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp
+++ b/tuxbox/neutrino/daemons/sectionsd/SIutils.hpp
@@ -29,7 +29,7 @@ time_t changeUTCtoCtime(const unsigned char *buffer, int local_time=1);
// returns the descriptor type as readable text
const char *decode_descr (unsigned char tag_value);
-int saveStringToXMLfile(FILE *out, const char *string, int withControlCodes=0);
+int saveStringToXMLfile(FILE *out, const char *string /*, int withControlCodes=0*/);
// Entfernt die ControlCodes aus dem String (-> String wird evtl. kuerzer)
void removeControlCodes(char *string);
diff --git a/tuxbox/neutrino/src/gui/movieinfo.cpp b/tuxbox/neutrino/src/gui/movieinfo.cpp
index c7c20b7..e7410ed 100644
--- a/tuxbox/neutrino/src/gui/movieinfo.cpp
+++ b/tuxbox/neutrino/src/gui/movieinfo.cpp
@@ -725,6 +725,8 @@ std::string decodeXmlSpecialChars(std::string s)
StrSearchReplace(s,"&","&");
StrSearchReplace(s,""","\"");
StrSearchReplace(s,"'","\'");
+ StrSearchReplace(s,"
","\n");
+ StrSearchReplace(s,"
","\n");
return s;
}
-----------------------------------------------------------------------
Summary of changes:
dvb/zapit/lib/zapittools.cpp | 7 +++
tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt | 1 -
tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt | 4 +-
tuxbox/neutrino/daemons/sectionsd/SIutils.cpp | 39 ++++++++++++++-----
tuxbox/neutrino/daemons/sectionsd/SIutils.hpp | 2 +-
tuxbox/neutrino/src/gui/movieinfo.cpp | 2 +
tuxbox/neutrino/src/gui/network_setup.cpp | 46 ++++++++--------------
tuxbox/neutrino/src/gui/network_setup.h | 5 +-
8 files changed, 59 insertions(+), 47 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-12 17:54:38
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via fdca0ea1c62b7c43bd6810dea975c81897547597 (commit)
from 1f09dc36e1958d3484fd857a03854007c4147520 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fdca0ea1c62b7c43bd6810dea975c81897547597
Author: GetAway <get...@t-...>
Date: Tue May 12 19:49:23 2015 +0200
remove extra ';' and whitespaces
Signed-off-by: GetAway <get...@t-...>
diff --git a/dvb/zapit/include/zapit/client/zapittools.h b/dvb/zapit/include/zapit/client/zapittools.h
index 9327124..487d2a4 100644
--- a/dvb/zapit/include/zapit/client/zapittools.h
+++ b/dvb/zapit/include/zapit/client/zapittools.h
@@ -31,6 +31,6 @@ namespace ZapitTools
std::string UTF8_to_Latin1 (const char *);
std::string UTF8_to_UTF8XML(const char *);
std::string Latin1_to_UTF8 (const char *);
-};
+}
#endif
diff --git a/dvb/zapit/lib/zapittools.cpp b/dvb/zapit/lib/zapittools.cpp
index acfda09..1c1ce51 100644
--- a/dvb/zapit/lib/zapittools.cpp
+++ b/dvb/zapit/lib/zapittools.cpp
@@ -69,7 +69,7 @@ namespace ZapitTools {
std::string UTF8_to_UTF8XML(const char * s)
{
std::string r;
-
+
while ((*s) != 0)
{
/* cf.
@@ -79,7 +79,7 @@ namespace ZapitTools {
*/
switch (*s)
{
- case '<':
+ case '<':
r += "<";
break;
case '>':
@@ -105,7 +105,7 @@ namespace ZapitTools {
std::string Latin1_to_UTF8(const char * s)
{
std::string r;
-
+
while((*s) != 0)
{
unsigned char c = *s;
@@ -121,7 +121,7 @@ namespace ZapitTools {
}
s++;
- }
+ }
return r;
}
-};
+}
-----------------------------------------------------------------------
Summary of changes:
dvb/zapit/include/zapit/client/zapittools.h | 2 +-
dvb/zapit/lib/zapittools.cpp | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
--
Tuxbox-GIT: apps
|
|
From: GetAway <tux...@ne...> - 2015-05-12 17:00:14
|
Project "Tuxbox-GIT: apps":
The branch, master has been updated
via 1f09dc36e1958d3484fd857a03854007c4147520 (commit)
from fa967f9f085f85ee99a7280b31d104d6d2987f5b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1f09dc36e1958d3484fd857a03854007c4147520
Author: svenhoefer <sve...@sv...>
Date: Tue May 12 18:59:33 2015 +0200
yWeb: allow style_set function w/o parameter to install correct style
Signed-off-by: GetAway <get...@t-...>
diff --git a/tuxbox/neutrino/daemons/nhttpd/web/scripts/Y_Tools.sh b/tuxbox/neutrino/daemons/nhttpd/web/scripts/Y_Tools.sh
index 7b64d30..3b6ace2 100755
--- a/tuxbox/neutrino/daemons/nhttpd/web/scripts/Y_Tools.sh
+++ b/tuxbox/neutrino/daemons/nhttpd/web/scripts/Y_Tools.sh
@@ -51,16 +51,23 @@ style_get()
# -----------------------------------------------------------
style_set()
{
+ # This function should be called one time after installing a new image
+ # to get sure, the right skin is installed too
+
+ style=${1:-$(config_get_value_direct $y_config_Y_Web 'style')}
+ test -n "$style" || return
+
y_path_directory=$(config_get_value_direct $y_config_nhttpd 'WebsiteMain.directory')
y_path_override_directory=$(config_get_value_direct $y_config_nhttpd 'WebsiteMain.override_directory')
cd $y_path_directory
- if [ -e $y_path_override_directory/styles/Y_Dist-$1.css ]; then
- cp $y_path_override_directory/styles/Y_Dist-$1.css Y_Dist.css
+ if [ -e $y_path_override_directory/styles/Y_Dist-$style.css ]; then
+ cp $y_path_override_directory/styles/Y_Dist-$style.css Y_Dist.css
+ elif [ -e $y_path_directory/styles/Y_Dist-$style.css ]; then
+ cp $y_path_directory/styles/Y_Dist-$style.css Y_Dist.css
else
- cp $y_path_directory/styles/Y_Dist-$1.css Y_Dist.css
+ config_set_value_direct $y_config_Y_Web 'style'
fi
- #config_set_value_direct $y_config_Y_Web 'style' $1
}
# -----------------------------------------------------------
# Image Backup - build form
-----------------------------------------------------------------------
Summary of changes:
.../neutrino/daemons/nhttpd/web/scripts/Y_Tools.sh | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
--
Tuxbox-GIT: apps
|