Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 7774f5d

Browse files
committed
Eliminate sqltype as separate parameter
1 parent 1022ec8 commit 7774f5d

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/dbse.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,23 +1294,23 @@ void dbse_exec(ctx_dev *cam, char *filename, const char *cmd)
12941294
if (mystrceq(cmd,"pic_save")) {
12951295
mystrftime(cam, sqlquery, sizeof(sqlquery)
12961296
, cam->conf->sql_pic_save.c_str()
1297-
, &cam->current_image->imgts, filename, cam->filetype);
1297+
, &cam->current_image->imgts, filename);
12981298
} else if (mystrceq(cmd,"movie_start")) {
12991299
mystrftime(cam, sqlquery, sizeof(sqlquery)
13001300
, cam->conf->sql_movie_start.c_str()
1301-
, &cam->current_image->imgts, filename, cam->filetype);
1301+
, &cam->current_image->imgts, filename);
13021302
} else if (mystrceq(cmd,"movie_end")) {
13031303
mystrftime(cam, sqlquery, sizeof(sqlquery)
13041304
, cam->conf->sql_movie_end.c_str()
1305-
, &cam->current_image->imgts, filename, cam->filetype);
1305+
, &cam->current_image->imgts, filename);
13061306
} else if (mystrceq(cmd,"event_start")) {
13071307
mystrftime(cam, sqlquery, sizeof(sqlquery)
13081308
, cam->conf->sql_event_start.c_str()
1309-
, &cam->current_image->imgts, filename, cam->filetype);
1309+
, &cam->current_image->imgts, filename);
13101310
} else if (mystrceq(cmd,"event_end")) {
13111311
mystrftime(cam, sqlquery, sizeof(sqlquery)
13121312
, cam->conf->sql_event_end.c_str()
1313-
, &cam->current_image->imgts, filename, cam->filetype);
1313+
, &cam->current_image->imgts, filename);
13141314
}
13151315

13161316
if (strlen(sqlquery) <= 0) {

src/exif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ unsigned exif_prepare(unsigned char **exif, ctx_dev *cam,
205205

206206
if (cam->conf->picture_exif != "") {
207207
description =(char*) malloc(PATH_MAX);
208-
mystrftime(cam, description, PATH_MAX-1, cam->conf->picture_exif.c_str(), &ts1, NULL, 0);
208+
mystrftime(cam, description, PATH_MAX-1, cam->conf->picture_exif.c_str(), &ts1, NULL);
209209
} else {
210210
description = NULL;
211211
}

src/motion_loop.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void mlp_ring_process_debug(ctx_dev *cam)
116116
}
117117

118118
mystrftime(cam, tmp, sizeof(tmp), "%H%M%S-%q",
119-
&cam->imgs.image_ring[cam->imgs.ring_out].imgts, NULL, 0);
119+
&cam->imgs.image_ring[cam->imgs.ring_out].imgts, NULL);
120120
draw_text(cam->imgs.image_ring[cam->imgs.ring_out].image_norm,
121121
cam->imgs.width, cam->imgs.height, 10, 20, tmp, cam->text_scale);
122122
draw_text(cam->imgs.image_ring[cam->imgs.ring_out].image_norm,
@@ -203,7 +203,7 @@ static void mlp_detected_trigger(ctx_dev *cam)
203203
mystrftime(cam, cam->text_event_string
204204
, sizeof(cam->text_event_string)
205205
, cam->conf->text_event.c_str()
206-
, &cam->current_image->imgts, NULL, 0);
206+
, &cam->current_image->imgts, NULL);
207207

208208
event(cam, EVENT_START);
209209
dbse_exec(cam, NULL, "event_start");
@@ -878,7 +878,7 @@ static int mlp_capture(ctx_dev *cam)
878878

879879
memset(cam->current_image->image_norm, 0x80, cam->imgs.size_norm);
880880
mystrftime(cam, tmpout, sizeof(tmpout)
881-
, tmpin, &cam->connectionlosttime, NULL, 0);
881+
, tmpin, &cam->connectionlosttime, NULL);
882882
draw_text(cam->current_image->image_norm, cam->imgs.width, cam->imgs.height,
883883
10, 20 * cam->text_scale, tmpout, cam->text_scale);
884884
cam->current_image->imgts = cam->connectionlosttime;
@@ -1012,15 +1012,15 @@ static void mlp_overlay(ctx_dev *cam)
10121012
/* Add text in lower left corner of the pictures */
10131013
if (cam->conf->text_left != "") {
10141014
mystrftime(cam, tmp, sizeof(tmp), cam->conf->text_left.c_str(),
1015-
&cam->current_image->imgts, NULL, 0);
1015+
&cam->current_image->imgts, NULL);
10161016
draw_text(cam->current_image->image_norm, cam->imgs.width, cam->imgs.height,
10171017
10, cam->imgs.height - (10 * cam->text_scale), tmp, cam->text_scale);
10181018
}
10191019

10201020
/* Add text in lower right corner of the pictures */
10211021
if (cam->conf->text_right != "") {
10221022
mystrftime(cam, tmp, sizeof(tmp), cam->conf->text_right.c_str(),
1023-
&cam->current_image->imgts, NULL, 0);
1023+
&cam->current_image->imgts, NULL);
10241024
draw_text(cam->current_image->image_norm, cam->imgs.width, cam->imgs.height,
10251025
cam->imgs.width - 10, cam->imgs.height - (10 * cam->text_scale),
10261026
tmp, cam->text_scale);

