1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Run new astyle formatter against libs Bridge, SpacebrewYun and Temboo

This commit is contained in:
Federico Fissore
2013-10-21 10:13:31 +02:00
parent b4c68b3dff
commit 00bdd3df03
19 changed files with 841 additions and 805 deletions

View File

@ -26,7 +26,7 @@ File::File(BridgeClass &b) : mode(255), bridge(b) {
File::File(const char *_filename, uint8_t _mode, BridgeClass &b) : mode(_mode), bridge(b) {
filename = _filename;
char modes[] = {'r','w','a'};
char modes[] = {'r', 'w', 'a'};
uint8_t cmd[] = {'F', modes[mode]};
uint8_t res[2];
dirPosition = 1;
@ -53,12 +53,12 @@ size_t File::write(uint8_t c) {
size_t File::write(const uint8_t *buf, size_t size) {
if (mode == 255)
return -1;
return -1;
uint8_t cmd[] = {'g', handle};
uint8_t res[1];
bridge.transfer(cmd, 2, buf, size, res, 1);
if (res[0] != 0) // res[0] contains error code
return -res[0];
return -res[0];
return size;
}
@ -91,7 +91,7 @@ boolean File::seek(uint32_t position) {
};
uint8_t res[1];
bridge.transfer(cmd, 6, res, 1);
if (res[0]==0) {
if (res[0] == 0) {
// If seek succeed then flush buffers
buffered = 0;
return true;
@ -121,10 +121,10 @@ void File::doBuffer() {
uint8_t cmd[] = {'G', handle, BUFFER_SIZE - 1};
buffered = bridge.transfer(cmd, 3, buffer, BUFFER_SIZE) - 1;
//err = buff[0]; // First byte is error code
if (buffered>0) {
if (buffered > 0) {
// Shift the reminder of buffer
for (uint8_t i=0; i<buffered; i++)
buffer[i] = buffer[i+1];
for (uint8_t i = 0; i < buffered; i++)
buffer[i] = buffer[i + 1];
}
}
@ -166,7 +166,7 @@ boolean File::isDirectory() {
}
File File::openNextFile(uint8_t mode){
File File::openNextFile(uint8_t mode) {
Process awk;
char tmp;
String command;
@ -178,26 +178,26 @@ File File::openNextFile(uint8_t mode){
command += " | awk 'NR==";
command += dirPosition;
command += "'";
awk.runShellCommand(command);
while(awk.running());
while (awk.running());
command = "";
while (awk.available()){
while (awk.available()) {
tmp = awk.read();
if (tmp!='\n') command += tmp;
if (tmp != '\n') command += tmp;
}
if (command.length() == 0)
return File();
dirPosition++;
filepath = filename + "/" + command;
return File(filepath.c_str(),mode);
}
return File(filepath.c_str(), mode);
void File::rewindDirectory(void){
}
void File::rewindDirectory(void) {
dirPosition = 1;
}