Fixed warning for declarations without prototype

This commit is contained in:
Hoguchi 2023-02-04 02:58:34 -10:00
parent 50a3586d2f
commit 614af18466
19 changed files with 60 additions and 116 deletions

View File

@ -1,25 +0,0 @@
import socket
import time
import sys
server = "irc.rizon.net" #settings
channel = "#soranowoto"
botnick = "assam__"
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
print("connecting to:"+server)
irc.connect((server, 6667))
irc.send(bytes("NICK "+ botnick +"\n", encoding='utf8'))
irc.send(bytes("PASS PekoRrat\n", encoding='utf8'))
irc.send(bytes("USER "+ botnick +" " + "assam assam " + "assam\n", encoding='utf8'))
time.sleep(5)
irc.send(bytes("JOIN "+ channel +"\n", encoding='utf8'))
while 1:
text=irc.recv(2040)
print(text)
if text.find(bytes('PING', encoding='utf8')) != -1: #check if 'PING' is found
irc.send(bytes('PONG ', encoding='utf8') + text.split()[1] + bytes('\r\n', encoding='utf8') )

View File

@ -1,26 +0,0 @@
import socket, string, time, thread
SERVER = 'irc.rizon.net'
PORT = 6667
NICKNAME = 'GataGoto'
CHANNEL = '#soranowoto'
def main():
global IRC
IRC = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
IRC.connect((SERVER, PORT))
thread.start_new_thread(Listener(),("Thread No:1",2))
def send_data(command):
IRC.send(command + '\n')
def Listener():
send_data('USER Blah')
send_data('NICK Blah')
while (1):
buffer = IRC.recv(1024)
msg = string.split(buffer)
if msg[0] == "PING":
print('Pinged!')
IRC.send("PONG %s" % msg[1] + '\n')
main()

View File

