Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Joris Dauphin <Jarod42@users.noreply.github.com>
  • Loading branch information
gbaudic and Jarod42 authored Nov 14, 2024
1 parent 69f62cd commit a346dc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
10 changes: 3 additions & 7 deletions include/guisan/widgets/passwordfield.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson
*
* Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
* Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a//
* Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a//
* _Qhm`] _f "'c 1!5m
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[
* .)j(] .d_/ '-( P . S
Expand Down Expand Up @@ -57,10 +57,6 @@
#ifndef GCN_PASSWORDFIELD_HPP
#define GCN_PASSWORDFIELD_HPP

#include "guisan/keylistener.hpp"
#include "guisan/mouselistener.hpp"
#include "guisan/platform.hpp"
#include "guisan/widget.hpp"
#include "guisan/widgets/textfield.hpp"

#include <string>
Expand All @@ -87,7 +83,7 @@ namespace gcn
*
* @param text the initial text.
*/
PasswordField(const std::string& text);
explicit PasswordField(const std::string& text);

// Inherited from Widget

Expand Down
12 changes: 4 additions & 8 deletions src/widgets/passwordfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson
*
* Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
* Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a//
* Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a//
* _Qhm`] _f "'c 1!5m
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[
* .)j(] .d_/ '-( P . S
Expand Down Expand Up @@ -60,10 +60,6 @@

#include "guisan/widgets/passwordfield.hpp"

#include "guisan/font.hpp"
#include "guisan/graphics.hpp"
#include "guisan/key.hpp"
#include "guisan/mouseinput.hpp"
#include "guisan/text.hpp"

namespace gcn
Expand All @@ -81,8 +77,8 @@ namespace gcn

void PasswordField::draw(Graphics* graphics)
{
std::string encodedText(mText->getRow(0).size(), '*');
std::string realText(mText->getRow(0));
const std::string realText(mText->getRow(0));
const std::string encodedText(realText.size(), '*');

// Switch replacement text before drawing it to hide it
mText->setRow(0, encodedText);
Expand Down

0 comments on commit a346dc7

Please sign in to comment.