Skip to content

Commit

Permalink
add get_priority_string to windows def
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackb18b committed Oct 3, 2024
1 parent a5d52c5 commit 3086770
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/prival.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ stumpless_get_priority_string( int prival ) {
priority_string_size = ( len_severity + len_facility + 2);
priority_string = alloc_mem( priority_string_size );

memcpy( priority_string, severity , len_severity);
memcpy( priority_string + len_severity, ".", 1);
memcpy( priority_string + len_severity + 1, facility, len_facility);
memcpy( priority_string + len_severity + 1 + len_facility, "\0", 1);
memcpy( priority_string, facility , len_facility);
priority_string[len_severity] = '.';
memcpy( priority_string + len_facility + 1, severity, len_severity);
priority_string[priority_string_size-1] = "\0";

return priority_string;
}
Expand Down
1 change: 1 addition & 0 deletions src/windows/stumpless.def
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,4 @@ EXPORTS

stumpless_get_prival_string @230
stumpless_set_severity_color @231
stumpless_get_priority_string @232
2 changes: 1 addition & 1 deletion test/function/prival.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace {

prival = STUMPLESS_SEVERITY_ERR | STUMPLESS_FACILITY_USER;
result = stumpless_get_priority_string( prival );
EXPECT_STREQ( result, "STUMPLESS_SEVERITY_ERR.STUMPLESS_FACILITY_USER" );
EXPECT_STREQ( result, "STUMPLESS_FACILITY_USER.STUMPLESS_SEVERITY_ERR" );

free( ( void * ) result );
}
Expand Down

0 comments on commit 3086770

Please sign in to comment.