1 //---------------------------------------------------------------------------------
3 // Little Color Management System
4 // Copyright (c) 1998-2010 Marti Maria Saguer
6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the Software
11 // is furnished to do so, subject to the following conditions:
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
18 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 //---------------------------------------------------------------------------------
34 fprintf(stderr, "Sets profile version\n\nUsage: vericc --r<version> iccprofile.icc\n");
38 int main(int argc, char *argv[])
42 cmsFloat64Number Version;
44 if (argc != 3) return PrintUsage();
47 if (strncmp(ptr, "--r", 3) != 0) return PrintUsage();
49 if (!*ptr) { fprintf(stderr, "Wrong version number\n"); return 1; }
53 hProfile = cmsOpenProfileFromFile(argv[2], "r");
54 if (hProfile == NULL) { fprintf(stderr, "'%s': cannot open\n", argv[2]); return 1; }
56 cmsSetProfileVersion(hProfile, Version);
57 cmsSaveProfileToFile(hProfile, "$$tmp.icc");
58 cmsCloseProfile(hProfile);
61 rename("$$tmp.icc", argv[2]);