Broken character encoding in lwip source code / 关于LwIP开源代码中那些乱码【・_・?】

yssz
Posts: 3
Joined: Sun May 08, 2016 7:24 pm

Broken character encoding in lwip source code / 关于LwIP开源代码中那些乱码【・_・?】

Postby yssz » Wed Sep 07, 2016 12:15 am

e.g.
file: esp8266_nonos_sdk_v2.0.0_16_07_19\ESP8266_NONOS_SDK\examples\lwip_open_src_template_proj\lwip\core\tcp.c
line: 662,683,687...

The last normal tcp.c is esp_iot_sdk_v0.9.2_14_10_24.
Broken character encoding introduced in esp_iot_sdk_v0.9.3_14_11_21.
The latest(ESP8266_NONOS_SDK_V2.0.0_16_07_19) too...

Same thing happened when my colleague try to modify my utf8 source in a gbk editor.
原因我就不猜了,因为有同事曾经用GBK的编辑器修改我UTF8的代码文件出过类似的事……
(英文烂所以任性)

ESP_Rubin
Posts: 222
Joined: Wed Jun 29, 2016 11:59 am

Re: Broken character encoding in lwip source code / 关于LwIP开源代码中那些乱码【・_・?】

Postby ESP_Rubin » Wed Sep 07, 2016 10:17 am

你的问题是什么?

yssz
Posts: 3
Joined: Sun May 08, 2016 7:24 pm

Re: Broken character encoding in lwip source code / 关于LwIP开源代码中那些乱码【・_・?】

Postby yssz » Wed Sep 07, 2016 9:09 pm

Code: Select all

git diff app/lwip/core/tcp.c
diff --git a/app/lwip/core/tcp.c b/app/lwip/core/tcp.c
index 362b396..f22dbfd 100644
--- a/app/lwip/core/tcp.c
+++ b/app/lwip/core/tcp.c
@@ -107,7 +107,7 @@ struct tcp_pcb *tcp_tmp_pcb;
 
 /** Timer counter to handle calling slow-timer from tcp_tmr() */
 static u8_t tcp_timer;
-static u16_t tcp_new_port(void);//【・_・?】
+static u16_t tcp_new_port(void);//生成新的tcp本地端口
 
 /**
  * Called periodically to dispatch TCP timers.
@@ -180,22 +180,22 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
      * or for a pcb that has been used and then entered the CLOSED state
      * is erroneous, but this should never happen as the pcb has in those cases
      * been freed, and so any remaining handles are bogus. */
-     /*【・_・?】
-     *【・_・?】
-     *【・_・?】
-     *【・_・?】
+     /*在CLOSED状态下关闭一个pcb似乎是错误的,
+     *尽管如此,一旦在这个状态下分配了而且还没有使用,用户需要一些办法来释放它
+     *调用一个已经被关闭的pcb的tcp_close(),(即2次)或者一个已经被使用了之后,进入CLOSE状态是错误的
+     *但在这些情况下被释放的pcb是不会存在的,因此,任何剩余的句柄都是假的
      */ 
-    err = ERR_OK;//【・_・?】
+    err = ERR_OK;//设定返回值
     if (pcb->local_port != 0) {
        TCP_RMV(&tcp_bound_pcbs, pcb);
     }
-    memp_free(MEMP_TCP_PCB, pcb);//【・_・?】
+    memp_free(MEMP_TCP_PCB, pcb);//在MEMP_TCP_PCB内存池设定释放掉的pcb对应的单元值,释放内存
     pcb = NULL;
     break;
   case LISTEN:
     err = ERR_OK;
-    tcp_pcb_remove(&tcp_listen_pcbs.pcbs, pcb);//【・_・?】
-    memp_free(MEMP_TCP_PCB_LISTEN, pcb);//【・_・?】
+    tcp_pcb_remove(&tcp_listen_pcbs.pcbs, pcb);//从监听的PCB列表中删除对应的pcb 
+    memp_free(MEMP_TCP_PCB_LISTEN, pcb);//在MEMP_TCP_PCB_LISTEN内存池中设定释放的pcb单元值  ,释放内存
     pcb = NULL;
     break;
   case SYN_SENT:
   ...


You shouldn't be so lazy.

Who is online

Users browsing this forum: Google [Bot] and 8 guests