Changeset 917 for trunk/zoo-project/zoo-kernel/mimetypes.h
- Timestamp:
- May 7, 2019, 2:17:08 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
False
/branches/prototype-v0 merged eligible
-
Property
svn:mergeinfo
set to
False
-
trunk/zoo-project/zoo-kernel/mimetypes.h
r601 r917 180 180 { "application/vnd.dece.unspecified", "uvx" }, 181 181 { "application/vnd.dece.zip", "uvz" }, 182 { "application/vnd.denovo.fcselayout-link", "fe_launch" }, 182 { "application/vnd.denovo.fcselayout-link", "fe_launch" }, 183 183 { "application/vnd.dna", "dna" }, 184 184 { "application/vnd.dolby.mlp", "mlp" }, … … 818 818 */ 819 819 static map* getFileExtensionMap(const char* mimeType, bool* hasExt) { 820 map* ext = createMap("extension", "txt"); 821 *hasExt = false; 822 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; 838 } 820 839 821 map* ext = createMap("extension", "txt"); 822 *hasExt = false; 823 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; 840 static int isGeographic(const char* mimeType){ 841 char* imageMimeType[4]={ 842 "image/tiff", 843 "image/png", 844 "image/jpeg", 845 "application/vnd.google-earth.kmz" 846 }; 847 char* vectorMimeType[5]={ 848 "text/xml", 849 "application/json", 850 "application/gml+xml", 851 "application/zip", 852 "application/vnd.google-earth.kml+xml" 853 }; 854 int i=0; 855 for(;i<4;i++){ 856 if(strncmp(imageMimeType[i],mimeType,strlen(imageMimeType[i]))==0) 857 return 1; 858 } 859 i=0; 860 for(;i<5;i++){ 861 if(strncmp(vectorMimeType[i],mimeType,strlen(vectorMimeType[i]))==0) 862 return 2; 863 } 864 return -1; 837 865 }
Note: See TracChangeset
for help on using the changeset viewer.