int
cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid)
{
- uintptr_t file_id;
- Entry *entry;
+ unsigned int file_id;
+ File_Data *entry;
Reference *ref;
File_Watch *fw;
char buf[4906];
// search whether the file is already opened by another client
snprintf(buf, sizeof(buf), "%s:%s", path, key);
- file_id = (uintptr_t)eina_hash_find(file_ids, buf);
+ file_id = (unsigned int)eina_hash_find(file_ids, buf);
if (file_id)
{
- DBG("found file_id %d for client file id %d",
+ DBG("found file_id %u for client file id %d",
file_id, client_file_id);
entry = eina_hash_find(file_entries, &file_id);
if (!entry)
while ((file_id == 0) || (eina_hash_find(file_entries, &file_id)))
file_id = _file_id++;
- DBG("Creating new entry with file_id: %d for file \"%s:%s\"",
+ DBG("Creating new entry with file_id: %u for file \"%s:%s\"",
file_id, path, key);
entry = calloc(1, sizeof(*entry));
entry->type = CSERVE2_IMAGE_FILE;
EINA_LIST_FOREACH(entry->references, l, ref)
{
- Eina_Hash *hash;
+ Eina_Hash *hash = NULL;
if (entry->type == CSERVE2_IMAGE_FILE)
hash = ref->client->files.referencing;
else if (entry->type == CSERVE2_IMAGE_DATA)
cserve2_main_loop_setup(void)
{
int sfd;
- int socket;
+ int sock;
int ifd;
epoll_fd = epoll_create1(EPOLL_CLOEXEC);
return EINA_FALSE;
}
- socket = _socketfd_setup();
- if (socket == -1)
+ sock = _socketfd_setup();
+ if (sock == -1)
{
ERR("Could not setup socketfd.");
goto error_socket;
}
- DBG("Add watch for socket fd: %d", socket);
- if (!cserve2_fd_watch_add(socket, FD_READ, _socketfd_handler, NULL))
+ DBG("Add watch for socket fd: %d", sock);
+ if (!cserve2_fd_watch_add(sock, FD_READ, _socketfd_handler, NULL))
{
ERR("Could not add watch for socketf.");
- close(socket);
+ close(sock);
goto error_socket;
}