Brush_file_directory, Brush_filename, Brush_filename_unicode are no longer static strings
This commit is contained in:
parent
fcd17f057b
commit
c6781cd7cd
@ -3188,7 +3188,10 @@ void Load_picture(enum CONTEXT_TYPE type)
|
||||
break;
|
||||
case CONTEXT_BRUSH:
|
||||
strcpy(filename, Brush_filename);
|
||||
Unicode_strlcpy(filename_unicode, Brush_filename_unicode, MAX_PATH_CHARACTERS);
|
||||
if (Brush_filename_unicode != NULL)
|
||||
Unicode_strlcpy(filename_unicode, Brush_filename_unicode, MAX_PATH_CHARACTERS);
|
||||
else
|
||||
filename_unicode[0] = 0;
|
||||
strcpy(directory, Brush_file_directory);
|
||||
Init_context_brush(&context, filename, directory);
|
||||
selector = &Brush_selector;
|
||||
@ -3236,9 +3239,15 @@ void Load_picture(enum CONTEXT_TYPE type)
|
||||
|
||||
if (type==CONTEXT_BRUSH)
|
||||
{
|
||||
strcpy(Brush_filename, context.File_name);
|
||||
Unicode_strlcpy(Brush_filename_unicode, context.File_name_unicode, MAX_PATH_CHARACTERS);
|
||||
strcpy(Brush_file_directory, context.File_directory);
|
||||
free(Brush_filename);
|
||||
Brush_filename = strdup(context.File_name);
|
||||
free(Brush_filename_unicode);
|
||||
if (context.File_name_unicode != NULL && context.File_name_unicode[0] != 0)
|
||||
Brush_filename_unicode = Unicode_strdup(context.File_name_unicode);
|
||||
else
|
||||
Brush_filename_unicode = NULL;
|
||||
free(Brush_file_directory);
|
||||
Brush_file_directory = strdup(context.File_directory);
|
||||
Brush_fileformat = context.Format;
|
||||
|
||||
Tiling_offset_X=0;
|
||||
@ -3502,7 +3511,10 @@ void Save_picture(enum CONTEXT_TYPE type)
|
||||
else if (type == CONTEXT_BRUSH)
|
||||
{
|
||||
strcpy(filename, Brush_filename);
|
||||
Unicode_strlcpy(filename_unicode, Brush_filename_unicode, MAX_PATH_CHARACTERS);
|
||||
if (Brush_filename_unicode != NULL)
|
||||
Unicode_strlcpy(filename_unicode, Brush_filename_unicode, MAX_PATH_CHARACTERS);
|
||||
else
|
||||
filename_unicode[0] = 0;
|
||||
strcpy(directory, Brush_file_directory);
|
||||
Init_context_brush(&save_context, filename, directory);
|
||||
save_context.Format = Brush_fileformat;
|
||||
@ -3572,10 +3584,16 @@ void Save_picture(enum CONTEXT_TYPE type)
|
||||
}
|
||||
if (type == CONTEXT_BRUSH)
|
||||
{
|
||||
Brush_fileformat=save_context.Format;
|
||||
strcpy(Brush_filename, save_context.File_name);
|
||||
Unicode_strlcpy(Brush_filename_unicode, save_context.File_name_unicode, MAX_PATH_CHARACTERS);
|
||||
strcpy(Brush_file_directory, save_context.File_directory);
|
||||
Brush_fileformat = save_context.Format;
|
||||
free(Brush_filename);
|
||||
Brush_filename = strdup(save_context.File_name);
|
||||
free(Brush_filename_unicode);
|
||||
if (save_context.File_name_unicode != NULL && save_context.File_name_unicode[0] != 0)
|
||||
Brush_filename_unicode = Unicode_strdup(save_context.File_name_unicode);
|
||||
else
|
||||
Brush_filename_unicode = NULL;
|
||||
free(Brush_file_directory);
|
||||
Brush_file_directory = strdup(save_context.File_directory);
|
||||
}
|
||||
Hide_cursor();
|
||||
Cursor_shape=old_cursor_shape;
|
||||
|
||||
@ -786,8 +786,10 @@ void Main_handler(void)
|
||||
Load_image(&brush_context);
|
||||
if (File_error == 0)
|
||||
{
|
||||
strcpy(Brush_filename, "NO_NAME.GIF");
|
||||
Brush_filename_unicode[0] = 0;
|
||||
free(Brush_filename);
|
||||
Brush_filename = strdup("NO_NAME.GIF");
|
||||
free(Brush_filename_unicode);
|
||||
Brush_filename_unicode = NULL;
|
||||
Brush_fileformat = FORMAT_GIF;
|
||||
|
||||
Tiling_offset_X=0;
|
||||
|
||||
@ -323,11 +323,11 @@ GFX2_GLOBAL word Brush_width;
|
||||
/// Height of the current brush.
|
||||
GFX2_GLOBAL word Brush_height;
|
||||
/// Name of the directory that holds the brush fil (after loading or saving it).
|
||||
GFX2_GLOBAL char Brush_file_directory[MAX_PATH_CHARACTERS];
|
||||
GFX2_GLOBAL char * Brush_file_directory;
|
||||
/// Filename (without directory) of the brush (after loading or saving it).
|
||||
GFX2_GLOBAL char Brush_filename[MAX_PATH_CHARACTERS];
|
||||
GFX2_GLOBAL char * Brush_filename;
|
||||
/// Filename (without directory) of the brush (after loading or saving it) unicode.
|
||||
GFX2_GLOBAL word Brush_filename_unicode[MAX_PATH_CHARACTERS];
|
||||
GFX2_GLOBAL word * Brush_filename_unicode;
|
||||
/// File format of the brush. It's a value of enum ::FILE_FORMATS
|
||||
GFX2_GLOBAL byte Brush_fileformat;
|
||||
/// Fileselector settings
|
||||
|
||||
14
src/main.c
14
src/main.c
@ -671,11 +671,11 @@ int Init_program(int argc,char * argv[])
|
||||
Main.fileformat=DEFAULT_FILEFORMAT;
|
||||
Spare.fileformat =DEFAULT_FILEFORMAT;
|
||||
|
||||
strcpy(Brush_selector.Directory,Main.selector.Directory);
|
||||
strcpy(Brush_file_directory,Main.selector.Directory);
|
||||
strcpy(Brush_filename ,"NO_NAME.GIF");
|
||||
Brush_filename_unicode[0] = 0;
|
||||
Brush_fileformat =DEFAULT_FILEFORMAT;
|
||||
strcpy(Brush_selector.Directory, Main.selector.Directory);
|
||||
Brush_file_directory = strdup(Main.selector.Directory);
|
||||
Brush_filename = strdup("NO_NAME.GIF");
|
||||
Brush_filename_unicode = NULL;
|
||||
Brush_fileformat = DEFAULT_FILEFORMAT;
|
||||
|
||||
strcpy(Palette_selector.Directory,Main.selector.Directory);
|
||||
|
||||
@ -1241,6 +1241,10 @@ void Program_shutdown(void)
|
||||
FREE_POINTER(Smear_brush);
|
||||
FREE_POINTER(Brush_original_pixels);
|
||||
|
||||
FREE_POINTER(Brush_file_directory);
|
||||
FREE_POINTER(Brush_filename);
|
||||
FREE_POINTER(Brush_filename_unicode);
|
||||
|
||||
// Free all images
|
||||
Set_number_of_backups(-1); // even delete the main page
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user