@ -4,7 +4,7 @@
inline bool _SetSocketBlockingEnabled(int fd, bool blocking); inline bool _SetSocketBlockingEnabled(int fd, bool blocking);
struct Socket *socket_create(){ struct Socket *socket_create(void){
struct Socket *self = malloc(sizeof(struct Socket)); struct Socket *self = malloc(sizeof(struct Socket));
self->queue = queue_create(); self->queue = queue_create();
return self; return self;
@ -36,7 +36,7 @@ void socket_init(struct Socket* self){
queue_init(self->queue, QUEUE_SIZE); queue_init(self->queue, QUEUE_SIZE);
} }
struct Socket *socket_init_start(){ struct Socket *socket_init_start(void){
struct Socket *sock = socket_create(); struct Socket *sock = socket_create();
socket_init(sock); socket_init(sock);
socket_listen(sock); socket_listen(sock);

View File

@ -27,13 +27,13 @@ struct Socket{
queue_t *queue; queue_t *queue;
}; };
struct Socket *socket_create(); struct Socket *socket_create(void);
void socket_init(struct Socket*); void socket_init(struct Socket*);
void socket_destroy(struct Socket*); void socket_destroy(struct Socket*);
struct Socket *socket_init_start(); struct Socket *socket_init_start(void);
void socket_listen(struct Socket*); void socket_listen(struct Socket*);
void socket_accept(); void socket_accept(struct Socket* self);
void update_queue(struct Socket*); void update_queue(struct Socket*);

View File

@ -1,6 +1,6 @@
#include "bitmap.h" #include "bitmap.h"
CharacterAtlas* makeBitmaps(){ CharacterAtlas* makeBitmaps(void){
/////// FREETYPE2 INIT /////// FREETYPE2 INIT
FT_Library ft; FT_Library ft;
if (FT_Init_FreeType(&ft)){ if (FT_Init_FreeType(&ft)){
@ -60,5 +60,3 @@ CharacterAtlas* makeBitmaps(){
return atlas; return atlas;
} }

View File

@ -34,7 +34,7 @@ typedef struct CharacterAtlas {
int hashmap[MAP_SIZE]; int hashmap[MAP_SIZE];
} CharacterAtlas; } CharacterAtlas;
CharacterAtlas *makeBitmaps(); CharacterAtlas *makeBitmaps(void);
#endif #endif

View File

@ -45,7 +45,7 @@ void player_init(struct Player *self) {
check_error(mpv_set_option(self->handle, "osc", MPV_FORMAT_FLAG, &val)); check_error(mpv_set_option(self->handle, "osc", MPV_FORMAT_FLAG, &val));
} }
struct Player* player_create() { struct Player* player_create(void) {
return malloc(sizeof(struct Player)); return malloc(sizeof(struct Player));
} }

View File

@ -15,7 +15,7 @@ struct Player {
mpv_render_context *ctx; mpv_render_context *ctx;
}; };
struct Player* player_create(); struct Player* player_create(void);
void player_init(struct Player *self); void player_init(struct Player *self);
void player_destroy(struct Player *self); void player_destroy(struct Player *self);

View File

@ -20,7 +20,7 @@ float quadVertices[] = {
int fbo_width = 1920; int fbo_width = 1920;
int fbo_height = 1080; int fbo_height = 1080;
struct Renderer* renderer_create() { struct Renderer* renderer_create(void) {
return malloc(sizeof(struct Renderer)); return malloc(sizeof(struct Renderer));
} }

View File

@ -47,7 +47,7 @@ struct Renderer{
CharacterAtlas *atlas; CharacterAtlas *atlas;
}; };
struct Renderer* renderer_create(); struct Renderer* renderer_create(void);
void renderer_init(struct Renderer *self); void renderer_init(struct Renderer *self);
void renderer_destroy(struct Renderer *self); void renderer_destroy(struct Renderer *self);

View File

@ -1,6 +1,6 @@
#include "vao.h" #include "vao.h"
struct VAO vao_create() { struct VAO vao_create(void) {
struct VAO self; struct VAO self;
glGenVertexArrays(1, &self.handle); glGenVertexArrays(1, &self.handle);
return self; return self;

View File

@ -9,7 +9,7 @@ struct VAO {
GLuint handle; GLuint handle;
}; };
struct VAO vao_create(); struct VAO vao_create(void);
void vao_destroy(struct VAO self); void vao_destroy(struct VAO self);
void vao_bind(struct VAO self); void vao_bind(struct VAO self);

View File

@ -3,11 +3,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
static void _init(); static void _init(void);
static void _update(); static void _update(void);
static void _render(); static void _render(void);
static void _destroy(); static void _destroy(void);
static void _tick(); static void _tick(void);
static void _size_callback(GLFWwindow *handle, int width, int height); static void _size_callback(GLFWwindow *handle, int width, int height);
static void _error_callback(int code, const char *description); static void _error_callback(int code, const char *description);
@ -65,7 +65,7 @@ struct Window *window_create(FWindow init, FWindow destroy, FWindow tick, FWind
return window; return window;
} }
void window_loop() { void window_loop(void) {
_init(); _init();
while (!glfwWindowShouldClose(window->handle)) { while (!glfwWindowShouldClose(window->handle)) {
@ -121,27 +121,27 @@ static void _error_callback(int code, const char *description) {
fprintf(stderr, "GLFW error %d: %s\n", code, description); fprintf(stderr, "GLFW error %d: %s\n", code, description);
} }
static void _init() { static void _init(void) {
window->init(); window->init();
} }
static void _destroy() { static void _destroy(void) {
window->destroy(); window->destroy();
player_destroy(player); player_destroy(player);
renderer_destroy(renderer); renderer_destroy(renderer);
glfwTerminate(); glfwTerminate();
} }
static void _tick() { static void _tick(void) {
window->ticks++; window->ticks++;
window->tick(); window->tick();
} }
static void _update() { static void _update(void) {
window->update(); window->update();
} }
static void _render() { static void _render(void) {
window->frames++; window->frames++;
window->render(); window->render();
} }

View File

@ -27,7 +27,7 @@ struct Button {
}; };
typedef void (*FWindow)(); typedef void (*FWindow)(void);
struct Window { struct Window {
GLFWwindow *handle; GLFWwindow *handle;
@ -40,6 +40,6 @@ struct Window {
u64 ticks, tps, tick_remainder; u64 ticks, tps, tick_remainder;
}; };
void window_loop(); void window_loop(void);
struct Window *window_create(FWindow init, FWindow destroy, FWindow tick, FWindow update, FWindow render); struct Window *window_create(FWindow init, FWindow destroy, FWindow tick, FWindow update, FWindow render);
#endif #endif

View File

@ -2,14 +2,14 @@
bool SetSocketBlockingEnabled(int fd, bool blocking); bool SetSocketBlockingEnabled(int fd, bool blocking);
void _setup(){ void _setup(void){
sock = socket_init_start(); //sock = socket_init_start();
//window = window_create(init, destroy, tick, update, render); window = window_create(init, destroy, tick, update, render);
//player = player_create(); player = player_create();
//renderer = renderer_create(); renderer = renderer_create();
//player_init(player); player_init(player);
//renderer_init(renderer); renderer_init(renderer);
/* Glyph shenanigans */ /* Glyph shenanigans */
//mat4s transformation = glms_ortho(0.0f, (float)(window_width), 0.0f, (float)window_height, -100, 100); //mat4s transformation = glms_ortho(0.0f, (float)(window_width), 0.0f, (float)window_height, -100, 100);
@ -19,9 +19,7 @@ int main(int argc, char const *argv[]){
if (argc < 2){ return -1;} if (argc < 2){ return -1;}
_setup(); _setup();
//player_loadfile(player, argv[1]); player_loadfile(player, argv[1]);
//window_loop(); window_loop();
return 0; return 0;
} }

View File

@ -1,6 +1,6 @@
#include "safe_queue.h" #include "safe_queue.h"
queue_t *queue_create(){ queue_t *queue_create(void){
queue_t *self = malloc(sizeof(queue_t)); queue_t *self = malloc(sizeof(queue_t));
self->mutex = malloc(sizeof(pthread_mutex_t)); self->mutex = malloc(sizeof(pthread_mutex_t));
return self; return self;

View File

@ -14,7 +14,7 @@ typedef struct {
pthread_mutex_t *mutex; pthread_mutex_t *mutex;
} queue_t; } queue_t;
queue_t *queue_create(); queue_t *queue_create(void);
void queue_init(queue_t *, size_t); void queue_init(queue_t *, size_t);
void queue_destroy(queue_t *); void queue_destroy(queue_t *);
queue_t *queue_init_create(size_t); queue_t *queue_init_create(size_t);

View File

@ -4,16 +4,16 @@ static inline void _check_error(int);
static inline void _processGLFWInput(GLFWwindow *window, mpv_handle *ctx); static inline void _processGLFWInput(GLFWwindow *window, mpv_handle *ctx);
void init() { void init(void) {
} }
void destroy() { void destroy(void) {
} }
void tick() { void tick(void) {
} }
void update() { void update(void) {
_processGLFWInput(window->handle, player->handle); _processGLFWInput(window->handle, player->handle);
if (wakeup) if (wakeup)
@ -26,7 +26,7 @@ void update() {
} }
} }
void render(){ void render(void){
shader_bind(renderer->shaders[SHADER_MPV]); shader_bind(renderer->shaders[SHADER_MPV]);
vao_bind(renderer->screenVAO); vao_bind(renderer->screenVAO);
@ -66,4 +66,3 @@ static inline void _check_error(int status)
//exit(1); //exit(1);
} }
} }

View File

@ -17,10 +17,10 @@ extern int wakeup;
/* /*
Window functions Window functions
*/ */
void init(); void init(void);
void destroy(); void destroy(void);
void tick(); void tick(void);
void update(); void update(void);
void render(); void render(void);
#endif #endif