mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-05 18:40:37 +00:00
Fixed compilation problems with gcc of 64-bits.
This commit is contained in:
parent
5a0a33d7e1
commit
6710ae5c89
@ -32,6 +32,11 @@
|
|||||||
|
|
||||||
#include <allegro.h>
|
#include <allegro.h>
|
||||||
|
|
||||||
|
// define this macro to solve the problem of for_each_file Allegro
|
||||||
|
// routine which does not support to wrap 64-bits pointers in its
|
||||||
|
// user-data parameter
|
||||||
|
#define WORKAROUND_64BITS_SUPPORT
|
||||||
|
|
||||||
// in Windows we can use PIDLS
|
// in Windows we can use PIDLS
|
||||||
#if defined ALLEGRO_WINDOWS
|
#if defined ALLEGRO_WINDOWS
|
||||||
// uncomment this if you don't want to use PIDLs in windows
|
// uncomment this if you don't want to use PIDLs in windows
|
||||||
@ -135,6 +140,10 @@ static FileItemMap fileitems_map;
|
|||||||
static ThumbnailMap thumbnail_map;
|
static ThumbnailMap thumbnail_map;
|
||||||
static unsigned int current_file_system_version = 0;
|
static unsigned int current_file_system_version = 0;
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_64BITS_SUPPORT
|
||||||
|
static FileItem* for_each_child_callback_param;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_PIDLS
|
#ifdef USE_PIDLS
|
||||||
static IMalloc* shl_imalloc = NULL;
|
static IMalloc* shl_imalloc = NULL;
|
||||||
static IShellFolder* shl_idesktop = NULL;
|
static IShellFolder* shl_idesktop = NULL;
|
||||||
@ -482,10 +491,16 @@ const FileItemList& fileitem_get_children(FileItem* fileitem)
|
|||||||
uconvert_ascii("*.*", tmp),
|
uconvert_ascii("*.*", tmp),
|
||||||
sizeof(buf));
|
sizeof(buf));
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_64BITS_SUPPORT
|
||||||
|
// we cannot use the for_each_file's 'param' to wrap a 64-bits pointer
|
||||||
|
for_each_child_callback_param = fileitem;
|
||||||
|
for_each_file(buf, FA_TO_SHOW, for_each_child_callback, 0);
|
||||||
|
#else
|
||||||
for_each_file(buf, FA_TO_SHOW,
|
for_each_file(buf, FA_TO_SHOW,
|
||||||
for_each_child_callback,
|
for_each_child_callback,
|
||||||
(int)fileitem); /* TODO warning with 64bits */
|
(int)fileitem);
|
||||||
}
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check old file-items (maybe removed directories or file-items)
|
// check old file-items (maybe removed directories or file-items)
|
||||||
@ -939,10 +954,8 @@ static void put_fileitem(FileItem* fileitem)
|
|||||||
|
|
||||||
static FileItem* get_fileitem_by_path(const jstring& path, bool create_if_not)
|
static FileItem* get_fileitem_by_path(const jstring& path, bool create_if_not)
|
||||||
{
|
{
|
||||||
#ifdef ALLEGRO_UNIX
|
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
return rootitem;
|
return rootitem;
|
||||||
#endif
|
|
||||||
|
|
||||||
FileItemMap::iterator it = fileitems_map.find(get_key_for_filename(path));
|
FileItemMap::iterator it = fileitems_map.find(get_key_for_filename(path));
|
||||||
if (it != fileitems_map.end())
|
if (it != fileitems_map.end())
|
||||||
@ -979,7 +992,11 @@ static FileItem* get_fileitem_by_path(const jstring& path, bool create_if_not)
|
|||||||
|
|
||||||
static void for_each_child_callback(const char *filename, int attrib, int param)
|
static void for_each_child_callback(const char *filename, int attrib, int param)
|
||||||
{
|
{
|
||||||
|
#ifdef WORKAROUND_64BITS_SUPPORT
|
||||||
|
FileItem* fileitem = for_each_child_callback_param;
|
||||||
|
#else
|
||||||
FileItem* fileitem = (FileItem*)param;
|
FileItem* fileitem = (FileItem*)param;
|
||||||
|
#endif
|
||||||
FileItem* child;
|
FileItem* child;
|
||||||
const char *filename_without_path = get_filename(filename);
|
const char *filename_without_path = get_filename(filename);
|
||||||
|
|
||||||
@ -990,6 +1007,7 @@ static void for_each_child_callback(const char *filename, int attrib, int param)
|
|||||||
|
|
||||||
child = get_fileitem_by_path(filename, FALSE);
|
child = get_fileitem_by_path(filename, FALSE);
|
||||||
if (!child) {
|
if (!child) {
|
||||||
|
assert(fileitem != NULL);
|
||||||
child = new FileItem(fileitem);
|
child = new FileItem(fileitem);
|
||||||
|
|
||||||
child->filename = filename;
|
child->filename = filename;
|
||||||
@ -1031,7 +1049,7 @@ static jstring get_key_for_filename(const jstring& filename)
|
|||||||
jstring buf(filename);
|
jstring buf(filename);
|
||||||
|
|
||||||
#if !defined CASE_SENSITIVE
|
#if !defined CASE_SENSITIVE
|
||||||
buf = buf.lower();
|
buf.tolower();
|
||||||
#endif
|
#endif
|
||||||
buf.fix_separators();
|
buf.fix_separators();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user