Kouhei Sutou
null+****@clear*****
Fri Feb 3 11:10:11 JST 2017
Kouhei Sutou 2017-02-03 11:10:11 +0900 (Fri, 03 Feb 2017) New Revision: 643dc6427c2425b2c0ddb3a676a3c1f6a2ccbfc7 https://github.com/groonga/groonga/commit/643dc6427c2425b2c0ddb3a676a3c1f6a2ccbfc7 Message: Move Windows related function to windows.c Copied files: lib/grn_windows.h (from lib/grn_util.h) Modified files: lib/error.c lib/grn_util.h lib/sources.am lib/util.c lib/windows.c lib/windows_event_logger.c Modified: lib/error.c (+3 -2) =================================================================== --- lib/error.c 2017-02-03 11:03:13 +0900 (d6d14ff) +++ lib/error.c 2017-02-03 11:10:11 +0900 (92bb15c) @@ -1,5 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ -/* Copyright(C) 2013 Brazil +/* + Copyright(C) 2013-2017 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,7 +17,7 @@ */ #include "grn_error.h" -#include "grn_util.h" +#include "grn_windows.h" #ifdef HAVE_ERRNO_H #include <errno.h> Modified: lib/grn_util.h (+0 -4) =================================================================== --- lib/grn_util.h 2017-02-03 11:03:13 +0900 (08d77d1) +++ lib/grn_util.h 2017-02-03 11:10:11 +0900 (38dbd8d) @@ -40,10 +40,6 @@ void grn_p_record(grn_ctx *ctx, grn_obj *table, grn_id id); int grn_mkstemp(char *path_template); grn_bool grn_path_exist(const char *path); -#ifdef WIN32 -GRN_API UINT grn_windows_encoding_to_code_page(grn_encoding encoding); -#endif /* WIN32 */ - #ifdef __cplusplus } #endif Copied: lib/grn_windows.h (+1 -17) 58% =================================================================== --- lib/grn_util.h 2017-02-03 11:03:13 +0900 (08d77d1) +++ lib/grn_windows.h 2017-02-03 11:10:11 +0900 (dd80aa5) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2010-2016 Brazil + Copyright(C) 2010-2017 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -19,27 +19,11 @@ #pragma once #include "grn.h" -#include "grn_ctx.h" #ifdef __cplusplus extern "C" { #endif -GRN_API grn_rc grn_normalize_offset_and_limit(grn_ctx *ctx, int size, int *offset, int *limit); - -GRN_API char *grn_path_separator_to_system(char *dest, char *groonga_path); - -void grn_p_record(grn_ctx *ctx, grn_obj *table, grn_id id); - -/* - * grn_mkstemp generates a unique filename from path_template, creates a - * file with permissions 0600 and returns a open file desciptor for the file. - * The last 6 bytes of path_template must be "XXXXXX" and these are replaced - * with a string that makes the filename unique. - */ -int grn_mkstemp(char *path_template); -grn_bool grn_path_exist(const char *path); - #ifdef WIN32 GRN_API UINT grn_windows_encoding_to_code_page(grn_encoding encoding); #endif /* WIN32 */ Modified: lib/sources.am (+1 -0) =================================================================== --- lib/sources.am 2017-02-03 11:03:13 +0900 (d5e4f26) +++ lib/sources.am 2017-02-03 11:10:11 +0900 (6576af3) @@ -94,6 +94,7 @@ libgroonga_la_SOURCES = \ util.c \ grn_util.h \ windows.c \ + grn_windows.h \ windows_event_logger.c \ file_reader.c \ window_function.c \ Modified: lib/util.c (+0 -31) =================================================================== --- lib/util.c 2017-02-03 11:03:13 +0900 (7b4b5ea) +++ lib/util.c 2017-02-03 11:10:11 +0900 (62bb03c) @@ -1572,34 +1572,3 @@ grn_path_exist(const char *path) struct stat status; return stat(path, &status) == 0; } - -#ifdef WIN32 -UINT -grn_windows_encoding_to_code_page(grn_encoding encoding) -{ - UINT code_page; - - switch (encoding) { - case GRN_ENC_EUC_JP : - code_page = 20932; - break; - case GRN_ENC_UTF8 : - code_page = CP_UTF8; - break; - case GRN_ENC_SJIS : - code_page = 932; - break; - case GRN_ENC_LATIN1 : - code_page = 1252; - break; - case GRN_ENC_KOI8R : - code_page = 20866; - break; - default : - code_page = CP_ACP; - break; - } - - return code_page; -} -#endif /* WIN32 */ Modified: lib/windows.c (+32 -2) =================================================================== --- lib/windows.c 2017-02-03 11:03:13 +0900 (a4942d9) +++ lib/windows.c 2017-02-03 11:10:11 +0900 (83a1d49) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2010-2015 Brazil + Copyright(C) 2010-2017 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,7 @@ */ #include "grn.h" +#include "grn_windows.h" #ifdef WIN32 static char *windows_base_dir = NULL; @@ -71,4 +72,33 @@ grn_windows_base_dir(void) } return windows_base_dir; } -#endif + +UINT +grn_windows_encoding_to_code_page(grn_encoding encoding) +{ + UINT code_page; + + switch (encoding) { + case GRN_ENC_EUC_JP : + code_page = 20932; + break; + case GRN_ENC_UTF8 : + code_page = CP_UTF8; + break; + case GRN_ENC_SJIS : + code_page = 932; + break; + case GRN_ENC_LATIN1 : + code_page = 1252; + break; + case GRN_ENC_KOI8R : + code_page = 20866; + break; + default : + code_page = CP_ACP; + break; + } + + return code_page; +} +#endif /* WIN32 */ Modified: lib/windows_event_logger.c (+2 -2) =================================================================== --- lib/windows_event_logger.c 2017-02-03 11:03:13 +0900 (2a4001c) +++ lib/windows_event_logger.c 2017-02-03 11:10:11 +0900 (d7447e7) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2015 Brazil + Copyright(C) 2015-2017 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,7 @@ #include "grn_logger.h" #include "grn_ctx.h" -#include "grn_util.h" +#include "grn_windows.h" #include <string.h> -------------- next part -------------- HTML����������������������������...Download