Skip to content

Commit

Permalink
wesnothd/fuh: Fix instances of std::string initialized from time_t(0)
Browse files Browse the repository at this point in the history
Fixes the build with the fuh enabled on clang 3.3:

> src/server/forum_user_handler.cpp:206:10: error: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Werror,-Wnon-literal-null-conversion]
>   return time_t(0);
>          ^~~~~~~~~
> src/server/forum_user_handler.cpp:215:10: error: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Werror,-Wnon-literal-null-conversion]
>   return time_t(0);
>          ^~~~~~~~~

A time_t(0) is cast equivalently to a null pointer, and an empty C
string is equivalent to a null pointer for std::string instantiation.
  • Loading branch information
irydacea committed Jun 27, 2014
1 parent fe38514 commit 8222193
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/forum_user_handler.cpp
Expand Up @@ -205,7 +205,7 @@ std::string fuh::get_hash(const std::string& user) {
return get_detail_for_user(user, "user_password");
} catch (error& e) {
ERR_UH << "Could not retrieve password for user '" << user << "' :" << e.message << std::endl;
return time_t(0);
return "";
}
}

Expand All @@ -214,7 +214,7 @@ std::string fuh::get_mail(const std::string& user) {
return get_detail_for_user(user, "user_email");
} catch (error& e) {
ERR_UH << "Could not retrieve email for user '" << user << "' :" << e.message << std::endl;
return time_t(0);
return "";
}
}

Expand Down

0 comments on commit 8222193

Please sign in to comment.