• Home
  • Raw
  • Download

Lines Matching refs:mlu

35     cmsMLU* mlu;  in cmsMLUalloc()  local
41 mlu = (cmsMLU*) _cmsMallocZero(ContextID, sizeof(cmsMLU)); in cmsMLUalloc()
42 if (mlu == NULL) return NULL; in cmsMLUalloc()
44 mlu ->ContextID = ContextID; in cmsMLUalloc()
47 mlu ->Entries = (_cmsMLUentry*) _cmsCalloc(ContextID, nItems, sizeof(_cmsMLUentry)); in cmsMLUalloc()
48 if (mlu ->Entries == NULL) { in cmsMLUalloc()
49 _cmsFree(ContextID, mlu); in cmsMLUalloc()
54 mlu ->AllocatedEntries = nItems; in cmsMLUalloc()
55 mlu ->UsedEntries = 0; in cmsMLUalloc()
57 return mlu; in cmsMLUalloc()
63 cmsBool GrowMLUpool(cmsMLU* mlu) in GrowMLUpool() argument
69 if (mlu == NULL) return FALSE; in GrowMLUpool()
71 if (mlu ->PoolSize == 0) in GrowMLUpool()
74 size = mlu ->PoolSize * 2; in GrowMLUpool()
77 if (size < mlu ->PoolSize) return FALSE; in GrowMLUpool()
80 NewPtr = _cmsRealloc(mlu ->ContextID, mlu ->MemPool, size); in GrowMLUpool()
84 mlu ->MemPool = NewPtr; in GrowMLUpool()
85 mlu ->PoolSize = size; in GrowMLUpool()
93 cmsBool GrowMLUtable(cmsMLU* mlu) in GrowMLUtable() argument
99 if (mlu == NULL) return FALSE; in GrowMLUtable()
101 AllocatedEntries = mlu ->AllocatedEntries * 2; in GrowMLUtable()
104 if (AllocatedEntries / 2 != mlu ->AllocatedEntries) return FALSE; in GrowMLUtable()
107 …NewPtr = (_cmsMLUentry*)_cmsRealloc(mlu ->ContextID, mlu ->Entries, AllocatedEntries*sizeof(_cmsML… in GrowMLUtable()
110 mlu ->Entries = NewPtr; in GrowMLUtable()
111 mlu ->AllocatedEntries = AllocatedEntries; in GrowMLUtable()
119 int SearchMLUEntry(cmsMLU* mlu, cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode) in SearchMLUEntry() argument
124 if (mlu == NULL) return -1; in SearchMLUEntry()
127 for (i=0; i < mlu ->UsedEntries; i++) { in SearchMLUEntry()
129 if (mlu ->Entries[i].Country == CountryCode && in SearchMLUEntry()
130 mlu ->Entries[i].Language == LanguageCode) return i; in SearchMLUEntry()
140 cmsBool AddMLUBlock(cmsMLU* mlu, cmsUInt32Number size, const wchar_t *Block, in AddMLUBlock() argument
147 if (mlu == NULL) return FALSE; in AddMLUBlock()
150 if (mlu ->UsedEntries >= mlu ->AllocatedEntries) { in AddMLUBlock()
151 if (!GrowMLUtable(mlu)) return FALSE; in AddMLUBlock()
155 if (SearchMLUEntry(mlu, LanguageCode, CountryCode) >= 0) return FALSE; // Only one is allowed! in AddMLUBlock()
158 while ((mlu ->PoolSize - mlu ->PoolUsed) < size) { in AddMLUBlock()
160 if (!GrowMLUpool(mlu)) return FALSE; in AddMLUBlock()
163 Offset = mlu ->PoolUsed; in AddMLUBlock()
165 Ptr = (cmsUInt8Number*) mlu ->MemPool; in AddMLUBlock()
170 mlu ->PoolUsed += size; in AddMLUBlock()
172 mlu ->Entries[mlu ->UsedEntries].StrW = Offset; in AddMLUBlock()
173 mlu ->Entries[mlu ->UsedEntries].Len = size; in AddMLUBlock()
174 mlu ->Entries[mlu ->UsedEntries].Country = CountryCode; in AddMLUBlock()
175 mlu ->Entries[mlu ->UsedEntries].Language = LanguageCode; in AddMLUBlock()
176 mlu ->UsedEntries++; in AddMLUBlock()
183 cmsBool CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu, const char LanguageCode[3], const char CountryCode[3]… in cmsMLUsetASCII() argument
191 if (mlu == NULL) return FALSE; in cmsMLUsetASCII()
193 WStr = (wchar_t*) _cmsCalloc(mlu ->ContextID, len, sizeof(wchar_t)); in cmsMLUsetASCII()
199 rc = AddMLUBlock(mlu, len * sizeof(wchar_t), WStr, Lang, Cntry); in cmsMLUsetASCII()
201 _cmsFree(mlu ->ContextID, WStr); in cmsMLUsetASCII()
221 cmsBool CMSEXPORT cmsMLUsetWide(cmsMLU* mlu, const char Language[3], const char Country[3], const … in cmsMLUsetWide() argument
227 if (mlu == NULL) return FALSE; in cmsMLUsetWide()
231 return AddMLUBlock(mlu, len, WideString, Lang, Cntry); in cmsMLUsetWide()
235 cmsMLU* CMSEXPORT cmsMLUdup(const cmsMLU* mlu) in cmsMLUdup() argument
240 if (mlu == NULL) return NULL; in cmsMLUdup()
242 NewMlu = cmsMLUalloc(mlu ->ContextID, mlu ->UsedEntries); in cmsMLUdup()
246 if (NewMlu ->AllocatedEntries < mlu ->UsedEntries) in cmsMLUdup()
250 if (NewMlu ->Entries == NULL || mlu ->Entries == NULL) goto Error; in cmsMLUdup()
252 memmove(NewMlu ->Entries, mlu ->Entries, mlu ->UsedEntries * sizeof(_cmsMLUentry)); in cmsMLUdup()
253 NewMlu ->UsedEntries = mlu ->UsedEntries; in cmsMLUdup()
256 if (mlu ->PoolUsed == 0) { in cmsMLUdup()
261 NewMlu ->MemPool = _cmsMalloc(mlu ->ContextID, mlu ->PoolUsed); in cmsMLUdup()
265 NewMlu ->PoolSize = mlu ->PoolUsed; in cmsMLUdup()
267 if (NewMlu ->MemPool == NULL || mlu ->MemPool == NULL) goto Error; in cmsMLUdup()
269 memmove(NewMlu ->MemPool, mlu->MemPool, mlu ->PoolUsed); in cmsMLUdup()
270 NewMlu ->PoolUsed = mlu ->PoolUsed; in cmsMLUdup()
281 void CMSEXPORT cmsMLUfree(cmsMLU* mlu) in cmsMLUfree() argument
283 if (mlu) { in cmsMLUfree()
285 if (mlu -> Entries) _cmsFree(mlu ->ContextID, mlu->Entries); in cmsMLUfree()
286 if (mlu -> MemPool) _cmsFree(mlu ->ContextID, mlu->MemPool); in cmsMLUfree()
288 _cmsFree(mlu ->ContextID, mlu); in cmsMLUfree()
296 const wchar_t* _cmsMLUgetWide(const cmsMLU* mlu, in _cmsMLUgetWide() argument
305 if (mlu == NULL) return NULL; in _cmsMLUgetWide()
307 if (mlu -> AllocatedEntries <= 0) return NULL; in _cmsMLUgetWide()
309 for (i=0; i < mlu ->UsedEntries; i++) { in _cmsMLUgetWide()
311 v = mlu ->Entries + i; in _cmsMLUgetWide()
324 … return (wchar_t*) ((cmsUInt8Number*) mlu ->MemPool + v -> StrW); // Found exact match in _cmsMLUgetWide()
333 v = mlu ->Entries + Best; in _cmsMLUgetWide()
340 return(wchar_t*) ((cmsUInt8Number*) mlu ->MemPool + v ->StrW); in _cmsMLUgetWide()
345 cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu, in cmsMLUgetASCII() argument
357 if (mlu == NULL) return 0; in cmsMLUgetASCII()
360 Wide = _cmsMLUgetWide(mlu, &StrLen, Lang, Cntry, NULL, NULL); in cmsMLUgetASCII()
390 cmsUInt32Number CMSEXPORT cmsMLUgetWide(const cmsMLU* mlu, in cmsMLUgetWide() argument
401 if (mlu == NULL) return 0; in cmsMLUgetWide()
403 Wide = _cmsMLUgetWide(mlu, &StrLen, Lang, Cntry, NULL, NULL); in cmsMLUgetWide()
424 CMSAPI cmsBool CMSEXPORT cmsMLUgetTranslation(const cmsMLU* mlu, in cmsMLUgetTranslation() argument
435 if (mlu == NULL) return FALSE; in cmsMLUgetTranslation()
437 Wide = _cmsMLUgetWide(mlu, NULL, Lang, Cntry, &ObtLang, &ObtCode); in cmsMLUgetTranslation()
451 cmsUInt32Number CMSEXPORT cmsMLUtranslationsCount(const cmsMLU* mlu) in cmsMLUtranslationsCount() argument
453 if (mlu == NULL) return 0; in cmsMLUtranslationsCount()
454 return mlu->UsedEntries; in cmsMLUtranslationsCount()
458 cmsBool CMSEXPORT cmsMLUtranslationsCodes(const cmsMLU* mlu, in cmsMLUtranslationsCodes() argument
465 if (mlu == NULL) return FALSE; in cmsMLUtranslationsCodes()
467 if (idx >= (cmsUInt32Number) mlu->UsedEntries) return FALSE; in cmsMLUtranslationsCodes()
469 entry = &mlu->Entries[idx]; in cmsMLUtranslationsCodes()