Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
merge develop into master

See merge request Scientific-IT-Systems/gr!1085
  • Loading branch information
jheinen committed May 23, 2023
2 parents 0082c33 + 06ac8fe commit 630000e
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 60 deletions.
6 changes: 3 additions & 3 deletions lib/gks/compress.c
Expand Up @@ -49,7 +49,7 @@ static int a_count;
/*
* Set up the 'byte output' routine
*/
static void char_init()
static void char_init(void)
{
a_count = 0;
}
Expand All @@ -62,7 +62,7 @@ static char accum[256];
/*
* Flush the packet to disk, and reset the accumulator
*/
static void flush_char()
static void flush_char(void)
{
int i;

Expand Down Expand Up @@ -152,7 +152,7 @@ static void cl_hash(register long hsize) /* reset code table */
}


static void cl_block() /* table clear for block compress */
static void cl_block(void) /* table clear for block compress */
{
/* Clear out the hash table */

Expand Down
6 changes: 3 additions & 3 deletions lib/gks/ft.c
Expand Up @@ -184,7 +184,7 @@ static size_t ft_open_font(ft_path_char_t *fname)
return size;
}

static void ft_close_all_fonts()
static void ft_close_all_fonts(void)
{
int i;
for (i = 0; i < ft_num_font_files; i++)
Expand All @@ -206,7 +206,7 @@ static const ft_path_char_t *user_font_directories[] = {

static FT_Error set_glyph(FT_Face face, FT_UInt codepoint, FT_UInt *previous, FT_Vector *pen, FT_Bool vertical,
FT_Matrix *rotation, FT_Vector *bearing, FT_Int halign, FT_GlyphSlot *glyph_slot_ptr);
static void gks_ft_init_fallback_faces();
static void gks_ft_init_fallback_faces(void);
static void utf_to_unicode(FT_Bytes str, FT_UInt *unicode_string, FT_UInt *length);
static FT_Long ft_min(FT_Long a, FT_Long b);
static FT_Long ft_max(FT_Long a, FT_Long b);
Expand Down Expand Up @@ -748,7 +748,7 @@ static ft_path_char_t *gks_ft_get_font_path(const char *font_name, const char *f
return font_path;
}

static void gks_ft_init_fallback_faces()
static void gks_ft_init_fallback_faces(void)
{
FT_Error error;
unsigned int i;
Expand Down
4 changes: 2 additions & 2 deletions lib/gks/plugin.c
Expand Up @@ -105,9 +105,9 @@ static void *load_library(const char *name)
return entry;
}

static const char *get_qt_version_string()
static const char *get_qt_version_string(void)
{
typedef const char *qversion_t();
typedef const char *qversion_t(void);
qversion_t *qVersion = NULL;

#ifdef _WIN32
Expand Down
8 changes: 4 additions & 4 deletions lib/gks/plugin/quartzplugin.m
Expand Up @@ -67,7 +67,7 @@ @implementation wss_wrapper
@synthesize wss;
@end

static bool gksterm_is_running();
static bool gksterm_is_running(void);

static void gksterm_communicate(const char *request, size_t request_len, int timeout, bool only_if_running,
void (^reply_handler)(char *, size_t))
Expand Down Expand Up @@ -104,7 +104,7 @@ static void gksterm_communicate(const char *request, size_t request_len, int tim
rc = zmq_msg_send(&message, socket, ZMQ_DONTWAIT);
}
while (rc == -1 && (errno == EINTR || errno == EAGAIN));
assert(rc == request_len);
assert((size_t)rc == request_len);
zmq_msg_close(&message);

zmq_msg_init(&message);
Expand Down Expand Up @@ -138,7 +138,7 @@ static void gksterm_communicate(const char *request, size_t request_len, int tim
zmq_ctx_term(context);
}

static bool gksterm_is_running()
static bool gksterm_is_running(void)
{
size_t request_len = 1;
char request[1];
Expand Down Expand Up @@ -175,7 +175,7 @@ static bool gksterm_is_alive(int window)
return result;
}

static int gksterm_create_window()
static int gksterm_create_window(void)
{
size_t request_len = 1;
char request[1];
Expand Down
2 changes: 1 addition & 1 deletion lib/gks/resample.c
Expand Up @@ -375,7 +375,7 @@ static void resample_vertical_rgba_nearest(const double *source_image, unsigned
}
}

static unsigned int get_default_resampling_method()
static unsigned int get_default_resampling_method(void)
{
unsigned int resample_method = GKS_K_RESAMPLE_NEAREST;
char *env;
Expand Down
6 changes: 3 additions & 3 deletions lib/gr/gr.c
Expand Up @@ -1532,7 +1532,7 @@ void gr_initgr(void)
}
}

int gr_debug()
int gr_debug(void)
{
return debug != NULL;
}
Expand Down Expand Up @@ -6300,7 +6300,7 @@ void gr_polymarker3d(int n, double *px, double *py, double *pz)
}
}

