diff options
author | David Walter Seikel | 2014-05-28 15:51:47 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-28 15:51:47 +1000 |
commit | 98170010ee92c807650bd529216612532975c14e (patch) | |
tree | 7f7030cdc9d4b3f65329603d4f79be2405aa9f6e /src | |
parent | Oops part two. (diff) | |
download | SledjHamr-98170010ee92c807650bd529216612532975c14e.zip SledjHamr-98170010ee92c807650bd529216612532975c14e.tar.gz SledjHamr-98170010ee92c807650bd529216612532975c14e.tar.bz2 SledjHamr-98170010ee92c807650bd529216612532975c14e.tar.xz |
The UUID faking code is common enough to stick it in a macro.
Diffstat (limited to '')
-rw-r--r-- | src/extantz/extantz.c | 2 | ||||
-rw-r--r-- | src/libraries/love.h | 1 | ||||
-rw-r--r-- | src/love/love.c | 4 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index e611e4d..4f5d9ea 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -150,7 +150,7 @@ static void _onWorldClick(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void | |||
150 | char SID[64]; | 150 | char SID[64]; |
151 | 151 | ||
152 | // CUBE_UUID.events.touch_start(1), but we just make one up for now. | 152 | // CUBE_UUID.events.touch_start(1), but we just make one up for now. |
153 | snprintf(SID, sizeof(SID), "%08lx-%04lx-%04lx-%04lx-%012lx", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); | 153 | snprintf(SID, sizeof(SID), FAKE_UUID); |
154 | sendForth(ourGlobals.server, SID, "events.touch_start(1)"); | 154 | sendForth(ourGlobals.server, SID, "events.touch_start(1)"); |
155 | } | 155 | } |
156 | } | 156 | } |
diff --git a/src/libraries/love.h b/src/libraries/love.h index cbd4c80..cf23f3c 100644 --- a/src/libraries/love.h +++ b/src/libraries/love.h | |||
@@ -83,6 +83,7 @@ love needs | |||
83 | 83 | ||
84 | #include "Runnr.h" | 84 | #include "Runnr.h" |
85 | 85 | ||
86 | #define FAKE_UUID "%08lx-%04lx-%04lx-%04lx-%012lx", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random() | ||
86 | 87 | ||
87 | typedef struct _vec4 | 88 | typedef struct _vec4 |
88 | { | 89 | { |
diff --git a/src/love/love.c b/src/love/love.c index dc27d9c..7d50917 100644 --- a/src/love/love.c +++ b/src/love/love.c | |||
@@ -146,7 +146,7 @@ static void dirList_compile(const char *name, const char *path, void *data) | |||
146 | 146 | ||
147 | scriptCount++; | 147 | scriptCount++; |
148 | gettimeofday(&me->startTime, NULL); | 148 | gettimeofday(&me->startTime, NULL); |
149 | snprintf(me->SID, sizeof(me->SID), "%08lx-%04lx-%04lx-%04lx-%012lx", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); | 149 | snprintf(me->SID, sizeof(me->SID), FAKE_UUID); |
150 | snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); | 150 | snprintf(me->fileName, sizeof(me->fileName), "%s/%s", path, name); |
151 | eina_hash_add(ourGlobals->scripts, me->SID, me); | 151 | eina_hash_add(ourGlobals->scripts, me->SID, me); |
152 | sendForth(ourGlobals->serverLuaSL, me->SID, "compile(%s)", me->fileName); | 152 | sendForth(ourGlobals->serverLuaSL, me->SID, "compile(%s)", me->fileName); |
@@ -431,7 +431,7 @@ static Eina_Bool _dataLuaSL(void *data, int type, Ecore_Con_Event_Server_Data *e | |||
431 | } | 431 | } |
432 | } while (temp && (0 < lineNo--)); | 432 | } while (temp && (0 < lineNo--)); |
433 | 433 | ||
434 | sprintf(key, "%08lx-%04lx-%04lx-%04lx-%012lx", random(), random() % 0xFFFF, random() % 0xFFFF, random() % 0xFFFF, random()); | 434 | sprintf(key, FAKE_UUID); |
435 | sendForth(ourGlobals->serverLuaSL, SID, "return \"%s\"", key); | 435 | sendForth(ourGlobals->serverLuaSL, SID, "return \"%s\"", key); |
436 | 436 | ||
437 | // TODO - For now, just send it to everyone. | 437 | // TODO - For now, just send it to everyone. |