Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand tab to spaces #3210

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

# properties
[*.{h,c,hpp,cpp,m,java}]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this config won't work with VS Code? (see internal discussion email)

Also, perhaps add note in the PR what editors you have tested with and which work and which doesn't, in terms of viewing and adding/editing code, so users know what to expect.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work after the tab is expanded to spaces. It's not going to work if spaces is still use in the code.

3 changes: 1 addition & 2 deletions pjlib-util/include/pjlib-util.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* $Id$ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <[email protected]>
Expand Down Expand Up @@ -72,5 +71,5 @@
#include <pjlib-util/cli_console.h>
#include <pjlib-util/cli_telnet.h>

#endif /* __PJLIB_UTIL_H__ */
#endif /* __PJLIB_UTIL_H__ */

31 changes: 15 additions & 16 deletions pjlib-util/include/pjlib-util/base64.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* $Id$ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <[email protected]>
Expand Down Expand Up @@ -40,44 +39,44 @@ PJ_BEGIN_DECL
* Helper macro to calculate the approximate length required for base256 to
* base64 conversion.
*/
#define PJ_BASE256_TO_BASE64_LEN(len) (len * 4 / 3 + 3)
#define PJ_BASE256_TO_BASE64_LEN(len) (len * 4 / 3 + 3)

/**
* Helper macro to calculate the approximage length required for base64 to
* base256 conversion.
*/
#define PJ_BASE64_TO_BASE256_LEN(len) (len * 3 / 4)
#define PJ_BASE64_TO_BASE256_LEN(len) (len * 3 / 4)


/**
* Encode a buffer into base64 encoding.
*
* @param input The input buffer.
* @param input The input buffer.
* @param in_len Size of the input buffer.
* @param output Output buffer. Caller must allocate this buffer with
* the appropriate size.
* the appropriate size.
* @param out_len On entry, it specifies the length of the output buffer.
* Upon return, this will be filled with the actual
* length of the output buffer.
* Upon return, this will be filled with the actual
* length of the output buffer.
*
* @return PJ_SUCCESS on success.
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pj_base64_encode(const pj_uint8_t *input, int in_len,
char *output, int *out_len);
char *output, int *out_len);


/**
* Decode base64 string.
*
* @param input Input string.
* @param out Buffer to store the output. Caller must allocate
* this buffer with the appropriate size.
* @param input Input string.
* @param out Buffer to store the output. Caller must allocate
* this buffer with the appropriate size.
* @param out_len On entry, it specifies the length of the output buffer.
* Upon return, this will be filled with the actual
* length of the output.
* Upon return, this will be filled with the actual
* length of the output.
*/
PJ_DECL(pj_status_t) pj_base64_decode(const pj_str_t *input,
pj_uint8_t *out, int *out_len);
pj_uint8_t *out, int *out_len);



