Skip to content

Commit

Permalink
cosmetic : white spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdelnero committed Jan 19, 2025
1 parent 35a581b commit 6748f1d
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 62 deletions.
78 changes: 39 additions & 39 deletions inc/logs_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ void timestamp(char * timestr, int maxsize);

#ifdef USE_SYSLOG // Syslog usage

#define PRINT_MSG(fmt, args...) syslog(LOG_NOTICE, "[uMTPrd - Info] " fmt "\n", \
## args)
#define PRINT_MSG(fmt, args...) syslog(LOG_NOTICE, "[uMTPrd - Info] " fmt "\n", \
## args)
#define PRINT_ERROR(fmt, args...) syslog(LOG_ERR, "[uMTPrd - Error] " fmt "\n", \
## args)
## args)
#define PRINT_WARN(fmt, args...) syslog(LOG_WARNING, "[uMTPrd - Warning] " fmt "\n", \
## args)
## args)
#ifdef DEBUG

#define PRINT_DEBUG(fmt, args...) syslog(LOG_DEBUG, "[uMTPrd - Debug] " fmt "\n", \
## args)
## args)
#else

#define PRINT_DEBUG(fmt, args...)
Expand All @@ -63,42 +63,42 @@ void timestamp(char * timestr, int maxsize);

#else // Stdout usage

#define PRINT_MSG(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stdout, \
"[uMTPrd - %s - Info] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stdout); \
} while (0)

#define PRINT_ERROR(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stderr, \
"[uMTPrd - %s - Error] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stderr); \
} while (0)

#define PRINT_WARN(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stdout, \
"[uMTPrd - %s - Warning] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stdout); \
} while (0)
#define PRINT_MSG(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stdout, \
"[uMTPrd - %s - Info] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stdout); \
} while (0)

#define PRINT_ERROR(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stderr, \
"[uMTPrd - %s - Error] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stderr); \
} while (0)

#define PRINT_WARN(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stdout, \
"[uMTPrd - %s - Warning] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stdout); \
} while (0)

#ifdef DEBUG
#define PRINT_DEBUG(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stdout, \
"[uMTPrd - %s - Debug] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stdout); \
} while (0)
#define PRINT_DEBUG(fmt, args...) do { \
char timestr[32]; \
timestamp((char*)&timestr, sizeof(timestr)); \
fprintf(stdout, \
"[uMTPrd - %s - Debug] " fmt "\n",(char*)&timestr, \
## args); \
fflush(stdout); \
} while (0)
#else

#define PRINT_DEBUG(fmt, args...)
Expand Down
40 changes: 20 additions & 20 deletions src/mtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,10 @@ uint32_t mtp_add_storage(mtp_ctx * ctx, char * path, char * description, int uid

ctx->storages[i].storage_id = 0xFFFF0000 + (i + 1);
PRINT_DEBUG("mtp_add_storage : Storage %.8X mapped to %s (%s) (Flags: 0x%.8X)",
ctx->storages[i].storage_id,
ctx->storages[i].root_path,
ctx->storages[i].description,
ctx->storages[i].flags);
ctx->storages[i].storage_id,
ctx->storages[i].root_path,
ctx->storages[i].description,
ctx->storages[i].flags);

return ctx->storages[i].storage_id;
}
Expand Down Expand Up @@ -785,8 +785,8 @@ uint32_t mtp_get_storage_id_by_name(mtp_ctx * ctx, char * name)
if( !strcmp(ctx->storages[i].description, name ) )
{
PRINT_DEBUG("%s : %s -> %.8X",
__func__,
ctx->storages[i].root_path,
__func__,
ctx->storages[i].root_path,
ctx->storages[i].storage_id);

return ctx->storages[i].storage_id;
Expand All @@ -812,8 +812,8 @@ int mtp_get_storage_index_by_name(mtp_ctx * ctx, char * name)
if( !strcmp(ctx->storages[i].description, name ) )
{
PRINT_DEBUG("%s : %s -> %.8X",
__func__,
ctx->storages[i].root_path,
__func__,
ctx->storages[i].root_path,
i);

return i;
Expand All @@ -839,9 +839,9 @@ int mtp_get_storage_index_by_id(mtp_ctx * ctx, uint32_t storage_id)
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("%s : %.8X -> %d",
__func__,
storage_id,
i );
__func__,
storage_id,
i );
return i;
}
}
Expand All @@ -865,9 +865,9 @@ char * mtp_get_storage_root(mtp_ctx * ctx, uint32_t storage_id)
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("%s : %.8X -> %s",
__func__,
storage_id,
ctx->storages[i].root_path );
__func__,
storage_id,
ctx->storages[i].root_path );
return ctx->storages[i].root_path;
}
}
Expand All @@ -890,9 +890,9 @@ char * mtp_get_storage_description(mtp_ctx * ctx, uint32_t storage_id)
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("%s : %.8X -> %s",
__func__,
storage_id,
ctx->storages[i].description );
__func__,
storage_id,
ctx->storages[i].description );
return ctx->storages[i].description;
}
}
Expand All @@ -916,9 +916,9 @@ uint32_t mtp_get_storage_flags(mtp_ctx * ctx, uint32_t storage_id)
if( ctx->storages[i].storage_id == storage_id )
{
PRINT_DEBUG("%s : %.8X -> 0x%.8X",
__func__,
storage_id,
ctx->storages[i].flags );
__func__,
storage_id,
ctx->storages[i].flags );
return ctx->storages[i].flags;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mtp_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ int test_flag(char * str, char * flag, char * param)
if(!strncmp(&str[i],flag,strlen(flag)))
{
if( (previous_char == 0 || previous_char == ',') && \
(str[i + flaglen] == 0 || str[i + flaglen] == ',' || str[i + flaglen] == '=') )
(str[i + flaglen] == 0 || str[i + flaglen] == ',' || str[i + flaglen] == '=') )
{
if(param && str[i + flaglen] == '=')
{
Expand Down
2 changes: 1 addition & 1 deletion src/mtp_operations/mtp_op_getdeviceinfos.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ uint32_t mtp_op_GetDeviceInfos(mtp_ctx * ctx,MTP_PACKET_HEADER * mtp_packet_hdr,
{
int sz,tmp_sz;

// Note : From the MTP specification this operation can be used without first
// Note : From the MTP specification this operation can be used without first
// opening an MTP session by sending an OpenSession command !

sz = build_response(ctx, mtp_packet_hdr->tx_id, MTP_CONTAINER_TYPE_DATA, mtp_packet_hdr->code, ctx->wrbuffer, ctx->usb_wr_buffer_max_size,0,0);
Expand Down
2 changes: 1 addition & 1 deletion src/usbstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ int unicode2charstring(char * str, uint16_t * unicodestr, int maxstrsize)
byte_access += 2;

if(!chunksize)
{ // Error -> default character
{ // Error -> default character
tmpstr[0] = '?';
tmpstr[1] = 0;
chunksize = 1;
Expand Down

0 comments on commit 6748f1d

Please sign in to comment.