//
// TIFFReadBufferSetup from 0x6ef6a0 to 0x6ef890 (496 bytes)
//
// 6 xrefs:
// > sub_6ED3C0 @ 0x6ed4c8
// > TIFFFillStrip @ 0x6ee958
// > TIFFFillStrip @ 0x6ee99c
// > TIFFFillTile @ 0x6ef56c
// > TIFFFillTile @ 0x6ef5b0
// > ??> @ 0x5874c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall TIFFReadBufferSetup(_DWORD *a1, int a2, int a3)
{
if ( (a1[3] & 0x20000) != 0 )
_assert2();
a1[3] &= ~0x800000u;
if ( a1[147] )
{
if ( (a1[3] & 0x200) != 0 )
TIFFfree(a1[147]);
a1[147] = 0;
a1[148] = 0;
}
if ( a2 )
{
a1[148] = a3;
a1[147] = a2;
a1[3] &= ~0x200u;
}
else
{
a1[148] = (unsigned int)((a3 + 1023LL) >> 10) << 10;
if ( !a1[148] )
a1[148] = -1;
a1[147] = TIFFmalloc(a1[148]);
a1[3] |= 0x200u;
}
if ( a1[147] )
return 1;
TIFFErrorExt(a1[157], (int)"TIFFReadBufferSetup", "No space for data buffer at scanline %lu", a1[111]);
a1[148] = 0;
return 0;
}