Expand All @@ -88,5 +87,5 @@ PJ_DECL(pj_status_t) pj_base64_decode(const pj_str_t *input,
PJ_END_DECL


#endif /* __PJLIB_UTIL_BASE64_H__ */
#endif /* __PJLIB_UTIL_BASE64_H__ */

169 changes: 84 additions & 85 deletions pjlib-util/include/pjlib-util/cli.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* $Id$ */
/*
* Copyright (C) 2010 Teluu Inc. (http://www.teluu.com)
*
Expand Down Expand Up @@ -60,10 +59,10 @@ PJ_BEGIN_DECL
</CMD>
</CMD>
<CMD name='disable_codec' id=0 desc="">
<ARG name='codec_list' type='choice' id='3'>
<CHOICE value='g711'/>
<CHOICE value='g722'/>
</ARG>
<ARG name='codec_list' type='choice' id='3'>
<CHOICE value='g711'/>
<CHOICE value='g722'/>
</ARG>
</CMD>
\endverbatim
*/
Expand Down Expand Up @@ -299,10 +298,10 @@ typedef pj_status_t (*pj_cli_cmd_handler)(pj_cli_cmd_val *cval);
* Write a log message to the CLI application. The CLI application
* will send the log message to all the registered front-ends.
*
* @param cli The CLI application instance.
* @param level Verbosity level of this message message.
* @param cli The CLI application instance.
* @param level Verbosity level of this message message.
* @param buffer The message itself.
* @param len Length of this message.
* @param len Length of this message.
*/
PJ_DECL(void) pj_cli_write_log(pj_cli_t *cli,
int level,
Expand All @@ -312,29 +311,29 @@ PJ_DECL(void) pj_cli_write_log(pj_cli_t *cli,
/**
* Create a new CLI application instance.
*
* @param cfg CLI application creation parameters.
* @param p_cli Pointer to receive the returned instance.
* @param cfg CLI application creation parameters.
* @param p_cli Pointer to receive the returned instance.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pj_cli_create(pj_cli_cfg *cfg,
pj_cli_t **p_cli);

/**
* This specifies the function to get the id of the specified command
*
* @param cmd The specified command.
* @param cmd The specified command.
*
* @return The command id
* @return The command id
*/
PJ_DECL(pj_cli_cmd_id) pj_cli_get_cmd_id(const pj_cli_cmd_spec *cmd);

/**
* Get the internal parameter of the CLI instance.
*
* @param cli The CLI application instance.
* @param cli The CLI application instance.
*
* @return CLI parameter instance.
* @return CLI parameter instance.
*/
PJ_DECL(pj_cli_cfg*) pj_cli_get_param(pj_cli_t *cli);

Expand All @@ -346,37 +345,37 @@ PJ_DECL(pj_cli_cfg*) pj_cli_get_param(pj_cli_t *cli);
* See also pj_cli_sess_end_session() to end a session instead of quitting the
* whole application.
*
* @param cli The CLI application instance.
* @param req The session on which the shutdown request is
* received.
* @param restart Indicate whether application restart is wanted.
* @param cli The CLI application instance.
* @param req The session on which the shutdown request is
* received.
* @param restart Indicate whether application restart is wanted.
*/
PJ_DECL(void) pj_cli_quit(pj_cli_t *cli, pj_cli_sess *req,
pj_bool_t restart);
pj_bool_t restart);
/**
* Check if application shutdown or restart has been requested.
*
* @param cli The CLI application instance.
* @param cli The CLI application instance.
*
* @return PJ_TRUE if pj_cli_quit() has been called.
* @return PJ_TRUE if pj_cli_quit() has been called.
*/
PJ_DECL(pj_bool_t) pj_cli_is_quitting(pj_cli_t *cli);

/**
* Check if application restart has been requested.
*
* @param cli The CLI application instance.
* @param cli The CLI application instance.
*
* @return PJ_TRUE if pj_cli_quit() has been called with
* restart parameter set.
* @return PJ_TRUE if pj_cli_quit() has been called with
* restart parameter set.
*/
PJ_DECL(pj_bool_t) pj_cli_is_restarting(pj_cli_t *cli);

/**
* Destroy a CLI application instance. This would also close all sessions
* currently running for this CLI application.
*
* @param cli The CLI application.
* @param cli The CLI application.
*/
PJ_DECL(void) pj_cli_destroy(pj_cli_t *cli);

Expand All @@ -390,8 +389,8 @@ PJ_DECL(void) pj_cli_cfg_default(pj_cli_cfg *param);
/**
* Register a front end to the CLI application.
*
* @param cli The CLI application.
* @param fe The CLI front end to be registered.
* @param cli The CLI application.
* @param fe The CLI front end to be registered.
*/
PJ_DECL(void) pj_cli_register_front_end(pj_cli_t *cli,
pj_cli_front_end *fe);
Expand All @@ -402,44 +401,44 @@ PJ_DECL(void) pj_cli_register_front_end(pj_cli_t *cli,
*
* Note that the input string MUST be NULL terminated.
*
* @param cli The CLI application.
* @param group Optional group to which this command will be added
* to, or specify NULL if this command is a root
* command.
* @param xml Input string containing XML node text for the
* command, MUST be NULL terminated.
* @param handler Function handler for the command. This must be NULL
* if the command specifies a command group.
* @param p_cmd Optional pointer to store the newly created
* specification.
* @param get_choice Function handler for the argument. Specify this for
* dynamic choice type arguments.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
* @param cli The CLI application.
* @param group Optional group to which this command will be added
* to, or specify NULL if this command is a root
* command.
* @param xml Input string containing XML node text for the
* command, MUST be NULL terminated.
* @param handler Function handler for the command. This must be NULL
* if the command specifies a command group.
* @param p_cmd Optional pointer to store the newly created
* specification.
* @param get_choice Function handler for the argument. Specify this for
* dynamic choice type arguments.
*
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pj_cli_add_cmd_from_xml(pj_cli_t *cli,
pj_cli_cmd_spec *group,
pj_cli_cmd_spec *group,
const pj_str_t *xml,
pj_cli_cmd_handler handler,
pj_cli_cmd_spec **p_cmd,
pj_cli_get_dyn_choice get_choice);
pj_cli_get_dyn_choice get_choice);
/**
* Initialize pj_cli_exec_info with its default values.
*
* @param param The param to be initialized.
* @param param The param to be initialized.
*/
PJ_DECL(void) pj_cli_exec_info_default(pj_cli_exec_info *param);

/**
* Write a log message to the specific CLI session.
*
* @param sess The CLI active session.
* @param sess The CLI active session.
* @param buffer The message itself.
* @param len Length of this message.
* @param len Length of this message.
*/
PJ_DECL(void) pj_cli_sess_write_msg(pj_cli_sess *sess,
const char *buffer,
pj_size_t len);
const char *buffer,
pj_size_t len);

/**
* Parse an input cmdline string. The first word of the command line is the
Expand All @@ -459,29 +458,29 @@ PJ_DECL(void) pj_cli_sess_write_msg(pj_cli_sess *sess,
* which will be removed by the function. However any more characters
* following this newline will cause an error to be returned.
*
* @param sess The CLI session.
* @param cmdline The command line string to be parsed.
* @param val Structure to store the parsing result.
* @param pool The pool to allocate memory from.
* @param info Additional info to be returned regarding the parsing.
*
* @return This function returns the status of the parsing,
* which can be one of the following :
* - PJ_SUCCESS: a command was executed successfully.
* - PJ_EINVAL: invalid parameter to this function.
* - PJ_ENOTFOUND: command is not found.
* - PJ_CLI_EAMBIGUOUS: command/argument is ambiguous.
* - PJ_CLI_EMISSINGARG: missing argument.
* - PJ_CLI_EINVARG: invalid command argument.
* - PJ_CLI_EEXIT: "exit" has been called to end
* the current session. This is a signal for the
* application to end it's main loop.
* @param sess The CLI session.
* @param cmdline The command line string to be parsed.
* @param val Structure to store the parsing result.
* @param pool The pool to allocate memory from.
* @param info Additional info to be returned regarding the parsing.
*
* @return This function returns the status of the parsing,
* which can be one of the following :
* - PJ_SUCCESS: a command was executed successfully.
* - PJ_EINVAL: invalid parameter to this function.
* - PJ_ENOTFOUND: command is not found.
* - PJ_CLI_EAMBIGUOUS: command/argument is ambiguous.
* - PJ_CLI_EMISSINGARG: missing argument.
* - PJ_CLI_EINVARG: invalid command argument.
* - PJ_CLI_EEXIT: "exit" has been called to end
* the current session. This is a signal for the
* application to end it's main loop.
*/
PJ_DECL(pj_status_t) pj_cli_sess_parse(pj_cli_sess *sess,
char *cmdline,
pj_cli_cmd_val *val,
pj_pool_t *pool,
pj_cli_exec_info *info);
char *cmdline,
pj_cli_cmd_val *val,
pj_pool_t *pool,
pj_cli_exec_info *info);

