From ad62dda338917350cb678db86a8436a34d045ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 1 Jun 2012 15:51:24 +0200 Subject: add_destination: increase wrong path detection --- src/lib/eiotas_particle.c | 16 ++++++++++++++++ tests/particle.c | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c index a72d55f..6d3facc 100644 --- a/src/lib/eiotas_particle.c +++ b/src/lib/eiotas_particle.c @@ -117,6 +117,8 @@ EAPI void eiotas_particle_destinations_add(Eiotas_Particle *particle, const char static Eina_Bool add_destination(Eiotas_Particle *particle, const char *dst, int n) { + int i, c; + char *tmp; Eina_Stringshare *s; if(n==0) { @@ -132,6 +134,20 @@ static Eina_Bool add_destination(Eiotas_Particle *particle, const char *dst, int return EINA_FALSE; } + for(tmp=(char*)dst, c=0, i=0; i1) { + ERR("ignore destination with more then 1 '%c' ",EIOTAS_ACTION_SEP); + return EINA_FALSE; + } + s = eina_stringshare_add_length(dst,n); eina_array_push(particle->dsts,s); DBG("add dst >%s<",s); diff --git a/tests/particle.c b/tests/particle.c index b6ba450..402e0c5 100644 --- a/tests/particle.c +++ b/tests/particle.c @@ -20,7 +20,7 @@ void test_particle() eiotas_particle_destinations_add(p0,"dom0/room0/room1/doorx?get,door?get,dom0/room0/door0?get"); eiotas_particle_destinations_add(p0," dom0/room0/room1/doorx?get,door?get , dom0/room0/door0?get "); eiotas_particle_destinations_add(p0," dom0/room0/room1/doorx?get,door?get, dom0/room0/door0?get "); - eiotas_particle_destinations_add(p0," /suffix, ?suffix, prefix/ , prefix? , ,, "); + eiotas_particle_destinations_add(p0," /suffix, ?suffix, prefix/ , prefix? , ,, very/?wrong , very?wrong?too"); acc = eina_array_accessor_new(p0->dsts); eina_accessor_data_get(acc,0,&p); -- cgit v1.1-2-g2b99