Skip to content

Commit

Permalink
Changed constant strings' type from * to [].
Browse files Browse the repository at this point in the history
Prevent using sizeof to return unexpected value.
  • Loading branch information
JasonYang-MSFT committed Feb 21, 2017
1 parent d7bf2a9 commit f5cd2b4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace azure { namespace storage { namespace protocol {
const int maximum_share_quota(5120);

#define _CONSTANTS
#define DAT(a, b) extern WASTORAGE_API const utility::char_t* a; const size_t a ## _size = sizeof(b) / sizeof(utility::char_t) - 1;
#define DAT(a, b) WASTORAGE_API extern const utility::char_t a[]; const size_t a ## _size = sizeof(b) / sizeof(utility::char_t) - 1;
#include "constants.dat"
#undef DAT
#undef _CONSTANTS
Expand Down
1 change: 1 addition & 0 deletions Microsoft.WindowsAzure.Storage/includes/wascore/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "util.h"
#include "streams.h"
#include "was/auth.h"
#include "wascore/constants.h"
#include "wascore/resources.h"

namespace azure { namespace storage { namespace core {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "stdafx.h"
#include "wascore/protocol.h"
#include "wascore/constants.h"

namespace azure { namespace storage { namespace protocol {

Expand Down
3 changes: 2 additions & 1 deletion Microsoft.WindowsAzure.Storage/src/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
// -----------------------------------------------------------------------------------------

#include "stdafx.h"
#include "wascore/constants.h"
#include "wascore/basic_types.h"

namespace azure { namespace storage { namespace protocol {

#define _CONSTANTS
#define DAT(a, b) WASTORAGE_API const utility::char_t* a = b;
#define DAT(a, b) WASTORAGE_API const utility::char_t a[] = b;
#include "wascore/constants.dat"
#undef DAT
#undef _CONSTANTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "stdafx.h"
#include "wascore/protocol.h"
#include "wascore/constants.h"

namespace azure { namespace storage { namespace protocol {

Expand Down
1 change: 1 addition & 0 deletions Microsoft.WindowsAzure.Storage/src/resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// -----------------------------------------------------------------------------------------

#include "stdafx.h"
#include "wascore/resources.h"
#include "wascore/basic_types.h"

namespace azure { namespace storage { namespace protocol {
Expand Down

0 comments on commit f5cd2b4

Please sign in to comment.