static double text3d_get_height()
static double text3d_get_height(void)
{
double focus_point_x, focus_point_y, focus_point_z, focus_up_x, focus_up_y, focus_up_z;
/* Calculate char height */
Expand Down Expand Up @@ -14332,7 +14332,7 @@ static void ray_casting_thread(void *arg)
}
}

static int system_processor_count()
static int system_processor_count(void)
{
#ifdef _WIN32
#ifndef _SC_NPROCESSORS_ONLN
Expand Down
5 changes: 0 additions & 5 deletions lib/gr/image.c
Expand Up @@ -16,7 +16,6 @@ static int read_jpeg_image(char *path, int *width, int *height, int **data)
{
FILE *stream;
unsigned int i;
int x, y;
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
JSAMPARRAY buffer;
Expand All @@ -40,11 +39,9 @@ static int read_jpeg_image(char *path, int *width, int *height, int **data)
row_stride = cinfo.output_width * cinfo.output_components;
buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr)&cinfo, JPOOL_IMAGE, row_stride, 1);
bpix = cinfo.output_components;
y = 0;
while (cinfo.output_scanline < cinfo.output_height)
{
jpeg_read_scanlines(&cinfo, buffer, 1);
x = 0;
for (i = 0; i < bpix * cinfo.output_width; i += bpix)
{
r = buffer[0][i];
Expand All @@ -55,9 +52,7 @@ static int read_jpeg_image(char *path, int *width, int *height, int **data)
else
a = 255 << 24;
*dataP++ = r | g | b | a;
x++;
}
y++;
}
jpeg_finish_decompress(&cinfo);

Expand Down
14 changes: 7 additions & 7 deletions lib/gr/mathtex2.c
Expand Up @@ -986,7 +986,7 @@ extern enum State state;
extern const char *symbol_start;
extern int ignore_whitespace;

int yyparse();
int yyparse(void);

int has_parser_error = 0;

Expand Down Expand Up @@ -1016,9 +1016,9 @@ size_t result_box_model_node_index;
size_t current_box_model_state_index = 0;
size_t result_parser_node_index;

static void push_state();
static void push_state(void);

