private static int GetRandomBufferLength(IntPtr p, int nullLength) { int num; int num1; int num2; switch (nullLength) { case 1: { return((void *)(checked ((int)Stdlib.strlen(p)))); } case 2: { return(UnixMarshal.GetInt16BufferLength(p)); } case 3: { num = 0; num1 = 0; do { num2 = num; num = num2 + 1; if (Marshal.ReadByte(p, num2) != 0) { num1 = 0; } else { num1++; } }while (num1 != nullLength); return(num); } case 4: { return(UnixMarshal.GetInt32BufferLength(p)); } default: { num = 0; num1 = 0; do { num2 = num; num = num2 + 1; if (Marshal.ReadByte(p, num2) != 0) { num1 = 0; } else { num1++; } }while (num1 != nullLength); return(num); } } }