* 348x348
* 700x348
*/
-#define NR_OF_SIZE_LIST 5
+#define NR_OF_SIZE_LIST 6
#define DEFAULT_PERIOD -1.0f
static const struct supported_size_list {
int w;
int h;
} SIZE_LIST[NR_OF_SIZE_LIST] = {
- { 172, 172 },
- { 348, 172 },
- { 348, 348 },
- { 700, 348 },
- { 700, 172 },
+ { 172, 172 }, /*!< 1x1 */
+ { 348, 172 }, /*!< 2x1 */
+ { 348, 348 }, /*!< 2x2 */
+ { 700, 348 }, /*!< 4x2 */
+ { 700, 172 }, /*!< 4x1 */
+ { 700, 700 }, /*!< 4x4 */
};
enum content_event_type {
return NULL;
}
+ if (handler->filename)
+ return handler->filename;
+
+ /* Oooops */
return URI_TO_PATH(handler->id);
}
return NULL;
}
+static inline char *get_file_kept_in_safe(const char *id)
+{
+ const char *path;
+ char *new_path;
+ int len;
+ int base_idx;
+
+ path = URI_TO_PATH(id);
+ if (!path) {
+ ErrPrint("Invalid URI(%s)\n", id);
+ return NULL;
+ }
+
+ /*!
+ * \TODO: REMOVE ME
+ */
+ if (getenv("DISABLE_PREVENT_OVERWRITE")) {
+ return strdup(path);
+ }
+
+ len = strlen(path);
+ base_idx = len - 1;
+
+ while (base_idx > 0 && path[base_idx] != '/') base_idx--;
+ base_idx += (path[base_idx] == '/');
+
+ new_path = malloc(len + 10);
+ if (!new_path) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return NULL;
+ }
+
+ strncpy(new_path, path, base_idx);
+ snprintf(new_path + base_idx, len + 10 - base_idx, "_%s", path + base_idx);
+ return new_path;
+}
+
struct livebox *lb_new_livebox(const char *pkgname, const char *id, double timestamp)
{
struct livebox *handler;
return NULL;
}
+ handler->filename = get_file_kept_in_safe(id);
+ if (!handler->filename) {
+ handler->filename = strdup(URI_TO_PATH(id));
+ if (!handler->filename)
+ ErrPrint("Error: %s\n", strerror(errno));
+ }
+
handler->timestamp = timestamp;
handler->lb.type = _LB_TYPE_FILE;
handler->pd.type = _PD_TYPE_SCRIPT;
handler->id = strdup(id);
if (!handler->id)
ErrPrint("Error: %s\n", strerror(errno));
+
+ if (handler->filename)
+ free(handler->filename);
+
+ handler->filename = get_file_kept_in_safe(id);
+ if (!handler->filename) {
+ handler->filename = strdup(URI_TO_PATH(id));
+ if (!handler->filename)
+ ErrPrint("Error: %s\n", strerror(errno));
+ }
}
int lb_set_lb_fb(struct livebox *handler, const char *filename)
free(handler->category);
free(handler->id);
free(handler->pkgname);
+ free(handler->filename);
if (handler->lb.data.fb) {
fb_destroy(handler->lb.data.fb);