From ea0d11eb8f4a8e0aaa9fec375c44f54ccd28c828 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Tue, 12 May 2015 15:52:00 -0700 Subject: [PATCH 01/11] lastsnap allow path information when doing a singelton lastsnap picture --- event.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/event.c b/event.c index 59870f66..2800f0e6 100644 --- a/event.c +++ b/event.c @@ -350,8 +350,13 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { char fullfilename[PATH_MAX]; - - if (strcmp(cnt->conf.snappath, "lastsnap")) { + int len = strlen(cnt->conf.snappath); + int offset = 0; + if (len >= 9) + { + offset = len - 8; + } + if (strcmp(cnt->conf.snappath+offset, "lastsnap")) { char filename[PATH_MAX]; char filepath[PATH_MAX]; char linkpath[PATH_MAX]; @@ -383,7 +388,11 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, return; } } else { - snprintf(fullfilename, PATH_MAX, "%s/lastsnap.%s", cnt->conf.filepath, imageext(cnt)); + char filename[PATH_MAX]; + char filepath[PATH_MAX]; + mystrftime(cnt, filepath, sizeof(filepath), cnt->conf.snappath, currenttime_tm, NULL, 0); + snprintf(filename, PATH_MAX, "%s.%s", filepath, imageext(cnt)); + snprintf(fullfilename, PATH_MAX, "%s/%s", cnt->conf.filepath, filename); remove(fullfilename); put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); } From 5a31c0b44993440ca28c0796ec7cf262b20ecfce Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 15:32:54 -0700 Subject: [PATCH 02/11] moved declarations up --- event.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/event.c b/event.c index 2800f0e6..378b4963 100644 --- a/event.c +++ b/event.c @@ -351,14 +351,14 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, { char fullfilename[PATH_MAX]; int len = strlen(cnt->conf.snappath); + char filename[PATH_MAX]; + char filepath[PATH_MAX]; int offset = 0; if (len >= 9) { offset = len - 8; } - if (strcmp(cnt->conf.snappath+offset, "lastsnap")) { - char filename[PATH_MAX]; - char filepath[PATH_MAX]; + if (strcmp(cnt->conf.snappath+offset, "lastsnap")) char linkpath[PATH_MAX]; const char *snappath; /* @@ -388,8 +388,6 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, return; } } else { - char filename[PATH_MAX]; - char filepath[PATH_MAX]; mystrftime(cnt, filepath, sizeof(filepath), cnt->conf.snappath, currenttime_tm, NULL, 0); snprintf(filename, PATH_MAX, "%s.%s", filepath, imageext(cnt)); snprintf(fullfilename, PATH_MAX, "%s/%s", cnt->conf.filepath, filename); From 06e4f3bc1f2abbbba145493c94565c6e338b8ef5 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 15:39:36 -0700 Subject: [PATCH 03/11] replacing spaces with tabs --- event.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/event.c b/event.c index 378b4963..43290947 100644 --- a/event.c +++ b/event.c @@ -350,16 +350,16 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { char fullfilename[PATH_MAX]; - int len = strlen(cnt->conf.snappath); + int len = strlen(cnt->conf.snappath); char filename[PATH_MAX]; char filepath[PATH_MAX]; - int offset = 0; - if (len >= 9) - { + int offset = 0; + if (len >= 9) + { offset = len - 8; } - if (strcmp(cnt->conf.snappath+offset, "lastsnap")) - char linkpath[PATH_MAX]; + if (strcmp(cnt->conf.snappath+offset, "lastsnap")) + char linkpath[PATH_MAX]; const char *snappath; /* * conf.snappath would normally be defined but if someone deleted it by control interface From 0cb7a049e12b6506538d3ecc3252ae78241ce995 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 15:42:28 -0700 Subject: [PATCH 04/11] more spaces to tabs --- event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/event.c b/event.c index 43290947..77fe9033 100644 --- a/event.c +++ b/event.c @@ -391,11 +391,11 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, mystrftime(cnt, filepath, sizeof(filepath), cnt->conf.snappath, currenttime_tm, NULL, 0); snprintf(filename, PATH_MAX, "%s.%s", filepath, imageext(cnt)); snprintf(fullfilename, PATH_MAX, "%s/%s", cnt->conf.filepath, filename); - remove(fullfilename); - put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); + remove(fullfilename); + put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); } - cnt->snapshot = 0; + cnt->snapshot = 0; } static void event_camera_lost(struct context *cnt, int type ATTRIBUTE_UNUSED, From 899ce50ce92e45d057ffd4f76752f50341df4353 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 15:43:50 -0700 Subject: [PATCH 05/11] whoops did one wrong now tab to space conversion :) --- event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event.c b/event.c index 77fe9033..44bf42ab 100644 --- a/event.c +++ b/event.c @@ -395,7 +395,7 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); } - cnt->snapshot = 0; + cnt->snapshot = 0; } static void event_camera_lost(struct context *cnt, int type ATTRIBUTE_UNUSED, From cc3cafdce5a9a5f2e991e2d116b87031cdb36fab Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 16:08:29 -0700 Subject: [PATCH 06/11] Another tab to space change --- event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/event.c b/event.c index 44bf42ab..e3ce367d 100644 --- a/event.c +++ b/event.c @@ -349,11 +349,11 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { - char fullfilename[PATH_MAX]; - int len = strlen(cnt->conf.snappath); + char fullfilename[PATH_MAX]; char filename[PATH_MAX]; char filepath[PATH_MAX]; int offset = 0; + int len = strlen(cnt->conf.snappath); if (len >= 9) { offset = len - 8; @@ -391,8 +391,8 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, mystrftime(cnt, filepath, sizeof(filepath), cnt->conf.snappath, currenttime_tm, NULL, 0); snprintf(filename, PATH_MAX, "%s.%s", filepath, imageext(cnt)); snprintf(fullfilename, PATH_MAX, "%s/%s", cnt->conf.filepath, filename); - remove(fullfilename); - put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); + remove(fullfilename); + put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); } cnt->snapshot = 0; From 2c316263c5c3ee06463bb37b43ae7e306f061fe3 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 16:10:38 -0700 Subject: [PATCH 07/11] found another tab that needed spaces --- event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event.c b/event.c index e3ce367d..b83ee75d 100644 --- a/event.c +++ b/event.c @@ -349,7 +349,7 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { - char fullfilename[PATH_MAX]; + char fullfilename[PATH_MAX]; char filename[PATH_MAX]; char filepath[PATH_MAX]; int offset = 0; From 4996c3105436e372bcf3347371261c7604972a21 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 16:12:59 -0700 Subject: [PATCH 08/11] still trying to figure out how may spaces it had --- event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event.c b/event.c index b83ee75d..e3ce367d 100644 --- a/event.c +++ b/event.c @@ -349,7 +349,7 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { - char fullfilename[PATH_MAX]; + char fullfilename[PATH_MAX]; char filename[PATH_MAX]; char filepath[PATH_MAX]; int offset = 0; From 9496889fd1d94628179b2bdb1c3d05b83354ebf8 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 16:18:16 -0700 Subject: [PATCH 09/11] this is a tab in the original spaces to tabs --- event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event.c b/event.c index e3ce367d..b83ee75d 100644 --- a/event.c +++ b/event.c @@ -349,7 +349,7 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { - char fullfilename[PATH_MAX]; + char fullfilename[PATH_MAX]; char filename[PATH_MAX]; char filepath[PATH_MAX]; int offset = 0; From ba7044e4f04e03188f483fa2c7c4991ad9fc7f2d Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sat, 16 May 2015 16:23:23 -0700 Subject: [PATCH 10/11] Whew found it a trailing tab --- event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event.c b/event.c index b83ee75d..74bf8ab7 100644 --- a/event.c +++ b/event.c @@ -349,7 +349,7 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { - char fullfilename[PATH_MAX]; + char fullfilename[PATH_MAX]; char filename[PATH_MAX]; char filepath[PATH_MAX]; int offset = 0; From 3e99410c5f8dc25eba1c4ec8fb1bee1a0bff40a7 Mon Sep 17 00:00:00 2001 From: jdodgen Date: Sun, 17 May 2015 09:12:09 -0700 Subject: [PATCH 11/11] Tab to space conversion --- event.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/event.c b/event.c index 74bf8ab7..a021e194 100644 --- a/event.c +++ b/event.c @@ -349,17 +349,17 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, unsigned char *img, char *dummy1 ATTRIBUTE_UNUSED, void *dummy2 ATTRIBUTE_UNUSED, struct tm *currenttime_tm) { - char fullfilename[PATH_MAX]; - char filename[PATH_MAX]; - char filepath[PATH_MAX]; - int offset = 0; - int len = strlen(cnt->conf.snappath); - if (len >= 9) - { - offset = len - 8; - } - if (strcmp(cnt->conf.snappath+offset, "lastsnap")) - char linkpath[PATH_MAX]; + char fullfilename[PATH_MAX]; + char filename[PATH_MAX]; + char filepath[PATH_MAX]; + int offset = 0; + int len = strlen(cnt->conf.snappath); + + if (len >= 9) + offset = len - 8; + + if (strcmp(cnt->conf.snappath+offset, "lastsnap")) { + char linkpath[PATH_MAX]; const char *snappath; /* * conf.snappath would normally be defined but if someone deleted it by control interface @@ -388,9 +388,9 @@ static void event_image_snapshot(struct context *cnt, int type ATTRIBUTE_UNUSED, return; } } else { - mystrftime(cnt, filepath, sizeof(filepath), cnt->conf.snappath, currenttime_tm, NULL, 0); - snprintf(filename, PATH_MAX, "%s.%s", filepath, imageext(cnt)); - snprintf(fullfilename, PATH_MAX, "%s/%s", cnt->conf.filepath, filename); + mystrftime(cnt, filepath, sizeof(filepath), cnt->conf.snappath, currenttime_tm, NULL, 0); + snprintf(filename, PATH_MAX, "%s.%s", filepath, imageext(cnt)); + snprintf(fullfilename, PATH_MAX, "%s/%s", cnt->conf.filepath, filename); remove(fullfilename); put_picture(cnt, fullfilename, img, FTYPE_IMAGE_SNAPSHOT); }