fix function to get type qualifiers

main
rfm 13 years ago
parent 32c79b2329
commit c3aa9b62e6

@ -4,6 +4,7 @@
#include <ctype.h> #include <ctype.h>
#include "objc/runtime.h" #include "objc/runtime.h"
#include "objc/encoding.h"
#include "method_list.h" #include "method_list.h"
#include "visibility.h" #include "visibility.h"
@ -449,32 +450,23 @@ char* method_copyReturnType(Method method)
unsigned objc_get_type_qualifiers (const char *type) unsigned objc_get_type_qualifiers (const char *type)
{ {
unsigned flags = 0; unsigned flags = 0;
#define MAP(chr, bit) case chr: flags |= (1<<bit); break; #define MAP(chr, bit) case chr: flags |= bit; break;
do do
{ {
switch (*(type++)) switch (*(type++))
{ {
default: return flags; default: return flags;
MAP('r', 1) MAP('r', _F_CONST)
MAP('n', 1) MAP('n', _F_IN)
MAP('o', 2) MAP('o', _F_OUT)
MAP('N', 3) MAP('N', _F_INOUT)
MAP('O', 4) MAP('O', _F_BYCOPY)
MAP('V', 10) MAP('V', _F_ONEWAY)
MAP('R', 8) MAP('R', _F_BYREF)
} }
} while (1); } while (1);
} }
struct objc_struct_layout
{
const char *original_type;
const char *type;
const char *prev_type;
unsigned int record_size;
unsigned int record_align;
};
// Note: The implementations of these functions is horrible. // Note: The implementations of these functions is horrible.
void objc_layout_structure (const char *type, void objc_layout_structure (const char *type,
struct objc_struct_layout *layout) struct objc_struct_layout *layout)

Loading…
Cancel
Save