Changeset 854 for branches/prototype-v0/zoo-project/zoo-kernel/mimetypes.h
- Timestamp:
- Nov 21, 2017, 10:24:14 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/mimetypes.h
r839 r854 818 818 */ 819 819 static map* getFileExtensionMap(const char* mimeType, bool* hasExt) { 820 821 map* ext = createMap("extension", "txt"); 822 *hasExt = false; 820 map* ext = createMap("extension", "txt"); 821 *hasExt = false; 823 822 824 if (mimeType != NULL) { 825 for (int i = 0; i < NUM_MIME_TYPES; i++) { 826 if (strncmp(mimeType, MIME[i][M_Type], strlen(MIME[i][M_Type])) == 0) { 827 ext->value = zStrdup(MIME[i][M_Extension]); 828 *hasExt = true; 829 break; 830 } 831 } 832 if (*hasExt == false && strncmp(mimeType, "image/", 6) == 0) { 833 ext->value = zStrdup(strstr(mimeType, "/") + 1); 834 } 835 } 836 return ext; 823 if (mimeType != NULL) { 824 for (int i = 0; i < NUM_MIME_TYPES; i++) { 825 if(strncmp(mimeType, MIME[i][M_Type], strlen(MIME[i][M_Type])) == 0) { 826 free(ext->value); 827 ext->value = zStrdup(MIME[i][M_Extension]); 828 *hasExt = true; 829 break; 830 } 831 } 832 if (*hasExt == false && strncmp(mimeType, "image/", 6) == 0) { 833 free(ext->value); 834 ext->value = zStrdup(strstr(mimeType, "/") + 1); 835 } 836 } 837 return ext; 837 838 } 838 839
Note: See TracChangeset
for help on using the changeset viewer.