summaryrefslogtreecommitdiffabout
path: root/src
Side-by-side diff
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/eyefiservice.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/eyefiservice.cc b/src/eyefiservice.cc
index d7f0f04..77526b9 100644
--- a/src/eyefiservice.cc
+++ b/src/eyefiservice.cc
@@ -1,11 +1,12 @@
#include <cassert>
#include <iostream>
#include <fstream>
#include <stdexcept>
#include <iterator>
+#include <algorithm>
#include <syslog.h>
#include <sys/wait.h>
#include <autosprintf.h>
#include "eyekinfig.h"
#include "eyetil.h"
#include "soapeyefiService.h"
@@ -165,13 +166,16 @@ int eyefiService::UploadPhoto(
tarchive_t a((*i).ptr,(*i).size);
while(a.read_next_header()) {
std::string f = indir.get_file(a.entry_pathname());
std::string::size_type fl = f.length();
if(fl<4) continue;
const char *s = f.c_str()+fl-4;
- if(!(strcasecmp(s,".JPG") && strcasecmp(s,".AVI")))
+ static const char *suffixes[] = { ".JPG",".AVI",".MP4",".NEF",".RAW",".TIF" };
+ if(std::find_if(suffixes,suffixes+sizeof(suffixes)/sizeof(*suffixes),
+ std::not1(std::bind1st(std::ptr_fun(strcasecmp),s)))
+ != suffixes+sizeof(suffixes)/sizeof(*suffixes))
tf = f;
else if(!strcasecmp(s,".log"))
lf = f;
else continue;
int fd=open(f.c_str(),O_CREAT|O_WRONLY,0666);
if(fd<0)