Blender V2.61 - r43446
|
#include <stdio.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_md5.h"
#include "BKE_utildefines.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_thumbs.h"
#include "IMB_metadata.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Go to the source code of this file.
Defines | |
#define | URI_MAX FILE_MAX*3 + 8 |
#define | ACCEPTABLE(a) ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask)) |
Enumerations | |
enum | UnsafeCharacterSet { UNSAFE_ALL = 0x1, UNSAFE_ALLOW_PLUS = 0x2, UNSAFE_PATH = 0x8, UNSAFE_HOST = 0x10, UNSAFE_SLASHES = 0x20 } |
Functions | |
static int | get_thumb_dir (char *dir, ThumbSize size) |
static void | escape_uri_string (const char *string, char *escaped_string, int len, UnsafeCharacterSet mask) |
static void | to_hex_char (char *hexbytes, const unsigned char *bytes, int len) |
static int | uri_from_filename (const char *path, char *uri) |
static void | thumbname_from_uri (const char *uri, char *thumb, const int thumb_len) |
static int | thumbpath_from_uri (const char *uri, char *path, const int path_len, ThumbSize size) |
void | IMB_thumb_makedirs (void) |
ImBuf * | IMB_thumb_create (const char *path, ThumbSize size, ThumbSource source, ImBuf *img) |
ImBuf * | IMB_thumb_read (const char *path, ThumbSize size) |
void | IMB_thumb_delete (const char *path, ThumbSize size) |
ImBuf * | IMB_thumb_manage (const char *path, ThumbSize size, ThumbSource source) |
Variables | |
static const unsigned char | acceptable [96] |
static const char | hex [17] = "0123456789abcdef" |
Definition in file thumbs.c.
#define ACCEPTABLE | ( | a | ) | ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask)) |
Referenced by escape_uri_string().
#define URI_MAX FILE_MAX*3 + 8 |
Definition at line 68 of file thumbs.c.
Referenced by IMB_thumb_create(), and uri_from_filename().
enum UnsafeCharacterSet |
----- begin of adapted code from glib --- The following code is adapted from function g_escape_uri_string from the gnome glib Source: http://svn.gnome.org/viewcvs/glib/trunk/glib/gconvert.c?view=markup released under the Gnu General Public License.
static void escape_uri_string | ( | const char * | string, |
char * | escaped_string, | ||
int | len, | ||
UnsafeCharacterSet | mask | ||
) | [static] |
Definition at line 129 of file thumbs.c.
References ACCEPTABLE, hex, and p.
Referenced by uri_from_filename().
static int get_thumb_dir | ( | char * | dir, |
ThumbSize | size | ||
) | [static] |
Definition at line 70 of file thumbs.c.
References BLI_strncpy(), FILE_MAX, THB_FAIL, THB_LARGE, and THB_NORMAL.
Referenced by IMB_thumb_create(), IMB_thumb_makedirs(), and thumbpath_from_uri().
ImBuf* IMB_thumb_create | ( | const char * | path, |
ThumbSize | size, | ||
ThumbSource | source, | ||
ImBuf * | img | ||
) |
Definition at line 247 of file thumbs.c.
References abs(), BLI_file_size(), BLI_path_ncmp, BLI_rename(), BLI_snprintf(), FILE_MAX, ImBuf::ftype, get_thumb_dir(), IB_metadata, IB_rect, IMB_allocImBuf(), IMB_anim_absolute(), IMB_anim_previewframe(), IMB_free_anim(), IMB_freeImBuf(), imb_freerectfloatImBuf(), IMB_loadblend_thumb(), IMB_loadiffname(), IMB_metadata_change_field(), IMB_open_anim(), IMB_PROXY_NONE, IMB_rect_from_float(), IMB_saveiff(), IMB_scaleImBuf(), IMB_TC_NONE, NULL, ImBuf::planes, PNG, ImBuf::rect, ImBuf::rect_float, THB_FAIL, THB_LARGE, THB_NORMAL, THB_SOURCE_BLEND, THB_SOURCE_IMAGE, THB_SOURCE_MOVIE, THUMB_SIZE_MAX, thumbname_from_uri(), uri_from_filename(), URI_MAX, ImBuf::x, and ImBuf::y.
Referenced by IMB_thumb_manage(), and WM_write_file().
void IMB_thumb_delete | ( | const char * | path, |
ThumbSize | size | ||
) |
Definition at line 398 of file thumbs.c.
References BLI_delete(), BLI_exists(), BLI_path_ncmp, FILE_MAX, thumbpath_from_uri(), and uri_from_filename().
Referenced by IMB_thumb_manage().
void IMB_thumb_makedirs | ( | void | ) |
Definition at line 235 of file thumbs.c.
References BLI_dir_create_recursive(), FILE_MAX, get_thumb_dir(), THB_FAIL, and THB_NORMAL.
Referenced by ED_file_init().
ImBuf* IMB_thumb_manage | ( | const char * | path, |
ThumbSize | size, | ||
ThumbSource | source | ||
) |
Definition at line 418 of file thumbs.c.
References BLI_exists(), BLI_path_ncmp, FILE_MAX, IB_metadata, IB_rect, IMB_freeImBuf(), IMB_loadiffname(), IMB_metadata_get_field(), IMB_thumb_create(), IMB_thumb_delete(), NULL, THB_FAIL, THB_LARGE, THB_NORMAL, thumbpath_from_uri(), and uri_from_filename().
Referenced by thumbnails_startjob().
Definition at line 381 of file thumbs.c.
References FILE_MAX, IB_metadata, IB_rect, IMB_loadiffname(), NULL, thumbpath_from_uri(), and uri_from_filename().
static void thumbname_from_uri | ( | const char * | uri, |
char * | thumb, | ||
const int | thumb_len | ||
) | [static] |
Definition at line 209 of file thumbs.c.
References BLI_snprintf(), md5_buffer(), strlen(), and to_hex_char().
Referenced by IMB_thumb_create(), and thumbpath_from_uri().
static int thumbpath_from_uri | ( | const char * | uri, |
char * | path, | ||
const int | path_len, | ||
ThumbSize | size | ||
) | [static] |
Definition at line 221 of file thumbs.c.
References BLI_snprintf(), FILE_MAX, get_thumb_dir(), and thumbname_from_uri().
Referenced by IMB_thumb_delete(), IMB_thumb_manage(), and IMB_thumb_read().
static void to_hex_char | ( | char * | hexbytes, |
const unsigned char * | bytes, | ||
int | len | ||
) | [static] |
static int uri_from_filename | ( | const char * | path, |
char * | uri | ||
) | [static] |
----- end of adapted code from glib ---
Definition at line 170 of file thumbs.c.
References BLI_char_switch(), BLI_strncpy(), escape_uri_string(), FILE_MAX, NULL, strlen(), UNSAFE_PATH, and URI_MAX.
Referenced by IMB_thumb_create(), IMB_thumb_delete(), IMB_thumb_manage(), and IMB_thumb_read().
const unsigned char acceptable[96] [static] |
{ 0x00,0x3F,0x20,0x20,0x28,0x00,0x2C,0x3F,0x3F,0x3F,0x3F,0x2A,0x28,0x3F,0x3F,0x1C, 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x38,0x20,0x20,0x2C,0x20,0x20, 0x38,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x20,0x3F, 0x20,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x3F,0x20 }
Definition at line 109 of file thumbs.c.
Referenced by NPP_WriteReady().
const char hex[17] = "0123456789abcdef" [static] |
Definition at line 125 of file thumbs.c.
Referenced by escape_uri_string(), Exception::setXptDesc(), and to_hex_char().