/**
* End the specified session, and destroy it to release all resources used
Expand All @@ -491,7 +490,7 @@ PJ_DECL(pj_status_t) pj_cli_sess_parse(pj_cli_sess *sess,
* creation process.
* See also pj_cli_quit() to quit the whole application instead.
*
* @param sess The CLI session to be destroyed.
* @param sess The CLI session to be destroyed.
*/
PJ_DECL(void) pj_cli_sess_end_session(pj_cli_sess *sess);

Expand All @@ -504,23 +503,23 @@ PJ_DECL(void) pj_cli_sess_end_session(pj_cli_sess *sess);
*
* See also pj_cli_sess_parse() for more info regarding the cmdline format.
*
* @param sess The CLI session.
* @param cmdline The command line string to be executed.
* @param pool The pool to allocate memory from.
* @param info Optional pointer to receive additional information
* related to the execution of the command (such as
* the command return value).
* @param sess The CLI session.
* @param cmdline The command line string to be executed.
* @param pool The pool to allocate memory from.
* @param info Optional pointer to receive additional information
* related to the execution of the command (such as
* the command return value).
*
* @return This function returns the status of the command
* parsing and execution (note that the return value
* of the handler itself will be returned in \a info
* argument, if specified). Please see the return value
* of pj_cli_sess_parse() for possible return values.
* @return This function returns the status of the command
* parsing and execution (note that the return value
* of the handler itself will be returned in \a info
* argument, if specified). Please see the return value
* of pj_cli_sess_parse() for possible return values.
*/
PJ_DECL(pj_status_t) pj_cli_sess_exec(pj_cli_sess *sess,
char *cmdline,
pj_pool_t *pool,
pj_cli_exec_info *info);
char *cmdline,
pj_pool_t *pool,
pj_cli_exec_info *info);

/**
* @}
Expand Down
Loading