Skip to content

Commit

Permalink
Use C99 integer types
Browse files Browse the repository at this point in the history
In file included from /home/brad/ports/pobj/indi-2.1.1/indi-2.1.1/libs/indibase/webcam/v4l2_decode/v4l2_builtin_decoder.cpp:60:
/home/brad/ports/pobj/indi-2.1.1/indi-2.1.1/libs/indibase/webcam/v4l2_decode/v4l2_builtin_decoder.h:47:17: error: unknown type name '__u32'
        virtual __u32 getFormat();
                ^
/home/brad/ports/pobj/indi-2.1.1/indi-2.1.1/libs/indibase/webcam/v4l2_decode/v4l2_builtin_decoder.cpp:541:1: error: unknown type name '__u32'
__u32 V4L2_Builtin_Decoder::getFormat()
^
2 errors generated.
  • Loading branch information
brad0 committed Jan 14, 2025
1 parent f263114 commit 0b84560
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
8 changes: 4 additions & 4 deletions drivers/auxiliary/joystickdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ const char *JoyStickDriver::getName()
return name;
}

__u32 JoyStickDriver::getVersion()
uint32_t JoyStickDriver::getVersion()
{
return version;
}

__u8 JoyStickDriver::getNumOfJoysticks()
uint8_t JoyStickDriver::getNumOfJoysticks()
{
int n_joysticks = axes / 2;

Expand All @@ -255,12 +255,12 @@ __u8 JoyStickDriver::getNumOfJoysticks()
return n_joysticks;
}

__u8 JoyStickDriver::getNumOfAxes()
uint8_t JoyStickDriver::getNumOfAxes()
{
return axes;
}

__u8 JoyStickDriver::getNumrOfButtons()
uint8_t JoyStickDriver::getNumrOfButtons()
{
return buttons;
}
15 changes: 8 additions & 7 deletions drivers/auxiliary/joystickdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <fcntl.h>
#include <pthread.h>
#include <cmath>
#include <cstdint>
#include <linux/joystick.h>
#include <vector>
#include <unistd.h>
Expand Down Expand Up @@ -80,10 +81,10 @@ class JoyStickDriver
void setPoll(int ms);

const char *getName();
__u32 getVersion();
__u8 getNumOfJoysticks();
__u8 getNumOfAxes();
__u8 getNumrOfButtons();
uint32_t getVersion();
uint8_t getNumOfJoysticks();
uint8_t getNumOfAxes();
uint8_t getNumrOfButtons();

joystick_position joystickPosition(int n);
bool buttonPressed(int n);
Expand All @@ -110,9 +111,9 @@ class JoyStickDriver
int joystick_fd;
js_event *joystick_ev;
joystick_state *joystick_st;
__u32 version;
__u8 axes;
__u8 buttons;
uint32_t version;
uint8_t axes;
uint8_t buttons;
char name[256];
char dev_path[256];
int pollMS;
Expand Down
16 changes: 5 additions & 11 deletions libs/indibase/webcam/pwc-ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@

#pragma once

#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
#include <linux/types.h>
#else
#include <stdint.h>
typedef uint16_t __le16;
typedef uint8_t __u8;
#endif

/* Enumeration of image sizes */
#define PSZ_SQCIF 0x00
Expand Down Expand Up @@ -311,9 +305,9 @@ struct pwc_table_init_buffer

struct pwc_raw_frame
{
__le16 type; /* type of the webcam */
__le16 vbandlength; /* Size of 4lines compressed (used by the decompressor) */
__u8 cmd[4]; /* the four byte of the command (in case of nala,
only the first 3 bytes is filled) */
__u8 rawframe[0]; /* frame_size = H/4*vbandlength */
uint16_t type; /* type of the webcam */
uint16_t vbandlength; /* Size of 4lines compressed (used by the decompressor) */
uint8_t cmd[4]; /* the four byte of the command (in case of nala,
only the first 3 bytes is filled) */
uint8_t rawframe[0]; /* frame_size = H/4*vbandlength */
} __attribute__((packed));
2 changes: 1 addition & 1 deletion libs/indibase/webcam/v4l2_decode/v4l2_builtin_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ void V4L2_Builtin_Decoder::setformat(struct v4l2_format f, bool use_ext_pix_form
allocBuffers();
}

__u32 V4L2_Builtin_Decoder::getFormat()
uint32_t V4L2_Builtin_Decoder::getFormat()
{
return fmt.fmt.pix.pixelformat;
}
Expand Down
3 changes: 2 additions & 1 deletion libs/indibase/webcam/v4l2_decode/v4l2_builtin_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "v4l2_decode.h"

#include <cstdint>
#include <map>

class V4L2_Builtin_Decoder : public V4L2_Decoder
Expand All @@ -44,7 +45,7 @@ class V4L2_Builtin_Decoder : public V4L2_Decoder
virtual void resetcrop();
virtual void usesoftcrop(bool c);
virtual void setformat(struct v4l2_format f, bool use_ext_pix_format);
virtual __u32 getFormat();
virtual uint32_t getFormat();
virtual bool issupportedformat(unsigned int format);
virtual const std::vector<unsigned int> &getsupportedformats();
virtual void decode(unsigned char *frame, struct v4l2_buffer *buf, bool native);
Expand Down

0 comments on commit 0b84560

Please sign in to comment.