this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

CoreServices: A few more old MacMemory functions

+54
+51
src/frameworks/CoreServices/MacMemory.cpp
··· 18 18 */ 19 19 20 20 #include <CoreServices/MacMemory.h> 21 + #include <CoreServices/MacErrors.h> 21 22 #include <cstring> 22 23 #include <stdint.h> 23 24 #include <cstdlib> ··· 173 174 void HUnlock(Handle h) 174 175 { 175 176 } 177 + 178 + OSErr HandToHand(Handle* h) 179 + { 180 + if (!h) 181 + return paramErr; 182 + if (!*h) 183 + { 184 + *h = NewEmptyHandle(); 185 + return noErr; 186 + } 187 + 188 + Handle src = *h; 189 + long size = GetHandleSize(src); 190 + Handle newHandle = NewHandle(size); 191 + 192 + memcpy(*newHandle, *src, size); 193 + *h = newHandle; 194 + 195 + return noErr; 196 + } 197 + 198 + // Append h1 to h2 199 + OSErr HandAndHand(Handle h1, Handle h2) 200 + { 201 + if (!h1 || !h2) 202 + return paramErr; 203 + if (!*h1) 204 + return noErr; 205 + long origSize = GetHandleSize(h2); 206 + long addSize = GetHandleSize(h1); 207 + 208 + SetHandleSize(h2, origSize + addSize); 209 + memcpy(*h2 + origSize, *h1, addSize); 210 + 211 + return noErr; 212 + } 213 + 214 + OSErr PtrAndHand(const void* ptr1, Handle hand2, long size) 215 + { 216 + if (!size) 217 + return noErr; 218 + if (!ptr1 || !hand2) 219 + return paramErr; 220 + 221 + long origSize = GetHandleSize(hand2); 222 + SetHandleSize(hand2, origSize + size); 223 + 224 + memcpy(*hand2 + origSize, ptr1, size); 225 + return noErr; 226 + }
+3
src/frameworks/CoreServices/include/CoreServices/MacMemory.h
··· 33 33 void HLock(Handle h); 34 34 void HLockHi(Handle h); 35 35 void HUnlock(Handle h); 36 + OSErr HandToHand(Handle* h); 37 + OSErr HandAndHand(Handle h1, Handle h2); 38 + OSErr PtrAndHand(const void* ptr1, Handle hand2, long size); 36 39 37 40 #ifdef __cplusplus 38 41 }