Ignore:
Timestamp:
May 7, 2019, 2:17:08 PM (5 years ago)
Author:
djay
Message:

Merge prototype-v0 branch in trunk

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/zoo-project/zoo-kernel/mimetypes.h

    r601 r917  
    180180        { "application/vnd.dece.unspecified", "uvx" },
    181181        { "application/vnd.dece.zip", "uvz" },
    182         { "application/vnd.denovo.fcselayout-link", "fe_launch" },
     182        { "application/vnd.denovo.fcselayout-link", "fe_launch" },     
    183183        { "application/vnd.dna", "dna" },
    184184        { "application/vnd.dolby.mlp", "mlp" },
     
    818818*/
    819819static 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}
    820839
    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;
     840static 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;
    837865}
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png