static BoxModelState *get_current_state()
static BoxModelState *get_current_state(void)
{
if (current_box_model_state_index == 0)
{
Expand All @@ -1028,7 +1028,7 @@ static BoxModelState *get_current_state()
return get_box_model_state(current_box_model_state_index);
}

static void push_state()
static void push_state(void)
{
BoxModelState new_state;
if (current_box_model_state_index)
Expand All @@ -1049,7 +1049,7 @@ static void push_state()
current_box_model_state_index = copy_box_model_state(new_state);
}

static void pop_state()
static void pop_state(void)
{
if (current_box_model_state_index == 0)
{
Expand Down Expand Up @@ -1260,7 +1260,7 @@ static size_t make_glue(GlueType type)
return copy_box_model_node(bm_node);
}

static size_t make_vlist()
static size_t make_vlist(void)
{
BoxModelNode bm_node;
bm_node.index = 0;
Expand Down Expand Up @@ -1446,7 +1446,7 @@ static void pack_vlist(size_t vlist_index, double h, int m, double l)
}
}

static size_t make_hlist()
static size_t make_hlist(void)
{
BoxModelNode bm_node;
bm_node.index = 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/gr3/gr3.h
Expand Up @@ -141,7 +141,7 @@ GR3API const char *gr3_getrenderpathstring(void);
GR3API const char *gr3_geterrorstring(int error);
GR3API void gr3_setlogcallback(void (*gr3_log_func)(const char *log_message));
GR3API int gr3_clear(void);
GR3API void gr3_usecurrentframebuffer();
GR3API void gr3_usecurrentframebuffer(void);
GR3API void gr3_useframebuffer(unsigned int framebuffer);

GR3API int gr3_setquality(int quality);
Expand Down Expand Up @@ -275,7 +275,7 @@ GR3API int gr3_setlightsources(int num_lights, float *positions, float *colors);

GR3API void gr3_setlightparameters(float ambient, float diffuse, float specular, float specular_power);
GR3API void gr3_getlightparameters(float *ambient, float *diffuse, float *specular, float *specular_power);
GR3API void gr3_setdefaultlightparameters();
GR3API void gr3_setdefaultlightparameters(void);

GR3API int gr3_getalphamode(int *mode);
GR3API void gr3_setalphamode(int mode);
Expand Down
2 changes: 1 addition & 1 deletion lib/gr3/gr3_slices.c
Expand Up @@ -7,7 +7,7 @@
#define SLICE_OFFSET 0.001

static float colormap[768];
static float *getcolormap()
static float *getcolormap(void)
{
int i;
for (i = 0; i < 255; i++)
Expand Down
4 changes: 2 additions & 2 deletions lib/gr3/gr3_sr.c
Expand Up @@ -903,7 +903,7 @@ static float triangle_surface_2d(float dif_a_b_x, float dif_a_b_y, float ay, flo
* because the main thread needs its own core. The software-renderer is initialised and the method get_pixmap
* can be invoked.
*/
GR3API int gr3_initSR_()
GR3API int gr3_initSR_(void)
{
#ifdef _WIN32
#ifndef _SC_NPROCESSORS_ONLN
Expand Down Expand Up @@ -2498,7 +2498,7 @@ static void downsample(unsigned char *pixels_high, unsigned char *pixels_low, in
/*!
* Terminates the software-renderer and deletes all the memory that was allocated to use it.
* */
GR3API void gr3_terminateSR_()
GR3API void gr3_terminateSR_(void)
{
int i;
args *arg;
Expand Down
4 changes: 2 additions & 2 deletions lib/gr3/gr3_sr.h
Expand Up @@ -119,8 +119,8 @@ typedef struct
float *alphas;
} args;

GR3API int gr3_initSR_();
GR3API int gr3_initSR_(void);
GR3API void gr3_getpixmap_softwarerendered(char *pixmap, int width, int height, int ssaa_factor);
GR3API void gr3_terminateSR_();
GR3API void gr3_terminateSR_(void);

#endif
9 changes: 7 additions & 2 deletions lib/grm/grplot/grplot_widget.cxx
Expand Up @@ -20,6 +20,10 @@
#include "grplot_widget.hxx"
#include "util.hxx"

#ifndef GR_UNUSED
#define GR_UNUSED(x) (void)(x)
#endif

static std::string file_export;

void getMousePos(QMouseEvent *event, int *x, int *y)
Expand Down Expand Up @@ -58,7 +62,7 @@ extern "C" void cmd_callback_wrapper(const grm_event_t *event)


GRPlotWidget::GRPlotWidget(QMainWindow *parent, int argc, char **argv)
: QWidget(parent), args_(nullptr), rubberBand(nullptr), pixmap(), redraw_pixmap(false)
: QWidget(parent), pixmap(), redraw_pixmap(false), args_(nullptr), rubberBand(nullptr)
{
const char *kind;
unsigned int z_length;
Expand Down Expand Up @@ -278,7 +282,6 @@ void GRPlotWidget::collectTooltips()

if (keyboard_modifiers == Qt::ShiftModifier)
{
unsigned int current_tooltips_count;
auto accumulated_tooltip = grm_get_accumulated_tooltip_x(mouse_pos.x(), mouse_pos.y());
tooltips.clear();
tooltips.push_back(accumulated_tooltip);
Expand Down Expand Up @@ -473,6 +476,7 @@ void GRPlotWidget::keyPressEvent(QKeyEvent *event)

void GRPlotWidget::keyReleaseEvent(QKeyEvent *event)
{
GR_UNUSED(event);
collectTooltips();
update();
}
Expand Down Expand Up @@ -597,6 +601,7 @@ void GRPlotWidget::wheelEvent(QWheelEvent *event)

void GRPlotWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
GR_UNUSED(event);
grm_args_t *args = grm_args_new();
QPoint pos = mapFromGlobal(QCursor::pos());
grm_args_push(args, "key", "s", "r");
Expand Down
8 changes: 4 additions & 4 deletions lib/grm/grplot/grplot_widget.hxx
Expand Up @@ -105,21 +105,21 @@ private:
{
if (holds_alternative<grm_accumulated_tooltip_info_t>())
{
auto &accumulated_tooltip = get<grm_accumulated_tooltip_info_t>();
auto accumulated_tooltip = get<grm_accumulated_tooltip_info_t>();
std::free(accumulated_tooltip->y);
std::free(accumulated_tooltip->ylabels);
}
std::visit([](auto *x) { std::free(x); }, tooltip_);
}

template <typename T> T *&get() { return std::get<T *>(tooltip_); };
template <typename T> const T *const &get() const { return std::get<T *>(tooltip_); };
template <typename T> T *get() { return std::get<T *>(tooltip_); };
template <typename T> const T *get() const { return std::get<T *>(tooltip_); };

template <typename T> bool holds_alternative() const { return std::holds_alternative<T *>(tooltip_); };

int n() const
{
return std::visit(util::overloaded{[](const grm_tooltip_info_t *tooltip) { return 1; },
return std::visit(util::overloaded{[](const grm_tooltip_info_t *) { return 1; },
[](const grm_accumulated_tooltip_info_t *tooltip) { return tooltip->n; }},
tooltip_);
};
Expand Down
5 changes: 1 addition & 4 deletions lib/grm/src/grm/import.cxx
Expand Up @@ -130,7 +130,7 @@ err_t read_data_file(const std::string &path, std::vector<std::vector<std::vecto

/* read the columns from the colms string also converts slicing into numbers */
std::stringstream scol(colms);
for (size_t col = 0; std::getline(scol, token, ',') && token.length(); col++)
while (std::getline(scol, token, ',') && token.length())
{
if (token.find(':') != std::string::npos)
{
Expand Down Expand Up @@ -722,10 +722,7 @@ int grm_interactive_plot_from_file(grm_args_t *args, int argc, char **argv)
{
std::vector<double> x(rows);
double xmin, xmax, ymin, ymax;
char *orientation;
grm_args_t *error;
char **xlabels;
unsigned int num_xlabels;

if (strcmp(kind, "barplot") == 0)
{
Expand Down
13 changes: 1 addition & 12 deletions lib/grm/src/grm/json.c
Expand Up @@ -1160,27 +1160,16 @@ err_t tojson_stringify_args_value(memwriter_t *memwriter, grm_args_t *args)

int tojson_get_member_count(const char *data_desc)
{
int nested_level = 0;
int member_count = 0;
if (data_desc == NULL || *data_desc == '\0')
{
return 0;
}
while (*data_desc != 0)
{
switch (*data_desc)
if (*data_desc == ',')
{
case '(':
++nested_level;
break;
case ')':
--nested_level;
break;
case ',':
++member_count;
break;
default:
break;
}
++data_desc;
}
Expand Down

0 comments on commit 630000e

Please sign in to comment.