Commit 5259cfc16113ab809d155a0cf5ed7f28d7779a9b

Authored by Hu Chunming
1 parent 5a4c4dc0

优化初始化值

Showing 1 changed file with 10 additions and 10 deletions
src/common/sy_common.h
@@ -49,8 +49,8 @@ enum sy_format { @@ -49,8 +49,8 @@ enum sy_format {
49 #define __SY_POINT__ 49 #define __SY_POINT__
50 typedef struct sy_point 50 typedef struct sy_point
51 { 51 {
52 - int x_;  
53 - int y_; 52 + int x_{0};
  53 + int y_{0};
54 sy_point(int m_x, int m_y) :x_(m_x), y_(m_y) {}; 54 sy_point(int m_x, int m_y) :x_(m_x), y_(m_y) {};
55 sy_point() {}; 55 sy_point() {};
56 } sy_point; 56 } sy_point;
@@ -62,10 +62,10 @@ typedef struct sy_point @@ -62,10 +62,10 @@ typedef struct sy_point
62 #define __SY_RECT__ 62 #define __SY_RECT__
63 typedef struct sy_rect 63 typedef struct sy_rect
64 { 64 {
65 - int left_;  
66 - int top_;  
67 - int width_;  
68 - int height_; 65 + int left_{0};
  66 + int top_{0};
  67 + int width_{0};
  68 + int height_{0};
69 sy_rect(int m_left, int m_top, int m_width, int m_height) :left_(m_left), top_(m_top), width_(m_width), height_(m_height) {}; 69 sy_rect(int m_left, int m_top, int m_width, int m_height) :left_(m_left), top_(m_top), width_(m_width), height_(m_height) {};
70 sy_rect() {}; 70 sy_rect() {};
71 } sy_rect; 71 } sy_rect;
@@ -77,10 +77,10 @@ typedef struct sy_rect @@ -77,10 +77,10 @@ typedef struct sy_rect
77 #define __SY_IMG__ 77 #define __SY_IMG__
78 typedef struct sy_img 78 typedef struct sy_img
79 { 79 {
80 - unsigned char * data_;  
81 - int w_;  
82 - int h_;  
83 - int c_; 80 + unsigned char * data_{nullptr};
  81 + int w_{0};
  82 + int h_{0};
  83 + int c_{0};
84 void set_data(int m_w, int m_h, int m_c, unsigned char * m_data) 84 void set_data(int m_w, int m_h, int m_c, unsigned char * m_data)
85 { 85 {
86 w_ = m_w; 86 w_ = m_w;