Skip to content

Commit

Permalink
Fixed unix compilation, not tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Zereges committed Aug 30, 2016
1 parent e6a83cf commit 6ecdeae
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions LaTeX.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <windows.h>
#include <errno.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#endif

#include <glib.h>

Expand Down Expand Up @@ -52,7 +58,7 @@ static char* getdirname(const char const *file)
GetCurrentDirectory(MAX_PATH, result);
return result;
#else
return get_current_dir_name();
return getcwd(NULL, 0);
#endif
}
result = (char*) malloc((occurence - file + 1) * sizeof(char));
Expand Down Expand Up @@ -165,7 +171,7 @@ char* latex_to_png(const char* full_text, size_t from, size_t len)
if (!font_size)
font_size = DEFAULT_FONTSIZE;

fprintf(tex_file, LATEX_FORMAT_STRING, bgcolor, fgcolor, len, full_text + from);
fprintf(tex_file, LATEX_FORMAT_STRING, bgcolor, fgcolor, (int) len, full_text + from);

tmp_dir = getdirname(file_tex);
if (!tmp_dir || chdir(tmp_dir))
Expand Down Expand Up @@ -247,7 +253,7 @@ static gboolean analyze(char **message, size_t from)
if (start >= length || end >= length)
break;

purple_debug_info("LaTeX", "Found occurence in msg '%s' (at %u to %u)\n", *message, start, end);
purple_debug_info("LaTeX", "Found occurence in msg '%s' (at %zu to %zu)\n", *message, start, end);
sbstr_len = end - start - strlen(LATEX_DELIMITER);
if (!(png_file = latex_to_png(*message, start + strlen(LATEX_DELIMITER), sbstr_len)))
{
Expand Down Expand Up @@ -290,7 +296,7 @@ static gboolean analyze(char **message, size_t from)
length = strlen(*message);

from = start + strlen(LATEX_DELIMITER) + img_text_len;
purple_debug_info("LaTeX", "Looking for another occurence beginning at %u\n", from);
purple_debug_info("LaTeX", "Looking for another occurence beginning at %zu\n", from);
}
return TRUE;
}
Expand Down

0 comments on commit 6ecdeae

Please sign in to comment.