static int checkType()

in src/ujdecode.c [634:733]


static int checkType(int ki, const char *format, UJObject obj)
{
	int c = (unsigned char) format[ki];
	int type = UJGetType(obj);
	int allowNull = 0;

	switch (c)
	{
	case 'b':
		allowNull = 1;
	case 'B':
		switch (type)
		{
			case UJT_Null:
				if (!allowNull)
					return 0;
			case UJT_True:
			case UJT_False:
				return 1;

			default:
				return 0;
		}
		break;

	case 'n':
		allowNull = 1;
	case 'N':
		switch (type)
		{
			case UJT_Null:
				if (!allowNull)
					return 0;
			case UJT_Long:
			case UJT_LongLong:
			case UJT_Double:
				return 1;

			default:
				return 0;
		}
		break;

	case 's':
		allowNull = 1;
	case 'S':
		switch (type)
		{
			case UJT_Null:
				if (!allowNull)
					return 0;
			case UJT_String:
				return 1;

			default:
				return 0;
		}
		break;

	case 'a':
		allowNull = 1;
	case 'A':
		switch (type)
		{
			case UJT_Null:
				if (!allowNull)
					return 0;
			case UJT_Array:
				return 1;

			default:
				return 0;
		}
		break;

	case 'o':
		allowNull = 1;
	case 'O':
		switch (type)
		{
			case UJT_Null:
				if (!allowNull)
					return 0;
			case UJT_Object:
				return 1;
			default:
				return 0;
		}

		break;

	case 'u':
		allowNull = 1;
	case 'U':
		return 1;
		break;
	}

	return 0;
}