src/movie.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ int movie_init_norm(ctx_dev *cam)
15461546

15471547
mystrftime(cam, tmp, sizeof(tmp)
15481548
, cam->conf->movie_filename.c_str()
1549-
, &cam->current_image->imgts, NULL, 0);
1549+
, &cam->current_image->imgts, NULL);
15501550

15511551
container = movie_init_container(cam);
15521552

@@ -1621,7 +1621,7 @@ int movie_init_motion(ctx_dev *cam)
16211621

16221622
mystrftime(cam, tmp, sizeof(tmp)
16231623
, cam->conf->movie_filename.c_str()
1624-
, &cam->imgs.image_motion.imgts, NULL, 0);
1624+
, &cam->imgs.image_motion.imgts, NULL);
16251625
container = movie_init_container(cam);
16261626

16271627
/* The increment of 10 is to allow for the extension and other chars*/
@@ -1689,7 +1689,7 @@ int movie_init_timelapse(ctx_dev *cam)
16891689
cam->movie_timelapse =(ctx_movie*)mymalloc(sizeof(ctx_movie));
16901690
mystrftime(cam, tmp, sizeof(tmp)
16911691
, cam->conf->timelapse_filename.c_str()
1692-
, &cam->current_image->imgts, NULL, 0);
1692+
, &cam->current_image->imgts, NULL);
16931693

16941694
/* The increment of 10 is to allow for the extension and other chars*/
16951695
len = (int)(strlen(tmp) + cam->conf->target_dir.length() + 10);
@@ -1761,7 +1761,7 @@ int movie_init_extpipe(ctx_dev *cam)
17611761

17621762
mystrftime(cam, filename, sizeof(filename)
17631763
, cam->conf->movie_filename.c_str()
1764-
, &cam->current_image->imgts, NULL, 0);
1764+
, &cam->current_image->imgts, NULL);
17651765
if (cam->conf->movie_output) {
17661766
MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO
17671767
, _("Requested extpipe in addition to movie_output."));
@@ -1783,7 +1783,7 @@ int movie_init_extpipe(ctx_dev *cam)
17831783

17841784
mystrftime(cam, cam->extpipe_cmdline, sizeof(cam->extpipe_cmdline)
17851785
, cam->conf->movie_extpipe.c_str()
1786-
, &cam->current_image->imgts, cam->extpipe_filename, 0);
1786+
, &cam->current_image->imgts, cam->extpipe_filename);
17871787

17881788
MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO
17891789
, _("fps %d pipe cmd: %s")

src/util.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static void mystrftime_long (const ctx_dev *cam,
387387
* Returns: number of bytes written to the string s
388388
*/
389389
size_t mystrftime(ctx_dev *cam, char *s, size_t max, const char *userformat,
390-
const struct timespec *ts1, const char *filename, int sqltype)
390+
const struct timespec *ts1, const char *filename)
391391
{
392392
char formatstring[PATH_MAX] = "";
393393
char tempstring[PATH_MAX] = "";
@@ -501,9 +501,9 @@ size_t mystrftime(ctx_dev *cam, char *s, size_t max, const char *userformat,
501501
}
502502
break;
503503

504-
case 'n': // sqltype
505-
if (sqltype) {
506-
sprintf(tempstr, "%*d", width, sqltype);
504+
case 'n': // filetype
505+
if (cam->filetype) {
506+
sprintf(tempstr, "%*d", width, cam->filetype);
507507
} else {
508508
++pos_userformat;
509509
}
@@ -565,7 +565,7 @@ void mypicname(ctx_dev *cam
565565
int retcd;
566566

567567
mystrftime(cam, filename, sizeof(filename)
568-
, basename.c_str(), &cam->current_image->imgts, NULL, 0);
568+
, basename.c_str(), &cam->current_image->imgts, NULL);
569569
retcd = snprintf(fullname, PATH_MAX, fmtstr.c_str()
570570
, cam->conf->target_dir.c_str(), filename, extname.c_str());
571571
if ((retcd < 0) || (retcd >= PATH_MAX)) {
@@ -1303,10 +1303,10 @@ void util_exec_command(ctx_dev *cam, const char *command, char *filename)
13031303
if (cam->current_image == NULL) {
13041304
clock_gettime(CLOCK_REALTIME, &tmpts);
13051305
mystrftime(cam, stamp, sizeof(stamp), command
1306-
, &tmpts, filename, cam->filetype);
1306+
, &tmpts, filename);
13071307
} else {
13081308
mystrftime(cam, stamp, sizeof(stamp)
1309-
, command, &cam->current_image->imgts, filename, cam->filetype);
1309+
, command, &cam->current_image->imgts, filename);
13101310
}
13111311

13121312
pid = fork();

src/util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
FILE *myfopen(const char *path, const char *mode);
108108
int myfclose(FILE *fh);
109109
size_t mystrftime(ctx_dev *cam, char *s, size_t max, const char *userformat,
110-
const struct timespec *ts1, const char *filename, int sqltype);
110+
const struct timespec *ts1, const char *filename);
111111
void mypicname(ctx_dev *cam
112112
, char* fullname, std::string fmtstr
113113
, std::string basename, std::string extname);

0 commit comments

Comments
 (0)