~ubuntu-branches/ubuntu/wily/spatialite/wily-proposed

« back to all changes in this revision

Viewing changes to src/geopackage/gpkgGetImageType.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-07-14 11:57:46 UTC
  • mfrom: (16.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150714115746-e2iljfmb5sq7o5hh
Tags: 4.3.0-1
Move from experimental to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
The Initial Developer of the Original Code is Brad Hards (bradh@frogmouth.net)
20
20
 
21
 
Portions created by the Initial Developer are Copyright (C) 2012
 
21
Portions created by the Initial Developer are Copyright (C) 2012-2015
22
22
the Initial Developer. All Rights Reserved.
23
23
 
24
24
Contributor(s):
44
44
 
45
45
#ifdef ENABLE_GEOPACKAGE
46
46
 
47
 
GEOPACKAGE_DECLARE void
 
47
GEOPACKAGE_PRIVATE void
48
48
fnct_gpkgGetImageType (sqlite3_context * context, int argc UNUSED,
49
49
                       sqlite3_value ** argv)
50
50
{
67
67
    unsigned char *p_blob = NULL;
68
68
    int n_bytes = 0;
69
69
    int blobType;
70
 
    
 
70
 
71
71
    if (sqlite3_value_type (argv[0]) != SQLITE_BLOB)
72
 
    {
73
 
        sqlite3_result_error(context, "gpkgGetImageType() error: argument 1 [image blob] is not of the BLOB type", -1);
74
 
        return;
75
 
    }
 
72
      {
 
73
          sqlite3_result_error (context,
 
74
                                "gpkgGetImageType() error: argument 1 [image blob] is not of the BLOB type",
 
75
                                -1);
 
76
          return;
 
77
      }
76
78
    p_blob = (unsigned char *) sqlite3_value_blob (argv[0]);
77
79
    n_bytes = sqlite3_value_bytes (argv[0]);
78
 
    
79
 
    blobType = gaiaGuessBlobType(p_blob, n_bytes);
 
80
 
 
81
    blobType = gaiaGuessBlobType (p_blob, n_bytes);
80
82
    switch (blobType)
81
 
    {
82
 
        case GAIA_TIFF_BLOB:
83
 
            sqlite3_result_text(context, "tiff", strlen("tiff"), SQLITE_TRANSIENT);
84
 
            break;
85
 
        case GAIA_PNG_BLOB:
86
 
            sqlite3_result_text(context, "png", strlen("png"), SQLITE_TRANSIENT);
87
 
            break;
88
 
        case GAIA_JPEG_BLOB:
89
 
            sqlite3_result_text(context, "jpeg", strlen("jpeg"), SQLITE_TRANSIENT);
90
 
            break;
91
 
        case GAIA_WEBP_BLOB:
92
 
            sqlite3_result_text(context, "x-webp", strlen("x-webp"), SQLITE_TRANSIENT);
93
 
            break;
94
 
        default:
95
 
            sqlite3_result_text(context, "unknown", strlen("unknown"), SQLITE_TRANSIENT);
96
 
            break;
97
 
    }
 
83
      {
 
84
      case GAIA_TIFF_BLOB:
 
85
          sqlite3_result_text (context, "tiff", strlen ("tiff"),
 
86
                               SQLITE_TRANSIENT);
 
87
          break;
 
88
      case GAIA_PNG_BLOB:
 
89
          sqlite3_result_text (context, "png", strlen ("png"),
 
90
                               SQLITE_TRANSIENT);
 
91
          break;
 
92
      case GAIA_JPEG_BLOB:
 
93
          sqlite3_result_text (context, "jpeg", strlen ("jpeg"),
 
94
                               SQLITE_TRANSIENT);
 
95
          break;
 
96
      case GAIA_WEBP_BLOB:
 
97
          sqlite3_result_text (context, "x-webp", strlen ("x-webp"),
 
98
                               SQLITE_TRANSIENT);
 
99
          break;
 
100
      default:
 
101
          sqlite3_result_text (context, "unknown", strlen ("unknown"),
 
102
                               SQLITE_TRANSIENT);
 
103
          break;
 
104
      }
98
105
}
99
106
#endif