< prev index next >

src/java.desktop/share/native/liblcms/cmscgats.c

Print this page

        

@@ -28,11 +28,11 @@
 // file:
 //
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
 // to deal in the Software without restriction, including without limitation
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,

@@ -156,11 +156,11 @@
 
     } TABLE;
 
 // File stream being parsed
 typedef struct _FileContext {
-        char           FileName[cmsMAX_PATH];    // File name if being readed from file
+        char           FileName[cmsMAX_PATH];    // File name if being read from file
         FILE*          Stream;                   // File stream or NULL if holded in memory
     } FILECTX;
 
 // This struct hold all information about an open IT8 handler.
 typedef struct {

@@ -283,11 +283,11 @@
                                                    // Where standard conditions have been defined (e.g., SWOP at nominal)
                                                    // named conditions may suffice. Otherwise, detailed information is
                                                    // needed.
 
         {"SAMPLE_BACKING",   WRITE_STRINGIFY},     // Identifies the backing material used behind the sample during
-                                                   // measurement. Allowed values are “black”, “white”, or {"na".
+                                                   // measurement. Allowed values are "black", "white", or {"na".
 
         {"CHISQ_DOF",        WRITE_STRINGIFY},     // Degrees of freedom associated with the Chi squared statistic
                                                    // below properties are new in recent specs:
 
         {"MEASUREMENT_GEOMETRY", WRITE_STRINGIFY}, // The type of measurement, either reflection or transmission, should be indicated

@@ -298,11 +298,11 @@
 
        {"FILTER",            WRITE_STRINGIFY},     // Identifies the use of physical filter(s) during measurement. Typically used to
                                                    // denote the use of filters such as none, D65, Red, Green or Blue.
 
        {"POLARIZATION",      WRITE_STRINGIFY},     // Identifies the use of a physical polarization filter during measurement. Allowed
-                                                   // values are {"yes”, “white”, “none” or “na”.
+                                                   // values are {"yes", "white", "none" or "na".
 
        {"WEIGHTING_FUNCTION", WRITE_PAIR},         // Indicates such functions as: the CIE standard observer functions used in the
                                                    // calculation of various data parameters (2 degree and 10 degree), CIE standard
                                                    // illuminant functions used in the calculation of various data parameters (e.g., D50,
                                                    // D65, etc.), density status response, etc. If used there shall be at least one

@@ -710,12 +710,12 @@
 
 // Reads next symbol
 static
 void InSymbol(cmsIT8* it8)
 {
-    register char *idptr;
-    register int k;
+    CMSREGISTER char *idptr;
+    CMSREGISTER int k;
     SYMBOL key;
     int sng;
 
     do {
 

@@ -2193,60 +2193,42 @@
 
 
         if (cmsstrcasecmp(Fld, "SAMPLE_ID") == 0) {
 
             t -> SampleID = idField;
-
-            for (i=0; i < t -> nPatches; i++) {
-
-                char *Data = GetData(it8, i, idField);
-                if (Data) {
-                    char Buffer[256];
-
-                    strncpy(Buffer, Data, 255);
-                    Buffer[255] = 0;
-
-                    if (strlen(Buffer) <= strlen(Data))
-                        strcpy(Data, Buffer);
-                    else
-                        SetData(it8, i, idField, Buffer);
-
-                }
-            }
-
         }
 
         // "LABEL" is an extension. It keeps references to forward tables
 
-        if ((cmsstrcasecmp(Fld, "LABEL") == 0) || Fld[0] == '$' ) {
+        if ((cmsstrcasecmp(Fld, "LABEL") == 0) || Fld[0] == '$') {
 
                     // Search for table references...
-                    for (i=0; i < t -> nPatches; i++) {
+            for (i = 0; i < t->nPatches; i++) {
 
-                            char *Label = GetData(it8, i, idField);
+                char* Label = GetData(it8, i, idField);
 
                             if (Label) {
 
                                 cmsUInt32Number k;
 
                                 // This is the label, search for a table containing
                                 // this property
 
-                                for (k=0; k < it8 ->TablesCount; k++) {
+                    for (k = 0; k < it8->TablesCount; k++) {
 
-                                    TABLE* Table = it8 ->Tab + k;
+                        TABLE* Table = it8->Tab + k;
                                     KEYVALUE* p;
 
                                     if (IsAvailableOnList(Table->HeaderList, Label, NULL, &p)) {
 
                                         // Available, keep type and table
                                         char Buffer[256];
 
-                                        char *Type  = p ->Value;
-                                        int  nTable = (int) k;
+                            char* Type = p->Value;
+                            int  nTable = (int)k;
 
-                                        snprintf(Buffer, 255, "%s %d %s", Label, nTable, Type );
+                            snprintf(Buffer, 255, "%s %d %s", Label, nTable, Type);
 
                                         SetData(it8, i, idField, Buffer);
                                     }
                                 }
 

@@ -2347,10 +2329,15 @@
     hIT8 = cmsIT8Alloc(ContextID);
     if (!hIT8) return NULL;
 
     it8 = (cmsIT8*) hIT8;
     it8 ->MemoryBlock = (char*) _cmsMalloc(ContextID, len + 1);
+    if (it8->MemoryBlock == NULL)
+    {
+        cmsIT8Free(hIT8);
+        return FALSE;
+    }
 
     strncpy(it8 ->MemoryBlock, (const char*) Ptr, len);
     it8 ->MemoryBlock[len] = 0;
 
     strncpy(it8->FileStack[0]->FileName, "", cmsMAX_PATH-1);
< prev index next >