Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Use the same definition of BINARY in multiple places of fossil. Reported by sky5walk. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
b51ba29365b93b3fa13f7fc05034ec6a |
| User & Date: | jan.nijtmans 2015-11-06 08:09:00.797 |
Context
|
2015-11-09
| ||
| 08:58 | Cherry-pick part of [http://www.sqlite.org/src/info/138783b553602a05|138783b5] from SQLite trunk. Harmless compile warning. ... (check-in: 9a11b49e65 user: jan.nijtmans tags: trunk) | |
|
2015-11-06
| ||
| 09:19 | c1 ... (check-in: 8440ddab4c user: jan.nijtmans tags: mistake) | |
| 08:09 | Use the same definition of BINARY in multiple places of fossil. Reported by sky5walk. ... (check-in: b51ba29365 user: jan.nijtmans tags: trunk) | |
|
2015-11-05
| ||
| 02:38 | Add new environment variables to the set that is displayed on the /test_env page. ... (check-in: 690824e991 user: drh tags: trunk) | |
Changes
Changes to src/doc.c.
| ︙ | ︙ | |||
33 34 35 36 37 38 39 |
** For any other binary type, return "unknown/unknown".
*/
const char *mimetype_from_content(Blob *pBlob){
int i;
int n;
const unsigned char *x;
| < < < < < < | < < < < < < < > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
** For any other binary type, return "unknown/unknown".
*/
const char *mimetype_from_content(Blob *pBlob){
int i;
int n;
const unsigned char *x;
/* A table of mimetypes based on file content prefixes
*/
static const struct {
const char *zPrefix; /* The file prefix */
int size; /* Length of the prefix */
const char *zMimetype; /* The corresponding mimetype */
} aMime[] = {
{ "GIF87a", 6, "image/gif" },
{ "GIF89a", 6, "image/gif" },
{ "\211PNG\r\n\032\n", 8, "image/png" },
{ "\377\332\377", 3, "image/jpeg" },
{ "\377\330\377", 3, "image/jpeg" },
};
if( !looks_like_binary(pBlob) ) {
return 0; /* Plain text */
}
x = (const unsigned char*)blob_buffer(pBlob);
n = blob_size(pBlob);
for(i=0; i<ArraySize(aMime); i++){
if( n>=aMime[i].size && memcmp(x, aMime[i].zPrefix, aMime[i].size)==0 ){
return aMime[i].zMimetype;
}
}
return "unknown/unknown";
}
|
| ︙ | ︙ |