/* * Perform the actual rename. For ease of use under vms5.0, check to see if we * have delete-privilege for the file. If not, try to set it. Returns 0 iff * no error occurred; otherwise the corresponding RMS status code. */ static doit(char *newspec, char *oldspec, GETPROT *prot_) { unsigned status; int modified = FALSE; #define DELETE_MASK ((XAB$M_NODEL << XAB$V_SYS)\ | (XAB$M_NODEL << XAB$V_OWN)\ | (XAB$M_NODEL << XAB$V_GRP)\ | (XAB$M_NODEL << XAB$V_WLD)) #define UNMASK(name,mask) if ((status = chprot(name, mask, 0)) == RMS$_NORMAL)\ status = 0 if (!cmpprot(prot_, "d")) { UNMASK(oldspec, prot_->p_mask & ~DELETE_MASK); if (status != 0) return (status); modified = TRUE; } if (!(status = sysrename(newspec, oldspec))) { if (modified) UNMASK(newspec, prot_->p_mask); } return (status); }
CPLErr LERC_Band::Decompress(buf_mgr &dst, buf_mgr &src) { const Byte *ptr = (Byte *)(src.buffer); Lerc2::HeaderInfo hdInfo; Lerc2 lerc2; if (!lerc2.GetHeaderInfo(ptr, hdInfo)) return DecompressLERC(dst, src, img); // It is lerc2 here bool success = false; BitMask2 bitMask(img.pagesize.x, img.pagesize.y); switch (img.dt) { #define DECODE(T) success = lerc2.Decode(&ptr, reinterpret_cast<T *>(dst.buffer), bitMask.Bits()) case GDT_Byte: DECODE(GByte); break; case GDT_UInt16: DECODE(GUInt16); break; case GDT_Int16: DECODE(GInt16); break; case GDT_Int32: DECODE(GInt32); break; case GDT_UInt32: DECODE(GUInt32); break; case GDT_Float32: DECODE(float); break; case GDT_Float64: DECODE(double); break; default: CPLAssert(FALSE); break; #undef DECODE } if (!success) { CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during LERC2 decompression"); return CE_Failure; } if (!img.hasNoData) return CE_None; // Fill in no data values switch (img.dt) { #define UNMASK(T) UnMask(bitMask, reinterpret_cast<T *>(dst.buffer), img) case GDT_Byte: UNMASK(GByte); break; case GDT_UInt16: UNMASK(GUInt16); break; case GDT_Int16: UNMASK(GInt16); break; case GDT_Int32: UNMASK(GInt32); break; case GDT_UInt32: UNMASK(GUInt32); break; case GDT_Float32: UNMASK(float); break; case GDT_Float64: UNMASK(double); break; default: CPLAssert(FALSE); break; #undef DECODE } return CE_None; }