|
From: Roger M. <mot...@mc...> - 2023-07-04 16:56:25
|
Hi,
I have been using motion on FreeBSD for some time now and thought I
would give motion plus a try. I couldn’t see a port for it so I clone
the git repo and compiled it after some minor changes. The changes are
below if anyone is interested. These look like they are not FreeBSD
specific, just compiler warnings and errors.
I have tested only with network cameras so far.
Cheers, Roger
*diff --git a/src/conf.cpp b/src/conf.cpp*
*index 1637541..f3f5e84 100644*
*--- a/src/conf.cpp*
*+++ b/src/conf.cpp*
@@ -4008,7 +4008,7 @@void conf_parms_write_app(ctx_motapp *motapp)
if (conffile == NULL) {
MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO
, _("Failed to write configuration to %s")
- , motapp->conf->conf_filename);
+ , motapp->conf->conf_filename.c_str());
return;
}
*diff --git a/src/netcam.cpp b/src/netcam.cpp*
*index 0d277f2..2d6fcc3 100644*
*--- a/src/netcam.cpp*
*+++ b/src/netcam.cpp*
@@ -1441,7 +1441,7 @@static void netcam_set_path (ctx_dev *cam,
ctx_netcam *netcam )
netcam->path = NULL;
memset(&url, 0, sizeof(url));
- memset(userpass,0,PATH_MAX);
+ memset(userpass,0,sizeof(userpass));
if (netcam->high_resolution) {
netcam_url_parse(&url, cam->conf->netcam_high_url.c_str());
@@ -1451,8 +1451,8 @@static void netcam_set_path (ctx_dev *cam,
ctx_netcam *netcam )
if (cam->conf->netcam_userpass != "") {
cam->conf->netcam_userpass.copy(userpass, PATH_MAX);
- } else if (url.userpass != NULL) {
- retcd = snprintf(userpass,PATH_MAX,"%s",url.userpass);
+ } else if (url.userpass) {
+ retcd = snprintf(userpass,sizeof(userpass),"%s",url.userpass);
if ((retcd <0) || (retcd>=PATH_MAX)) {
[roger@dev2 motionplus]$git diff | cat
diff --git a/src/conf.cpp b/src/conf.cpp
index 1637541..f3f5e84 100644
--- a/src/conf.cpp
+++ b/src/conf.cpp
@@ -4008,7 +4008,7 @@ void conf_parms_write_app(ctx_motapp *motapp)
if (conffile == NULL) {
MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO
, _("Failed to write configuration to %s")
- , motapp->conf->conf_filename);
+ , motapp->conf->conf_filename.c_str());
return;
}
diff --git a/src/netcam.cpp b/src/netcam.cpp
index 0d277f2..2d6fcc3 100644
--- a/src/netcam.cpp
+++ b/src/netcam.cpp
@@ -1441,7 +1441,7 @@ static void netcam_set_path (ctx_dev *cam,
ctx_netcam *netcam )
netcam->path = NULL;
memset(&url, 0, sizeof(url));
- memset(userpass,0,PATH_MAX);
+ memset(userpass,0,sizeof(userpass));
if (netcam->high_resolution) {
netcam_url_parse(&url, cam->conf->netcam_high_url.c_str());
@@ -1451,8 +1451,8 @@ static void netcam_set_path (ctx_dev *cam,
ctx_netcam *netcam )
if (cam->conf->netcam_userpass != "") {
cam->conf->netcam_userpass.copy(userpass, PATH_MAX);
- } else if (url.userpass != NULL) {
- retcd = snprintf(userpass,PATH_MAX,"%s",url.userpass);
+ } else if (url.userpass) {
+ retcd = snprintf(userpass,sizeof(userpass),"%s",url.userpass);
if ((retcd <0) || (retcd>=PATH_MAX)) {
MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO,_("Error getting
userpass"));
}
@@ -1471,7 +1471,7 @@ static void netcam_set_path (ctx_dev *cam,
ctx_netcam *netcam )
} else {
MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO
,_("Setting up %s "),url.service);
- if (userpass != NULL) {
+ if (strlen(userpass)) {
netcam->path =(char*) mymalloc(strlen(url.service) + 3 +
strlen(userpass)
+ 1 + strlen(url.host) + 6 + strlen(url.path) + 2 );
sprintf((char *)netcam->path, "%s://%s@%s:%d%s",
|