638{
640
641 if (!attr) {
642 parseStr += "Bad FirstEntry in Simple Sampled Segment\n";
643 return false;
644 }
645
647
649
650 if (!attr) {
651 parseStr += "Bad LastEntry in Simple Sampled Segment\n";
652 return false;
653 }
654
656
659 if (attr) {
661 }
662
665 if (attr) {
667 }
668
670
671
672 if (filename[0]) {
674 if (!file) {
675 parseStr += "Error! - File '";
676 parseStr += filename;
677 parseStr += "' not found.\n";
678 delete file;
679 return false;
680 }
681
683
684
685 if (!strcmp(format, "text")) {
687 char *buf = (char *) new char[num];
688
689 if (!buf) {
690 perror("Memory Error");
691 parseStr += "'";
692 parseStr += filename;
693 parseStr += "' may not be a valid text file.\n";
694 free(buf);
695 delete file;
696 return false;
697 }
698
699 if (file->
Read8(buf, num) != num) {
700 perror("Read-File Error");
701 parseStr += "'";
702 parseStr += filename;
703 parseStr += "' may not be a valid text file.\n";
704 free(buf);
705 delete file;
706 return false;
707 }
708
709
712
713
715 parseStr += "File '";
716 parseStr += filename;
717 parseStr += "' is not a valid text file.\n";
719 free(buf);
720 delete file;
721 return false;
722 }
723
724 else {
728
730 for (i = 0; i < data.
GetSize(); i++) {
732 dst++;
733 src++;
734 }
735
736
737
738
739
740
741 delete file;
742 return true;
743 }
744 }
745
746
749
750
752 parseStr += "File '";
753 parseStr += filename;
754 parseStr += "' is not a valid text file.\n";
756 free(buf);
757 delete file;
758 return false;
759 }
760
761 else {
763
766
768 for (i = 0; i < data.
GetSize(); i++) {
770 dst++;
771 src++;
772 }
773 }
774 delete file;
775 return true;
776 }
777
778
781
782
784 parseStr += "File '";
785 parseStr += filename;
786 parseStr += "' is not a valid text file.\n";
788 free(buf);
789 delete file;
790 return false;
791 }
792
793 else {
797
799 for (i = 0; i < data.
GetSize(); i++) {
800 *dst = *src;
801 dst++;
802 src++;
803 }
804 }
805 delete file;
806 return true;
807 }
808 else {
809 delete file;
810 return false;
811 }
812 }
813
814 else if (!strcmp(format, "binary")) {
816 bool little_endian = !strcmp(order, "little");
817
821
825 for (i = 0; i < num; i++) {
826 if (!file->
Read8(&value)) {
827 perror("Read-File Error");
828 parseStr += "'";
829 parseStr += filename;
830 parseStr += "' may not be a valid binary file.\n";
831 delete file;
832 return false;
833 }
835 }
836 delete file;
837 return true;
838 }
843
847 for (i = 0; i < num; i++) {
848 if (!file->
Read16(&value)) {
849 perror("Read-File Error");
850 parseStr += "'";
851 parseStr += filename;
852 parseStr += "' may not be a valid binary file.\n";
853 delete file;
854 return false;
855 }
856#ifdef ICC_BYTE_ORDER_LITTLE_ENDIAN
857 if (little_endian) {
858#else
859 if (!little_endian) {
860#endif
862 m_ptr[0] = m_ptr[1];
863 m_ptr[1] = t;
864 }
866 }
867 delete file;
868 return true;
869 }
874
878 for (i = 0; i < num; i++) {
879 if (!file->
Read16(&value)) {
880 perror("Read-File Error");
881 parseStr += "'";
882 parseStr += filename;
883 parseStr += "' may not be a valid binary file.\n";
884 delete file;
885 return false;
886 }
887#ifdef ICC_BYTE_ORDER_LITTLE_ENDIAN
888 if (little_endian) {
889#else
890 if (!little_endian) {
891#endif
893 m_ptr[0] = m_ptr[1];
894 m_ptr[1] = t;
895 }
897 }
898 delete file;
899 return true;
900 }
905
908
910 for (i = 0; i < num; i++) {
912 perror("Read-File Error");
913 parseStr += "'";
914 parseStr += filename;
915 parseStr += "' may not be a valid binary file.\n";
916 delete file;
917 return false;
918 }
919#ifdef ICC_BYTE_ORDER_LITTLE_ENDIAN
920 if (little_endian) {
921#else
922 if (!little_endian) {
923#endif
925 tmp = m_ptr[0]; m_ptr[0] = m_ptr[3]; m_ptr[3] = tmp;
926 tmp = m_ptr[1]; m_ptr[1] = m_ptr[2]; m_ptr[2] = tmp;
927 }
928 *dst++ = value;
929 }
930 delete file;
931 return true;
932 }
933 else {
934 delete file;
935 return false;
936 }
937 }
938 else {
939 delete file;
940 return false;
941 }
942 }
943
944 else {
946
948 return false;
949 }
950
952 return false;
953 }
954
956 }
957
958 return true;
959 }
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
CIccIO * IccOpenFileIO(const icChar *szFilename, const char *szAttr)
icFloatNumber icF16toF(icFloat16Number num)
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)
unsigned int icUInt32Number
icInt32Number ReadFloat32Float(void *pBufFloat, icInt32Number nNum=1)
virtual icInt32Number GetLength()
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
icFloatNumber m_firstEntry
icUInt16Number m_extensionType
icFloatNumber m_lastEntry
icFloatNumber * m_pSamples
icUInt16Number m_storageType
virtual bool SetSize(icUInt32Number nSize, bool bZeroAlloc=true)
Name: CIccSingleSampledCurve::SetSize.
static bool ParseArray(T *buf, icUInt32Number nBufSize, xmlNode *pNode)
bool ParseTextArrayNum(const char *szText, icUInt32Number num, std::string &parseStr)