MCPcopy Create free account
hub / github.com/ImpulseAdventure/JPEGsnoop / FindBimRecord

Method FindBimRecord

PsDecode.cpp:133–163  ·  view source on GitHub ↗

Locate a field ID in the constant 8BIM / Image Resource array INPUT: - nBimId = Image Resource ID (16-bit unsigned) OUTPUT: - nFldInd = Index into asBimRecords[] array RETURN: - Returns true if ID was found in array NOTE: - The constant struct array depends on BIM_T_END as a terminator for the list

Source from the content-addressed store, hash-verified

131// - The constant struct array depends on BIM_T_END as a terminator for the list
132//
133bool CPsDecode::FindBimRecord(unsigned nBimId,unsigned &nFldInd)
134{
135 unsigned nInd=0;
136 bool bDone=false;
137 bool bFound=false;
138 while (!bDone) {
139 if (asBimRecords[nInd].eBimType == BIM_T_END) {
140 bDone = true;
141 } else {
142 // Support detection of code ranges
143 unsigned nCodeStart = asBimRecords[nInd].nCode;
144 unsigned nCodeEnd = asBimRecords[nInd].nCodeEnd;
145 if ((nCodeEnd == 0) && (nCodeStart == nBimId)) {
146 // Match with single code (ie. not ranged entry)
147 bDone = true;
148 bFound = true;
149 } else if ((nCodeEnd != 0) && (nCodeStart <= nBimId) && (nCodeEnd >= nBimId)) {
150 // Match with code in ranged entry
151 bDone = true;
152 bFound = true;
153 } else {
154 nInd++;
155 }
156
157 }
158 }
159 if (bFound) {
160 nFldInd = nInd;
161 }
162 return bFound;
163}
164
165// Search the constant array of IPTC fields for the Record:DataSet index
166//

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected